File tree Expand file tree Collapse file tree 5 files changed +705
-0
lines changed
test/fixtures/ast/error-duplicate-attribute Expand file tree Collapse file tree 5 files changed +705
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export class IntermediateTokenizer {
68
68
private tokenizer : Tokenizer
69
69
private currentToken : IntermediateToken | null
70
70
private attribute : VAttribute | null
71
+ private attributeNames : Set < string >
71
72
private expressionStartToken : Token | null
72
73
private expressionTokens : Token [ ]
73
74
@@ -126,6 +127,7 @@ export class IntermediateTokenizer {
126
127
this . tokenizer = tokenizer
127
128
this . currentToken = null
128
129
this . attribute = null
130
+ this . attributeNames = new Set < string > ( )
129
131
this . expressionStartToken = null
130
132
this . expressionTokens = [ ]
131
133
this . tokens = [ ]
@@ -339,6 +341,10 @@ export class IntermediateTokenizer {
339
341
this . reportParseError ( token , "end-tag-with-attributes" )
340
342
return null
341
343
}
344
+ if ( this . attributeNames . has ( token . value ) ) {
345
+ this . reportParseError ( token , "duplicate-attribute" )
346
+ }
347
+ this . attributeNames . add ( token . value )
342
348
343
349
this . attribute = {
344
350
type : "VAttribute" ,
@@ -470,6 +476,8 @@ export class IntermediateTokenizer {
470
476
selfClosing : false ,
471
477
attributes : [ ] ,
472
478
}
479
+ this . attribute = null
480
+ this . attributeNames . clear ( )
473
481
474
482
return result
475
483
}
You can’t perform that action at this time.
0 commit comments