File tree Expand file tree Collapse file tree 3 files changed +12
-56
lines changed
test/fixtures/ast/error-message-empty Expand file tree Collapse file tree 3 files changed +12
-56
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,15 @@ export class IntermediateTokenizer {
557557 const start = this . expressionStartToken
558558 const end = last ( this . expressionTokens ) || start
559559
560+ // If it's '{{}}', it's handled as a text.
561+ if ( token . range [ 0 ] === start . range [ 1 ] ) {
562+ this . tokens . pop ( )
563+ this . expressionStartToken = null
564+ const result = this . processText ( start )
565+ this . processText ( token )
566+ return result
567+ }
568+
560569 // If invalid notation `</>` exists directly before this token, separate it.
561570 if ( end . range [ 1 ] !== token . range [ 0 ] ) {
562571 const result = this . commit ( )
Original file line number Diff line number Diff line change 6363 "type" : " VText" ,
6464 "range" : [
6565 10 ,
66- 15
66+ 24
6767 ],
6868 "loc" : {
6969 "start" : {
7070 "line" : 1 ,
7171 "column" : 10
7272 },
73- "end" : {
74- "line" : 2 ,
75- "column" : 4
76- }
77- },
78- "value" : " \n "
79- },
80- {
81- "type" : " VExpressionContainer" ,
82- "range" : [
83- 15 ,
84- 19
85- ],
86- "loc" : {
87- "start" : {
88- "line" : 2 ,
89- "column" : 4
90- },
91- "end" : {
92- "line" : 2 ,
93- "column" : 8
94- }
95- },
96- "expression" : null ,
97- "references" : []
98- },
99- {
100- "type" : " VText" ,
101- "range" : [
102- 19 ,
103- 24
104- ],
105- "loc" : {
106- "start" : {
107- "line" : 2 ,
108- "column" : 8
109- },
11073 "end" : {
11174 "line" : 3 ,
11275 "column" : 4
11376 }
11477 },
115- "value" : " \n "
78+ "value" : " \n {{}} \n "
11679 },
11780 {
11881 "type" : " VExpressionContainer" ,
21662129 ],
21672130 "comments" : [],
21682131 "errors" : [
2169- {
2170- "message" : " Expected to be an expression, but got empty." ,
2171- "index" : 17 ,
2172- "lineNumber" : 2 ,
2173- "column" : 6
2174- },
21752132 {
21762133 "message" : " Expected to be an expression, but got empty." ,
21772134 "index" : 26 ,
Original file line number Diff line number Diff line change 1010 },
1111 {
1212 "type" : " VText" ,
13- "text" : " \n " ,
14- "children" : []
15- },
16- {
17- "type" : " VExpressionContainer" ,
18- "text" : " {{}}" ,
19- "children" : []
20- },
21- {
22- "type" : " VText" ,
23- "text" : " \n " ,
13+ "text" : " \n {{}}\n " ,
2414 "children" : []
2515 },
2616 {
You can’t perform that action at this time.
0 commit comments