File tree 3 files changed +12
-56
lines changed
test/fixtures/ast/error-message-empty
3 files changed +12
-56
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,15 @@ export class IntermediateTokenizer {
557
557
const start = this . expressionStartToken
558
558
const end = last ( this . expressionTokens ) || start
559
559
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
+
560
569
// If invalid notation `</>` exists directly before this token, separate it.
561
570
if ( end . range [ 1 ] !== token . range [ 0 ] ) {
562
571
const result = this . commit ( )
Original file line number Diff line number Diff line change 63
63
"type" : " VText" ,
64
64
"range" : [
65
65
10 ,
66
- 15
66
+ 24
67
67
],
68
68
"loc" : {
69
69
"start" : {
70
70
"line" : 1 ,
71
71
"column" : 10
72
72
},
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
- },
110
73
"end" : {
111
74
"line" : 3 ,
112
75
"column" : 4
113
76
}
114
77
},
115
- "value" : " \n "
78
+ "value" : " \n {{}} \n "
116
79
},
117
80
{
118
81
"type" : " VExpressionContainer" ,
2166
2129
],
2167
2130
"comments" : [],
2168
2131
"errors" : [
2169
- {
2170
- "message" : " Expected to be an expression, but got empty." ,
2171
- "index" : 17 ,
2172
- "lineNumber" : 2 ,
2173
- "column" : 6
2174
- },
2175
2132
{
2176
2133
"message" : " Expected to be an expression, but got empty." ,
2177
2134
"index" : 26 ,
Original file line number Diff line number Diff line change 10
10
},
11
11
{
12
12
"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 " ,
24
14
"children" : []
25
15
},
26
16
{
You can’t perform that action at this time.
0 commit comments