You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Funnel all v1 AST node construction through parser builders
The parser builders are the defacto constructors for the v1 AST
nodes. As the nodes get increasingly more eloborate for backwards
compatibility and such, it's important that we share the logic for
constructing these nodes as much as possible so we don't miss any
cases.
Also standardize the signatures to use the object argument style,
you should be able to clone a node by passing it back into the same
builder method which it originated from.
@@ -101,7 +104,7 @@ export class TokenizerEventHandlers extends HandlebarsNodeVisitors {
101
104
throwgenerateSyntaxError(
102
105
'Invalid named block named detected, you may have created a named block without a name, or you may have began your name with a number. Named blocks must have names that are at least one character long, and begin with a lower case letter',
103
106
this.source.spanFor({
104
-
start: this.currentTag.loc.toJSON(),
107
+
start: this.currentTag.start.toJSON(),
105
108
end: this.offset().toJSON(),
106
109
})
107
110
);
@@ -116,19 +119,14 @@ export class TokenizerEventHandlers extends HandlebarsNodeVisitors {
116
119
}
117
120
118
121
finishStartTag(): void{
119
-
let{
120
-
name,
121
-
attributes: attrs,
122
-
modifiers,
123
-
comments,
124
-
selfClosing,
125
-
loc,
126
-
}=this.finish(this.currentStartTag);
122
+
let{ name, attributes, modifiers, comments, selfClosing, loc }=this.finish(
123
+
this.currentStartTag
124
+
);
127
125
128
126
letelement=b.element({
129
127
tag: name,
130
128
selfClosing,
131
-
attrs,
129
+
attributes,
132
130
modifiers,
133
131
comments,
134
132
children: [],
@@ -148,7 +146,7 @@ export class TokenizerEventHandlers extends HandlebarsNodeVisitors {
148
146
149
147
element.loc=element.loc.withEnd(this.offset());
150
148
parseElementBlockParams(element);
151
-
appendChild(parent,element);
149
+
appendChild(parent,b.element(element));
152
150
}
153
151
154
152
markTagAsSelfClosing(): void{
@@ -222,7 +220,7 @@ export class TokenizerEventHandlers extends HandlebarsNodeVisitors {
222
220
if(tag.type==='EndTag'){
223
221
throwgenerateSyntaxError(
224
222
`Invalid end tag: closing tag must not have attributes`,
0 commit comments