feat(compiler): Propagate source span and value span to Variable AST (#36047)

This commit propagates the `sourceSpan` and `valueSpan` of a `VariableBinding`
in a microsyntax expression to `ParsedVariable`, and subsequently to
View Engine Variable AST and Ivy Variable AST.

Note that this commit does not propagate the `keySpan`, because it involves
significant changes to the template AST.

PR Close #36047
This commit is contained in:
Keen Yee Liau
2020-03-11 16:46:08 -07:00
committed by Andrew Kushnir
parent e179c5827f
commit 31bec8ce61
7 changed files with 46 additions and 18 deletions

View File

@ -161,8 +161,8 @@ class HtmlAstToIvyAst implements html.Visitor {
this.bindingParser.parseInlineTemplateBinding(
templateKey, templateValue, attribute.sourceSpan, absoluteValueOffset, [],
templateParsedProperties, parsedVariables);
templateVariables.push(
...parsedVariables.map(v => new t.Variable(v.name, v.value, v.sourceSpan)));
templateVariables.push(...parsedVariables.map(
v => new t.Variable(v.name, v.value, v.sourceSpan, v.valueSpan)));
} else {
// Check for variables, events, property bindings, interpolation
hasBinding = this.parseAttribute(