Skip to content

Commit 9b96e10

Browse files
authored
Merge pull request #225 from wechat-miniprogram/feat-alias-for-items
Support wx:for-items alias to wx:for
2 parents c2587b9 + 5acee41 commit 9b96e10

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

glass-easel-template-compiler/src/parse/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,7 @@ pub enum ParseErrorKind {
500500
ShouldQuoted,
501501
EmptyExpression,
502502
InvalidEndTag,
503+
DeprecatedAttribute,
503504
}
504505

505506
impl ParseErrorKind {
@@ -536,6 +537,7 @@ impl ParseErrorKind {
536537
Self::ShouldQuoted => "should be quoted",
537538
Self::EmptyExpression => "the expression is empty",
538539
Self::InvalidEndTag => "invalid end tag",
540+
Self::DeprecatedAttribute => "this attribute is deprecated",
539541
}
540542
}
541543

@@ -572,6 +574,7 @@ impl ParseErrorKind {
572574
Self::ShouldQuoted => ParseErrorLevel::Warn,
573575
Self::EmptyExpression => ParseErrorLevel::Warn,
574576
Self::InvalidEndTag => ParseErrorLevel::Warn,
577+
Self::DeprecatedAttribute => ParseErrorLevel::Warn,
575578
}
576579
}
577580
}

glass-easel-template-compiler/src/parse/tag.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,10 @@ impl Element {
807807
"for" => AttrPrefixKind::WxFor(x.location()),
808808
"for-index" => AttrPrefixKind::WxForIndex(x.location()),
809809
"for-item" => AttrPrefixKind::WxForItem(x.location()),
810+
"for-items" => {
811+
ps.add_warning(ParseErrorKind::DeprecatedAttribute, x.location());
812+
AttrPrefixKind::WxFor(x.location())
813+
},
810814
"key" => AttrPrefixKind::WxKey(x.location()),
811815
_ => AttrPrefixKind::Invalid(segs.first().unwrap().location()),
812816
},

0 commit comments

Comments
 (0)