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 {
6868 private tokenizer : Tokenizer
6969 private currentToken : IntermediateToken | null
7070 private attribute : VAttribute | null
71+ private attributeNames : Set < string >
7172 private expressionStartToken : Token | null
7273 private expressionTokens : Token [ ]
7374
@@ -126,6 +127,7 @@ export class IntermediateTokenizer {
126127 this . tokenizer = tokenizer
127128 this . currentToken = null
128129 this . attribute = null
130+ this . attributeNames = new Set < string > ( )
129131 this . expressionStartToken = null
130132 this . expressionTokens = [ ]
131133 this . tokens = [ ]
@@ -339,6 +341,10 @@ export class IntermediateTokenizer {
339341 this . reportParseError ( token , "end-tag-with-attributes" )
340342 return null
341343 }
344+ if ( this . attributeNames . has ( token . value ) ) {
345+ this . reportParseError ( token , "duplicate-attribute" )
346+ }
347+ this . attributeNames . add ( token . value )
342348
343349 this . attribute = {
344350 type : "VAttribute" ,
@@ -470,6 +476,8 @@ export class IntermediateTokenizer {
470476 selfClosing : false ,
471477 attributes : [ ] ,
472478 }
479+ this . attribute = null
480+ this . attributeNames . clear ( )
473481
474482 return result
475483 }
You can’t perform that action at this time.
0 commit comments