@angular/compiler 21.1.0-next.4 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/fesm2022/compiler.mjs +320 -158
- package/fesm2022/compiler.mjs.map +1 -1
- package/package.json +1 -1
- package/types/compiler.d.ts +81 -44
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v21.1.0
|
|
3
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -1529,7 +1529,7 @@ class LiteralArrayExpr extends Expression {
|
|
|
1529
1529
|
return new LiteralArrayExpr(this.entries.map(e => e.clone()), this.type, this.sourceSpan);
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
|
-
class
|
|
1532
|
+
class LiteralMapPropertyAssignment {
|
|
1533
1533
|
key;
|
|
1534
1534
|
value;
|
|
1535
1535
|
quoted;
|
|
@@ -1542,7 +1542,25 @@ class LiteralMapEntry {
|
|
|
1542
1542
|
return this.key === e.key && this.value.isEquivalent(e.value);
|
|
1543
1543
|
}
|
|
1544
1544
|
clone() {
|
|
1545
|
-
return new
|
|
1545
|
+
return new LiteralMapPropertyAssignment(this.key, this.value.clone(), this.quoted);
|
|
1546
|
+
}
|
|
1547
|
+
isConstant() {
|
|
1548
|
+
return this.value.isConstant();
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
class LiteralMapSpreadAssignment {
|
|
1552
|
+
expression;
|
|
1553
|
+
constructor(expression) {
|
|
1554
|
+
this.expression = expression;
|
|
1555
|
+
}
|
|
1556
|
+
isEquivalent(e) {
|
|
1557
|
+
return e instanceof LiteralMapSpreadAssignment && this.expression.isEquivalent(e.expression);
|
|
1558
|
+
}
|
|
1559
|
+
clone() {
|
|
1560
|
+
return new LiteralMapSpreadAssignment(this.expression.clone());
|
|
1561
|
+
}
|
|
1562
|
+
isConstant() {
|
|
1563
|
+
return this.expression.isConstant();
|
|
1546
1564
|
}
|
|
1547
1565
|
}
|
|
1548
1566
|
class LiteralMapExpr extends Expression {
|
|
@@ -1559,7 +1577,7 @@ class LiteralMapExpr extends Expression {
|
|
|
1559
1577
|
return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);
|
|
1560
1578
|
}
|
|
1561
1579
|
isConstant() {
|
|
1562
|
-
return this.entries.every(e => e.
|
|
1580
|
+
return this.entries.every(e => e.isConstant());
|
|
1563
1581
|
}
|
|
1564
1582
|
visitExpression(visitor, context) {
|
|
1565
1583
|
return visitor.visitLiteralMapExpr(this, context);
|
|
@@ -1588,6 +1606,25 @@ class CommaExpr extends Expression {
|
|
|
1588
1606
|
return new CommaExpr(this.parts.map(p => p.clone()));
|
|
1589
1607
|
}
|
|
1590
1608
|
}
|
|
1609
|
+
class SpreadElementExpr extends Expression {
|
|
1610
|
+
expression;
|
|
1611
|
+
constructor(expression, sourceSpan) {
|
|
1612
|
+
super(null, sourceSpan);
|
|
1613
|
+
this.expression = expression;
|
|
1614
|
+
}
|
|
1615
|
+
isEquivalent(e) {
|
|
1616
|
+
return e instanceof SpreadElementExpr && this.expression.isEquivalent(e.expression);
|
|
1617
|
+
}
|
|
1618
|
+
isConstant() {
|
|
1619
|
+
return this.expression.isConstant();
|
|
1620
|
+
}
|
|
1621
|
+
visitExpression(visitor, context) {
|
|
1622
|
+
return visitor.visitSpreadElementExpr(this, context);
|
|
1623
|
+
}
|
|
1624
|
+
clone() {
|
|
1625
|
+
return new SpreadElementExpr(this.expression.clone(), this.sourceSpan);
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1591
1628
|
const NULL_EXPR = new LiteralExpr(null, null, null);
|
|
1592
1629
|
const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
|
1593
1630
|
var StmtModifier;
|
|
@@ -1838,7 +1875,13 @@ let RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
1838
1875
|
return this.visitExpression(ast, context);
|
|
1839
1876
|
}
|
|
1840
1877
|
visitLiteralMapExpr(ast, context) {
|
|
1841
|
-
ast.entries.forEach(entry =>
|
|
1878
|
+
ast.entries.forEach(entry => {
|
|
1879
|
+
if (entry instanceof LiteralMapSpreadAssignment) {
|
|
1880
|
+
entry.expression.visitExpression(this, context);
|
|
1881
|
+
} else {
|
|
1882
|
+
entry.value.visitExpression(this, context);
|
|
1883
|
+
}
|
|
1884
|
+
});
|
|
1842
1885
|
return this.visitExpression(ast, context);
|
|
1843
1886
|
}
|
|
1844
1887
|
visitCommaExpr(ast, context) {
|
|
@@ -1857,6 +1900,10 @@ let RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
|
1857
1900
|
ast.expr.visitExpression(this, context);
|
|
1858
1901
|
return this.visitExpression(ast, context);
|
|
1859
1902
|
}
|
|
1903
|
+
visitSpreadElementExpr(ast, context) {
|
|
1904
|
+
ast.expression.visitExpression(this, context);
|
|
1905
|
+
return this.visitExpression(ast, context);
|
|
1906
|
+
}
|
|
1860
1907
|
visitAllExpressions(exprs, context) {
|
|
1861
1908
|
exprs.forEach(expr => expr.visitExpression(this, context));
|
|
1862
1909
|
}
|
|
@@ -1922,7 +1969,7 @@ function literalArr(values, type, sourceSpan) {
|
|
|
1922
1969
|
return new LiteralArrayExpr(values, type, sourceSpan);
|
|
1923
1970
|
}
|
|
1924
1971
|
function literalMap(values, type = null) {
|
|
1925
|
-
return new LiteralMapExpr(values.map(e => new
|
|
1972
|
+
return new LiteralMapExpr(values.map(e => new LiteralMapPropertyAssignment(e.key, e.value, e.quoted)), type, null);
|
|
1926
1973
|
}
|
|
1927
1974
|
function unary(operator, expr, type, sourceSpan) {
|
|
1928
1975
|
return new UnaryOperatorExpr(operator, expr, type, sourceSpan);
|
|
@@ -2011,8 +2058,9 @@ var output_ast = /*#__PURE__*/Object.freeze({
|
|
|
2011
2058
|
LeadingComment: LeadingComment,
|
|
2012
2059
|
LiteralArrayExpr: LiteralArrayExpr,
|
|
2013
2060
|
LiteralExpr: LiteralExpr,
|
|
2014
|
-
LiteralMapEntry: LiteralMapEntry,
|
|
2015
2061
|
LiteralMapExpr: LiteralMapExpr,
|
|
2062
|
+
LiteralMapPropertyAssignment: LiteralMapPropertyAssignment,
|
|
2063
|
+
LiteralMapSpreadAssignment: LiteralMapSpreadAssignment,
|
|
2016
2064
|
LiteralPiece: LiteralPiece,
|
|
2017
2065
|
LocalizedString: LocalizedString,
|
|
2018
2066
|
MapType: MapType,
|
|
@@ -2029,6 +2077,7 @@ var output_ast = /*#__PURE__*/Object.freeze({
|
|
|
2029
2077
|
RegularExpressionLiteralExpr: RegularExpressionLiteralExpr,
|
|
2030
2078
|
ReturnStatement: ReturnStatement,
|
|
2031
2079
|
STRING_TYPE: STRING_TYPE,
|
|
2080
|
+
SpreadElementExpr: SpreadElementExpr,
|
|
2032
2081
|
Statement: Statement,
|
|
2033
2082
|
get StmtModifier () { return StmtModifier; },
|
|
2034
2083
|
TYPED_NULL_EXPR: TYPED_NULL_EXPR,
|
|
@@ -2067,7 +2116,6 @@ var output_ast = /*#__PURE__*/Object.freeze({
|
|
|
2067
2116
|
});
|
|
2068
2117
|
|
|
2069
2118
|
const CONSTANT_PREFIX = '_c';
|
|
2070
|
-
const UNKNOWN_VALUE_KEY = variable('<unknown>');
|
|
2071
2119
|
const KEY_CONTEXT = {};
|
|
2072
2120
|
const POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS = 50;
|
|
2073
2121
|
class FixupExpression extends Expression {
|
|
@@ -2148,25 +2196,6 @@ class ConstantPool {
|
|
|
2148
2196
|
}
|
|
2149
2197
|
return this.sharedConstants.get(key);
|
|
2150
2198
|
}
|
|
2151
|
-
getLiteralFactory(literal) {
|
|
2152
|
-
if (literal instanceof LiteralArrayExpr) {
|
|
2153
|
-
const argumentsForKey = literal.entries.map(e => e.isConstant() ? e : UNKNOWN_VALUE_KEY);
|
|
2154
|
-
const key = GenericKeyFn.INSTANCE.keyOf(literalArr(argumentsForKey));
|
|
2155
|
-
return this._getLiteralFactory(key, literal.entries, entries => literalArr(entries));
|
|
2156
|
-
} else {
|
|
2157
|
-
const expressionForKey = literalMap(literal.entries.map(e => ({
|
|
2158
|
-
key: e.key,
|
|
2159
|
-
value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,
|
|
2160
|
-
quoted: e.quoted
|
|
2161
|
-
})));
|
|
2162
|
-
const key = GenericKeyFn.INSTANCE.keyOf(expressionForKey);
|
|
2163
|
-
return this._getLiteralFactory(key, literal.entries.map(e => e.value), entries => literalMap(entries.map((value, index) => ({
|
|
2164
|
-
key: literal.entries[index].key,
|
|
2165
|
-
value,
|
|
2166
|
-
quoted: literal.entries[index].quoted
|
|
2167
|
-
}))));
|
|
2168
|
-
}
|
|
2169
|
-
}
|
|
2170
2199
|
getSharedFunctionReference(fn, prefix, useUniqueName = true) {
|
|
2171
2200
|
const isArrow = fn instanceof ArrowFunctionExpr;
|
|
2172
2201
|
for (const current of this.statements) {
|
|
@@ -2181,23 +2210,6 @@ class ConstantPool {
|
|
|
2181
2210
|
this.statements.push(fn instanceof FunctionExpr ? fn.toDeclStmt(name, StmtModifier.Final) : new DeclareVarStmt(name, fn, INFERRED_TYPE, StmtModifier.Final, fn.sourceSpan));
|
|
2182
2211
|
return variable(name);
|
|
2183
2212
|
}
|
|
2184
|
-
_getLiteralFactory(key, values, resultMap) {
|
|
2185
|
-
let literalFactory = this.literalFactories.get(key);
|
|
2186
|
-
const literalFactoryArguments = values.filter(e => !e.isConstant());
|
|
2187
|
-
if (!literalFactory) {
|
|
2188
|
-
const resultExpressions = values.map((e, index) => e.isConstant() ? this.getConstLiteral(e, true) : variable(`a${index}`));
|
|
2189
|
-
const parameters = resultExpressions.filter(isVariable).map(e => new FnParam(e.name, DYNAMIC_TYPE));
|
|
2190
|
-
const pureFunctionDeclaration = arrowFn(parameters, resultMap(resultExpressions), INFERRED_TYPE);
|
|
2191
|
-
const name = this.freshName();
|
|
2192
|
-
this.statements.push(new DeclareVarStmt(name, pureFunctionDeclaration, INFERRED_TYPE, StmtModifier.Final));
|
|
2193
|
-
literalFactory = variable(name);
|
|
2194
|
-
this.literalFactories.set(key, literalFactory);
|
|
2195
|
-
}
|
|
2196
|
-
return {
|
|
2197
|
-
literalFactory,
|
|
2198
|
-
literalFactoryArguments
|
|
2199
|
-
};
|
|
2200
|
-
}
|
|
2201
2213
|
uniqueName(name, alwaysIncludeSuffix = true) {
|
|
2202
2214
|
const count = this._claimedNames.get(name) ?? 0;
|
|
2203
2215
|
const result = count === 0 && !alwaysIncludeSuffix ? `${name}` : `${name}${count}`;
|
|
@@ -2226,11 +2238,15 @@ class GenericKeyFn {
|
|
|
2226
2238
|
} else if (expr instanceof LiteralMapExpr) {
|
|
2227
2239
|
const entries = [];
|
|
2228
2240
|
for (const entry of expr.entries) {
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2241
|
+
if (entry instanceof LiteralMapSpreadAssignment) {
|
|
2242
|
+
entries.push('...' + this.keyOf(entry.expression));
|
|
2243
|
+
} else {
|
|
2244
|
+
let key = entry.key;
|
|
2245
|
+
if (entry.quoted) {
|
|
2246
|
+
key = `"${key}"`;
|
|
2247
|
+
}
|
|
2248
|
+
entries.push(key + ':' + this.keyOf(entry.value));
|
|
2232
2249
|
}
|
|
2233
|
-
entries.push(key + ':' + this.keyOf(entry.value));
|
|
2234
2250
|
}
|
|
2235
2251
|
return `{${entries.join(',')}}`;
|
|
2236
2252
|
} else if (expr instanceof ExternalExpr) {
|
|
@@ -2239,14 +2255,13 @@ class GenericKeyFn {
|
|
|
2239
2255
|
return `read(${expr.name})`;
|
|
2240
2256
|
} else if (expr instanceof TypeofExpr) {
|
|
2241
2257
|
return `typeof(${this.keyOf(expr.expr)})`;
|
|
2258
|
+
} else if (expr instanceof SpreadElementExpr) {
|
|
2259
|
+
return `...${this.keyOf(expr.expression)}`;
|
|
2242
2260
|
} else {
|
|
2243
2261
|
throw new Error(`${this.constructor.name} does not handle expressions of type ${expr.constructor.name}`);
|
|
2244
2262
|
}
|
|
2245
2263
|
}
|
|
2246
2264
|
}
|
|
2247
|
-
function isVariable(e) {
|
|
2248
|
-
return e instanceof ReadVarExpr;
|
|
2249
|
-
}
|
|
2250
2265
|
function isLongStringLiteral(expr) {
|
|
2251
2266
|
return expr instanceof LiteralExpr && typeof expr.value === 'string' && expr.value.length >= POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS;
|
|
2252
2267
|
}
|
|
@@ -3666,8 +3681,13 @@ class AbstractEmitterVisitor {
|
|
|
3666
3681
|
visitLiteralMapExpr(ast, ctx) {
|
|
3667
3682
|
ctx.print(ast, `{`);
|
|
3668
3683
|
this.visitAllObjects(entry => {
|
|
3669
|
-
|
|
3670
|
-
|
|
3684
|
+
if (entry instanceof LiteralMapSpreadAssignment) {
|
|
3685
|
+
ctx.print(ast, '...');
|
|
3686
|
+
entry.expression.visitExpression(this, ctx);
|
|
3687
|
+
} else {
|
|
3688
|
+
ctx.print(ast, `${escapeIdentifier(entry.key, this._escapeDollarInStrings, entry.quoted)}:`);
|
|
3689
|
+
entry.value.visitExpression(this, ctx);
|
|
3690
|
+
}
|
|
3671
3691
|
}, ast.entries, ctx, ',');
|
|
3672
3692
|
ctx.print(ast, `}`);
|
|
3673
3693
|
return null;
|
|
@@ -3681,6 +3701,10 @@ class AbstractEmitterVisitor {
|
|
|
3681
3701
|
visitParenthesizedExpr(ast, ctx) {
|
|
3682
3702
|
ast.expr.visitExpression(this, ctx);
|
|
3683
3703
|
}
|
|
3704
|
+
visitSpreadElementExpr(ast, ctx) {
|
|
3705
|
+
ctx.print(ast, '...');
|
|
3706
|
+
ast.expression.visitExpression(this, ctx);
|
|
3707
|
+
}
|
|
3684
3708
|
visitAllExpressions(expressions, ctx, separator) {
|
|
3685
3709
|
this.visitAllObjects(expr => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
|
3686
3710
|
}
|
|
@@ -3988,7 +4012,7 @@ class ImplicitReceiver extends AST {
|
|
|
3988
4012
|
return visitor.visitImplicitReceiver(this, context);
|
|
3989
4013
|
}
|
|
3990
4014
|
}
|
|
3991
|
-
class ThisReceiver extends
|
|
4015
|
+
class ThisReceiver extends AST {
|
|
3992
4016
|
visit(visitor, context = null) {
|
|
3993
4017
|
return visitor.visitThisReceiver?.(this, context);
|
|
3994
4018
|
}
|
|
@@ -4106,6 +4130,16 @@ class LiteralArray extends AST {
|
|
|
4106
4130
|
return visitor.visitLiteralArray(this, context);
|
|
4107
4131
|
}
|
|
4108
4132
|
}
|
|
4133
|
+
class SpreadElement extends AST {
|
|
4134
|
+
expression;
|
|
4135
|
+
constructor(span, sourceSpan, expression) {
|
|
4136
|
+
super(span, sourceSpan);
|
|
4137
|
+
this.expression = expression;
|
|
4138
|
+
}
|
|
4139
|
+
visit(visitor, context = null) {
|
|
4140
|
+
return visitor.visitSpreadElement(this, context);
|
|
4141
|
+
}
|
|
4142
|
+
}
|
|
4109
4143
|
class LiteralMap extends AST {
|
|
4110
4144
|
keys;
|
|
4111
4145
|
values;
|
|
@@ -4432,6 +4466,9 @@ class RecursiveAstVisitor {
|
|
|
4432
4466
|
this.visit(ast.expression, context);
|
|
4433
4467
|
}
|
|
4434
4468
|
visitRegularExpressionLiteral(ast, context) {}
|
|
4469
|
+
visitSpreadElement(ast, context) {
|
|
4470
|
+
this.visit(ast.expression, context);
|
|
4471
|
+
}
|
|
4435
4472
|
visitAll(asts, context) {
|
|
4436
4473
|
for (const ast of asts) {
|
|
4437
4474
|
this.visit(ast, context);
|
|
@@ -4879,12 +4916,12 @@ class DeferredBlock extends BlockNode {
|
|
|
4879
4916
|
}
|
|
4880
4917
|
class SwitchBlock extends BlockNode {
|
|
4881
4918
|
expression;
|
|
4882
|
-
|
|
4919
|
+
groups;
|
|
4883
4920
|
unknownBlocks;
|
|
4884
|
-
constructor(expression,
|
|
4921
|
+
constructor(expression, groups, unknownBlocks, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
4885
4922
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
4886
4923
|
this.expression = expression;
|
|
4887
|
-
this.
|
|
4924
|
+
this.groups = groups;
|
|
4888
4925
|
this.unknownBlocks = unknownBlocks;
|
|
4889
4926
|
}
|
|
4890
4927
|
visit(visitor) {
|
|
@@ -4893,16 +4930,26 @@ class SwitchBlock extends BlockNode {
|
|
|
4893
4930
|
}
|
|
4894
4931
|
class SwitchBlockCase extends BlockNode {
|
|
4895
4932
|
expression;
|
|
4933
|
+
constructor(expression, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
4934
|
+
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
4935
|
+
this.expression = expression;
|
|
4936
|
+
}
|
|
4937
|
+
visit(visitor) {
|
|
4938
|
+
return visitor.visitSwitchBlockCase(this);
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4941
|
+
class SwitchBlockCaseGroup extends BlockNode {
|
|
4942
|
+
cases;
|
|
4896
4943
|
children;
|
|
4897
4944
|
i18n;
|
|
4898
|
-
constructor(
|
|
4945
|
+
constructor(cases, children, sourceSpan, startSourceSpan, endSourceSpan, nameSpan, i18n) {
|
|
4899
4946
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
4900
|
-
this.
|
|
4947
|
+
this.cases = cases;
|
|
4901
4948
|
this.children = children;
|
|
4902
4949
|
this.i18n = i18n;
|
|
4903
4950
|
}
|
|
4904
4951
|
visit(visitor) {
|
|
4905
|
-
return visitor.
|
|
4952
|
+
return visitor.visitSwitchBlockCaseGroup(this);
|
|
4906
4953
|
}
|
|
4907
4954
|
}
|
|
4908
4955
|
class ForLoopBlock extends BlockNode {
|
|
@@ -5216,9 +5263,11 @@ let RecursiveVisitor$1 = class RecursiveVisitor {
|
|
|
5216
5263
|
visitAll$1(this, block.children);
|
|
5217
5264
|
}
|
|
5218
5265
|
visitSwitchBlock(block) {
|
|
5219
|
-
visitAll$1(this, block.
|
|
5266
|
+
visitAll$1(this, block.groups);
|
|
5220
5267
|
}
|
|
5221
|
-
visitSwitchBlockCase(block) {
|
|
5268
|
+
visitSwitchBlockCase(block) {}
|
|
5269
|
+
visitSwitchBlockCaseGroup(block) {
|
|
5270
|
+
visitAll$1(this, block.cases);
|
|
5222
5271
|
visitAll$1(this, block.children);
|
|
5223
5272
|
}
|
|
5224
5273
|
visitForLoopBlock(block) {
|
|
@@ -6494,7 +6543,7 @@ class JitEmitterVisitor extends AbstractJsEmitterVisitor {
|
|
|
6494
6543
|
this.refResolver = refResolver;
|
|
6495
6544
|
}
|
|
6496
6545
|
createReturnStmt(ctx) {
|
|
6497
|
-
const stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(resultVar => new
|
|
6546
|
+
const stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(resultVar => new LiteralMapPropertyAssignment(resultVar, variable(resultVar), false))));
|
|
6498
6547
|
stmt.visitStatement(this, ctx);
|
|
6499
6548
|
}
|
|
6500
6549
|
getArgs() {
|
|
@@ -7793,6 +7842,7 @@ function createControlOp(op) {
|
|
|
7793
7842
|
return {
|
|
7794
7843
|
kind: OpKind.Control,
|
|
7795
7844
|
target: op.target,
|
|
7845
|
+
name: op.name,
|
|
7796
7846
|
expression: op.expression,
|
|
7797
7847
|
bindingKind: op.bindingKind,
|
|
7798
7848
|
securityContext: op.securityContext,
|
|
@@ -8662,8 +8712,12 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
8662
8712
|
expr.entries[i] = transformExpressionsInExpression(expr.entries[i], transform, flags);
|
|
8663
8713
|
}
|
|
8664
8714
|
} else if (expr instanceof LiteralMapExpr) {
|
|
8665
|
-
for (
|
|
8666
|
-
|
|
8715
|
+
for (const entry of expr.entries) {
|
|
8716
|
+
if (entry instanceof LiteralMapSpreadAssignment) {
|
|
8717
|
+
entry.expression = transformExpressionsInExpression(entry.expression, transform, flags);
|
|
8718
|
+
} else {
|
|
8719
|
+
entry.value = transformExpressionsInExpression(entry.value, transform, flags);
|
|
8720
|
+
}
|
|
8667
8721
|
}
|
|
8668
8722
|
} else if (expr instanceof ConditionalExpr) {
|
|
8669
8723
|
expr.condition = transformExpressionsInExpression(expr.condition, transform, flags);
|
|
@@ -8698,6 +8752,8 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
8698
8752
|
}
|
|
8699
8753
|
} else if (expr instanceof ParenthesizedExpr) {
|
|
8700
8754
|
expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
|
|
8755
|
+
} else if (expr instanceof SpreadElementExpr) {
|
|
8756
|
+
expr.expression = transformExpressionsInExpression(expr.expression, transform, flags);
|
|
8701
8757
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr || expr instanceof RegularExpressionLiteralExpr) ; else {
|
|
8702
8758
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
8703
8759
|
}
|
|
@@ -9692,7 +9748,7 @@ function extractAttributes(job) {
|
|
|
9692
9748
|
}
|
|
9693
9749
|
break;
|
|
9694
9750
|
case OpKind.Control:
|
|
9695
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null,
|
|
9751
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.Property, null, op.name, null, null, null, op.securityContext), lookupElement$3(elements, op.target));
|
|
9696
9752
|
break;
|
|
9697
9753
|
case OpKind.TwoWayProperty:
|
|
9698
9754
|
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.TwoWayProperty, null, op.name, null, null, null, op.securityContext), lookupElement$3(elements, op.target));
|
|
@@ -9802,7 +9858,7 @@ function specializeBindings(job) {
|
|
|
9802
9858
|
OpList.replace(op, createAttributeOp(op.target, null, op.name, op.expression, op.securityContext, false, op.isStructuralTemplateAttribute, op.templateKind, op.i18nMessage, op.sourceSpan));
|
|
9803
9859
|
} else if (job.kind === CompilationJobKind.Host) {
|
|
9804
9860
|
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
9805
|
-
} else if (op.name === '
|
|
9861
|
+
} else if (op.name === 'formField') {
|
|
9806
9862
|
OpList.replace(op, createControlOp(op));
|
|
9807
9863
|
} else {
|
|
9808
9864
|
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
@@ -13557,6 +13613,11 @@ class _Tokenizer {
|
|
|
13557
13613
|
if (this._attemptCharCode($LBRACE)) {
|
|
13558
13614
|
this._beginToken(25);
|
|
13559
13615
|
this._endToken([]);
|
|
13616
|
+
} else if (this._isBlockStart() && (startToken.parts[0] === 'case' || startToken.parts[0] === 'default')) {
|
|
13617
|
+
this._beginToken(25);
|
|
13618
|
+
this._endToken([]);
|
|
13619
|
+
this._beginToken(26);
|
|
13620
|
+
this._endToken([]);
|
|
13560
13621
|
} else {
|
|
13561
13622
|
startToken.type = 28;
|
|
13562
13623
|
}
|
|
@@ -15507,7 +15568,18 @@ class _Scanner {
|
|
|
15507
15568
|
switch (peek) {
|
|
15508
15569
|
case $PERIOD:
|
|
15509
15570
|
this.advance();
|
|
15510
|
-
|
|
15571
|
+
if (isDigit(this.peek)) {
|
|
15572
|
+
return this.scanNumber(start);
|
|
15573
|
+
}
|
|
15574
|
+
if (this.peek !== $PERIOD) {
|
|
15575
|
+
return newCharacterToken(start, this.index, $PERIOD);
|
|
15576
|
+
}
|
|
15577
|
+
this.advance();
|
|
15578
|
+
if (this.peek === $PERIOD) {
|
|
15579
|
+
this.advance();
|
|
15580
|
+
return newOperatorToken(start, this.index, '...');
|
|
15581
|
+
}
|
|
15582
|
+
return this.error(`Unexpected character [${String.fromCharCode(peek)}]`, 0);
|
|
15511
15583
|
case $LPAREN:
|
|
15512
15584
|
case $RPAREN:
|
|
15513
15585
|
case $LBRACKET:
|
|
@@ -16462,14 +16534,14 @@ class _ParseAST {
|
|
|
16462
16534
|
return new PrefixNot(this.span(start), this.sourceSpan(start), result);
|
|
16463
16535
|
}
|
|
16464
16536
|
} else if (this.next.isKeywordTypeof()) {
|
|
16465
|
-
this.advance();
|
|
16466
16537
|
const start = this.inputIndex;
|
|
16467
|
-
|
|
16538
|
+
this.advance();
|
|
16539
|
+
const result = this.parsePrefix();
|
|
16468
16540
|
return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
|
|
16469
16541
|
} else if (this.next.isKeywordVoid()) {
|
|
16470
|
-
this.advance();
|
|
16471
16542
|
const start = this.inputIndex;
|
|
16472
|
-
|
|
16543
|
+
this.advance();
|
|
16544
|
+
const result = this.parsePrefix();
|
|
16473
16545
|
return new VoidExpression(this.span(start), this.sourceSpan(start), result);
|
|
16474
16546
|
}
|
|
16475
16547
|
return this.parseCallChain();
|
|
@@ -16531,11 +16603,7 @@ class _ParseAST {
|
|
|
16531
16603
|
this.advance();
|
|
16532
16604
|
return new ThisReceiver(this.span(start), this.sourceSpan(start));
|
|
16533
16605
|
} else if (this.consumeOptionalCharacter($LBRACKET)) {
|
|
16534
|
-
this.
|
|
16535
|
-
const elements = this.parseExpressionList($RBRACKET);
|
|
16536
|
-
this.rbracketsExpected--;
|
|
16537
|
-
this.expectCharacter($RBRACKET);
|
|
16538
|
-
return new LiteralArray(this.span(start), this.sourceSpan(start), elements);
|
|
16606
|
+
return this.parseLiteralArray(start);
|
|
16539
16607
|
} else if (this.next.isCharacter($LBRACE)) {
|
|
16540
16608
|
return this.parseLiteralMap();
|
|
16541
16609
|
} else if (this.next.isIdentifier()) {
|
|
@@ -16565,16 +16633,21 @@ class _ParseAST {
|
|
|
16565
16633
|
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
16566
16634
|
}
|
|
16567
16635
|
}
|
|
16568
|
-
|
|
16569
|
-
|
|
16636
|
+
parseLiteralArray(arrayStart) {
|
|
16637
|
+
this.rbracketsExpected++;
|
|
16638
|
+
const elements = [];
|
|
16570
16639
|
do {
|
|
16571
|
-
if (
|
|
16572
|
-
|
|
16640
|
+
if (this.next.isOperator('...')) {
|
|
16641
|
+
elements.push(this.parseSpreadElement());
|
|
16642
|
+
} else if (!this.next.isCharacter($RBRACKET)) {
|
|
16643
|
+
elements.push(this.parsePipe());
|
|
16573
16644
|
} else {
|
|
16574
16645
|
break;
|
|
16575
16646
|
}
|
|
16576
16647
|
} while (this.consumeOptionalCharacter($COMMA));
|
|
16577
|
-
|
|
16648
|
+
this.rbracketsExpected--;
|
|
16649
|
+
this.expectCharacter($RBRACKET);
|
|
16650
|
+
return new LiteralArray(this.span(arrayStart), this.sourceSpan(arrayStart), elements);
|
|
16578
16651
|
}
|
|
16579
16652
|
parseLiteralMap() {
|
|
16580
16653
|
const keys = [];
|
|
@@ -16585,11 +16658,26 @@ class _ParseAST {
|
|
|
16585
16658
|
this.rbracesExpected++;
|
|
16586
16659
|
do {
|
|
16587
16660
|
const keyStart = this.inputIndex;
|
|
16661
|
+
if (this.next.isOperator('...')) {
|
|
16662
|
+
this.advance();
|
|
16663
|
+
keys.push({
|
|
16664
|
+
kind: 'spread',
|
|
16665
|
+
span: this.span(keyStart),
|
|
16666
|
+
sourceSpan: this.sourceSpan(keyStart)
|
|
16667
|
+
});
|
|
16668
|
+
values.push(this.parsePipe());
|
|
16669
|
+
continue;
|
|
16670
|
+
}
|
|
16588
16671
|
const quoted = this.next.isString();
|
|
16589
16672
|
const key = this.expectIdentifierOrKeywordOrString();
|
|
16673
|
+
const keySpan = this.span(keyStart);
|
|
16674
|
+
const keySourceSpan = this.sourceSpan(keyStart);
|
|
16590
16675
|
const literalMapKey = {
|
|
16676
|
+
kind: 'property',
|
|
16591
16677
|
key,
|
|
16592
|
-
quoted
|
|
16678
|
+
quoted,
|
|
16679
|
+
span: keySpan,
|
|
16680
|
+
sourceSpan: keySourceSpan
|
|
16593
16681
|
};
|
|
16594
16682
|
keys.push(literalMapKey);
|
|
16595
16683
|
if (quoted) {
|
|
@@ -16599,9 +16687,7 @@ class _ParseAST {
|
|
|
16599
16687
|
values.push(this.parsePipe());
|
|
16600
16688
|
} else {
|
|
16601
16689
|
literalMapKey.isShorthandInitialized = true;
|
|
16602
|
-
|
|
16603
|
-
const sourceSpan = this.sourceSpan(keyStart);
|
|
16604
|
-
values.push(new PropertyRead(span, sourceSpan, sourceSpan, new ImplicitReceiver(span, sourceSpan), key));
|
|
16690
|
+
values.push(new PropertyRead(keySpan, keySourceSpan, keySourceSpan, new ImplicitReceiver(keySpan, keySourceSpan), key));
|
|
16605
16691
|
}
|
|
16606
16692
|
} while (this.consumeOptionalCharacter($COMMA) && !this.next.isCharacter($RBRACE));
|
|
16607
16693
|
this.rbracesExpected--;
|
|
@@ -16656,13 +16742,26 @@ class _ParseAST {
|
|
|
16656
16742
|
return isSafe ? new SafeCall(span, sourceSpan, receiver, args, argumentSpan) : new Call(span, sourceSpan, receiver, args, argumentSpan);
|
|
16657
16743
|
}
|
|
16658
16744
|
parseCallArguments() {
|
|
16659
|
-
if (this.next.isCharacter($RPAREN))
|
|
16745
|
+
if (this.next.isCharacter($RPAREN)) {
|
|
16746
|
+
return [];
|
|
16747
|
+
}
|
|
16660
16748
|
const positionals = [];
|
|
16661
16749
|
do {
|
|
16662
|
-
positionals.push(this.parsePipe());
|
|
16750
|
+
positionals.push(this.next.isOperator('...') ? this.parseSpreadElement() : this.parsePipe());
|
|
16663
16751
|
} while (this.consumeOptionalCharacter($COMMA));
|
|
16664
16752
|
return positionals;
|
|
16665
16753
|
}
|
|
16754
|
+
parseSpreadElement() {
|
|
16755
|
+
if (!this.next.isOperator('...')) {
|
|
16756
|
+
this.error("Spread element must start with '...' operator");
|
|
16757
|
+
}
|
|
16758
|
+
const spreadStart = this.inputIndex;
|
|
16759
|
+
this.advance();
|
|
16760
|
+
const expression = this.parsePipe();
|
|
16761
|
+
const span = this.span(spreadStart);
|
|
16762
|
+
const sourceSpan = this.sourceSpan(spreadStart);
|
|
16763
|
+
return new SpreadElement(span, sourceSpan, expression);
|
|
16764
|
+
}
|
|
16666
16765
|
expectTemplateBindingKey() {
|
|
16667
16766
|
let result = '';
|
|
16668
16767
|
let operatorFound = false;
|
|
@@ -16947,7 +17046,12 @@ class SerializeExpressionVisitor {
|
|
|
16947
17046
|
return `[${ast.expressions.map(e => e.visit(this, context)).join(', ')}]`;
|
|
16948
17047
|
}
|
|
16949
17048
|
visitLiteralMap(ast, context) {
|
|
16950
|
-
return `{${zip(ast.keys.map(literal =>
|
|
17049
|
+
return `{${zip(ast.keys.map(literal => {
|
|
17050
|
+
if (literal.kind === 'spread') {
|
|
17051
|
+
return '...';
|
|
17052
|
+
}
|
|
17053
|
+
return literal.quoted ? `'${literal.key}'` : literal.key;
|
|
17054
|
+
}), ast.values.map(value => value.visit(this, context))).map(([key, value]) => `${key}: ${value}`).join(', ')}}`;
|
|
16951
17055
|
}
|
|
16952
17056
|
visitLiteralPrimitive(ast) {
|
|
16953
17057
|
if (ast.value === null) return 'null';
|
|
@@ -16973,7 +17077,7 @@ class SerializeExpressionVisitor {
|
|
|
16973
17077
|
return `${ast.expression.visit(this, context)}!`;
|
|
16974
17078
|
}
|
|
16975
17079
|
visitPropertyRead(ast, context) {
|
|
16976
|
-
if (ast.receiver instanceof ImplicitReceiver) {
|
|
17080
|
+
if (ast.receiver instanceof ImplicitReceiver || ast.receiver instanceof ThisReceiver) {
|
|
16977
17081
|
return ast.name;
|
|
16978
17082
|
} else {
|
|
16979
17083
|
return `${ast.receiver.visit(this, context)}.${ast.name}`;
|
|
@@ -17020,6 +17124,9 @@ class SerializeExpressionVisitor {
|
|
|
17020
17124
|
visitTaggedTemplateLiteral(ast, context) {
|
|
17021
17125
|
return ast.tag.visit(this, context) + ast.template.visit(this, context);
|
|
17022
17126
|
}
|
|
17127
|
+
visitSpreadElement(ast, context) {
|
|
17128
|
+
return `...${ast.expression.visit(this, context)}`;
|
|
17129
|
+
}
|
|
17023
17130
|
visitParenthesizedExpression(ast, context) {
|
|
17024
17131
|
return '(' + ast.expression.visit(this, context) + ')';
|
|
17025
17132
|
}
|
|
@@ -17044,7 +17151,7 @@ function SECURITY_SCHEMA() {
|
|
|
17044
17151
|
registerContext(SecurityContext.HTML, ['iframe|srcdoc', '*|innerHTML', '*|outerHTML']);
|
|
17045
17152
|
registerContext(SecurityContext.STYLE, ['*|style']);
|
|
17046
17153
|
registerContext(SecurityContext.URL, ['*|formAction', 'area|href', 'a|href', 'a|xlink:href', 'form|action', 'annotation|href', 'annotation|xlink:href', 'annotation-xml|href', 'annotation-xml|xlink:href', 'maction|href', 'maction|xlink:href', 'malignmark|href', 'malignmark|xlink:href', 'math|href', 'math|xlink:href', 'mroot|href', 'mroot|xlink:href', 'msqrt|href', 'msqrt|xlink:href', 'merror|href', 'merror|xlink:href', 'mfrac|href', 'mfrac|xlink:href', 'mglyph|href', 'mglyph|xlink:href', 'msub|href', 'msub|xlink:href', 'msup|href', 'msup|xlink:href', 'msubsup|href', 'msubsup|xlink:href', 'mmultiscripts|href', 'mmultiscripts|xlink:href', 'mprescripts|href', 'mprescripts|xlink:href', 'mi|href', 'mi|xlink:href', 'mn|href', 'mn|xlink:href', 'mo|href', 'mo|xlink:href', 'mpadded|href', 'mpadded|xlink:href', 'mphantom|href', 'mphantom|xlink:href', 'mrow|href', 'mrow|xlink:href', 'ms|href', 'ms|xlink:href', 'mspace|href', 'mspace|xlink:href', 'mstyle|href', 'mstyle|xlink:href', 'mtable|href', 'mtable|xlink:href', 'mtd|href', 'mtd|xlink:href', 'mtr|href', 'mtr|xlink:href', 'mtext|href', 'mtext|xlink:href', 'mover|href', 'mover|xlink:href', 'munder|href', 'munder|xlink:href', 'munderover|href', 'munderover|xlink:href', 'semantics|href', 'semantics|xlink:href', 'none|href', 'none|xlink:href', 'img|src', 'video|src']);
|
|
17047
|
-
registerContext(SecurityContext.RESOURCE_URL, ['base|href', 'embed|src', 'frame|src', 'iframe|src', 'link|href', 'object|codebase', 'object|data', 'script|src']);
|
|
17154
|
+
registerContext(SecurityContext.RESOURCE_URL, ['base|href', 'embed|src', 'frame|src', 'iframe|src', 'link|href', 'object|codebase', 'object|data', 'script|src', 'script|href', 'script|xlink:href']);
|
|
17048
17155
|
registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, ['animate|attributeName', 'set|attributeName', 'animateMotion|attributeName', 'animateTransform|attributeName', 'unknown|attributeName', 'iframe|sandbox', 'iframe|allow', 'iframe|allowFullscreen', 'iframe|referrerPolicy', 'iframe|csp', 'iframe|fetchPriority', 'unknown|sandbox', 'unknown|allow', 'unknown|allowFullscreen', 'unknown|referrerPolicy', 'unknown|csp', 'unknown|fetchPriority']);
|
|
17049
17156
|
}
|
|
17050
17157
|
return _SECURITY_SCHEMA;
|
|
@@ -18876,6 +18983,8 @@ const UPDATE_ORDERING = [{
|
|
|
18876
18983
|
test: nonInterpolationPropertyKindTest
|
|
18877
18984
|
}, {
|
|
18878
18985
|
test: kindWithInterpolationTest(OpKind.Attribute, false)
|
|
18986
|
+
}, {
|
|
18987
|
+
test: kindTest(OpKind.Control)
|
|
18879
18988
|
}];
|
|
18880
18989
|
const UPDATE_HOST_ORDERING = [{
|
|
18881
18990
|
test: kindWithInterpolationTest(OpKind.DomProperty, true)
|
|
@@ -18894,7 +19003,7 @@ const UPDATE_HOST_ORDERING = [{
|
|
|
18894
19003
|
}, {
|
|
18895
19004
|
test: kindTest(OpKind.ClassProp)
|
|
18896
19005
|
}];
|
|
18897
|
-
const handledOpKinds = new Set([OpKind.Listener, OpKind.TwoWayListener, OpKind.AnimationListener, OpKind.StyleMap, OpKind.ClassMap, OpKind.StyleProp, OpKind.ClassProp, OpKind.Property, OpKind.TwoWayProperty, OpKind.DomProperty, OpKind.Attribute, OpKind.Animation]);
|
|
19006
|
+
const handledOpKinds = new Set([OpKind.Listener, OpKind.TwoWayListener, OpKind.AnimationListener, OpKind.StyleMap, OpKind.ClassMap, OpKind.StyleProp, OpKind.ClassProp, OpKind.Property, OpKind.TwoWayProperty, OpKind.DomProperty, OpKind.Attribute, OpKind.Animation, OpKind.Control]);
|
|
18898
19007
|
function orderOps(job) {
|
|
18899
19008
|
for (const unit of job.units) {
|
|
18900
19009
|
orderWithin(unit.create, CREATE_ORDERING);
|
|
@@ -19143,6 +19252,16 @@ function transformLiteralArray(expr) {
|
|
|
19143
19252
|
const derivedEntries = [];
|
|
19144
19253
|
const nonConstantArgs = [];
|
|
19145
19254
|
for (const entry of expr.entries) {
|
|
19255
|
+
if (entry instanceof SpreadElementExpr) {
|
|
19256
|
+
if (entry.expression.isConstant()) {
|
|
19257
|
+
derivedEntries.push(entry);
|
|
19258
|
+
} else {
|
|
19259
|
+
const idx = nonConstantArgs.length;
|
|
19260
|
+
nonConstantArgs.push(entry.expression);
|
|
19261
|
+
derivedEntries.push(new SpreadElementExpr(new PureFunctionParameterExpr(idx)));
|
|
19262
|
+
}
|
|
19263
|
+
continue;
|
|
19264
|
+
}
|
|
19146
19265
|
if (entry.isConstant()) {
|
|
19147
19266
|
derivedEntries.push(entry);
|
|
19148
19267
|
} else {
|
|
@@ -19157,15 +19276,25 @@ function transformLiteralMap(expr) {
|
|
|
19157
19276
|
let derivedEntries = [];
|
|
19158
19277
|
const nonConstantArgs = [];
|
|
19159
19278
|
for (const entry of expr.entries) {
|
|
19279
|
+
if (entry instanceof LiteralMapSpreadAssignment) {
|
|
19280
|
+
if (entry.expression.isConstant()) {
|
|
19281
|
+
derivedEntries.push(entry);
|
|
19282
|
+
} else {
|
|
19283
|
+
const idx = nonConstantArgs.length;
|
|
19284
|
+
nonConstantArgs.push(entry.expression);
|
|
19285
|
+
derivedEntries.push(new LiteralMapSpreadAssignment(new PureFunctionParameterExpr(idx)));
|
|
19286
|
+
}
|
|
19287
|
+
continue;
|
|
19288
|
+
}
|
|
19160
19289
|
if (entry.value.isConstant()) {
|
|
19161
19290
|
derivedEntries.push(entry);
|
|
19162
19291
|
} else {
|
|
19163
19292
|
const idx = nonConstantArgs.length;
|
|
19164
19293
|
nonConstantArgs.push(entry.value);
|
|
19165
|
-
derivedEntries.push(new
|
|
19294
|
+
derivedEntries.push(new LiteralMapPropertyAssignment(entry.key, new PureFunctionParameterExpr(idx), entry.quoted));
|
|
19166
19295
|
}
|
|
19167
19296
|
}
|
|
19168
|
-
return new PureFunctionExpr(
|
|
19297
|
+
return new PureFunctionExpr(new LiteralMapExpr(derivedEntries), nonConstantArgs);
|
|
19169
19298
|
}
|
|
19170
19299
|
|
|
19171
19300
|
function optimizeRegularExpressions(job) {
|
|
@@ -19446,13 +19575,14 @@ function ariaProperty(name, expression, sourceSpan) {
|
|
|
19446
19575
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
19447
19576
|
return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
|
|
19448
19577
|
}
|
|
19449
|
-
function control(expression, sanitizer, sourceSpan) {
|
|
19578
|
+
function control(name, expression, sanitizer, sourceSpan) {
|
|
19450
19579
|
const args = [];
|
|
19451
19580
|
if (expression instanceof Interpolation) {
|
|
19452
19581
|
args.push(interpolationToExpression(expression, sourceSpan));
|
|
19453
19582
|
} else {
|
|
19454
19583
|
args.push(expression);
|
|
19455
19584
|
}
|
|
19585
|
+
args.push(literal(name));
|
|
19456
19586
|
if (sanitizer !== null) {
|
|
19457
19587
|
args.push(sanitizer);
|
|
19458
19588
|
}
|
|
@@ -19547,7 +19677,7 @@ function pipeBindV(slot, varOffset, args) {
|
|
|
19547
19677
|
}
|
|
19548
19678
|
function textInterpolate(strings, expressions, sourceSpan) {
|
|
19549
19679
|
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
19550
|
-
return callVariadicInstruction(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs,
|
|
19680
|
+
return callVariadicInstruction(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs, sourceSpan);
|
|
19551
19681
|
}
|
|
19552
19682
|
function i18nExp(expr, sourceSpan) {
|
|
19553
19683
|
return call(Identifiers.i18nExp, [expr], sourceSpan);
|
|
@@ -19584,7 +19714,7 @@ function syntheticHostProperty(name, expression, sourceSpan) {
|
|
|
19584
19714
|
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
19585
19715
|
}
|
|
19586
19716
|
function pureFunction(varOffset, fn, args) {
|
|
19587
|
-
return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal(varOffset), fn], args,
|
|
19717
|
+
return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal(varOffset), fn], args, null);
|
|
19588
19718
|
}
|
|
19589
19719
|
function attachSourceLocation(templatePath, locations) {
|
|
19590
19720
|
return call(Identifiers.attachSourceLocations, [literal(templatePath), locations], null);
|
|
@@ -19607,7 +19737,7 @@ function collateInterpolationArgs(strings, expressions) {
|
|
|
19607
19737
|
}
|
|
19608
19738
|
function interpolationToExpression(interpolation, sourceSpan) {
|
|
19609
19739
|
const interpolationArgs = collateInterpolationArgs(interpolation.strings, interpolation.expressions);
|
|
19610
|
-
return callVariadicInstructionExpr(VALUE_INTERPOLATE_CONFIG, [], interpolationArgs,
|
|
19740
|
+
return callVariadicInstructionExpr(VALUE_INTERPOLATE_CONFIG, [], interpolationArgs, sourceSpan);
|
|
19611
19741
|
}
|
|
19612
19742
|
function call(instruction, args, sourceSpan) {
|
|
19613
19743
|
const expr = importExpr(instruction).callFn(args, sourceSpan);
|
|
@@ -19645,22 +19775,22 @@ const PURE_FUNCTION_CONFIG = {
|
|
|
19645
19775
|
variable: Identifiers.pureFunctionV,
|
|
19646
19776
|
mapping: n => n
|
|
19647
19777
|
};
|
|
19648
|
-
function callVariadicInstructionExpr(config, baseArgs, interpolationArgs,
|
|
19778
|
+
function callVariadicInstructionExpr(config, baseArgs, interpolationArgs, sourceSpan) {
|
|
19649
19779
|
const n = config.mapping(interpolationArgs.length);
|
|
19650
19780
|
const lastInterpolationArg = interpolationArgs.at(-1);
|
|
19651
|
-
if (
|
|
19781
|
+
if (interpolationArgs.length > 1 && lastInterpolationArg instanceof LiteralExpr && lastInterpolationArg.value === '') {
|
|
19652
19782
|
interpolationArgs.pop();
|
|
19653
19783
|
}
|
|
19654
19784
|
if (n < config.constant.length) {
|
|
19655
|
-
return importExpr(config.constant[n]).callFn([...baseArgs, ...interpolationArgs
|
|
19785
|
+
return importExpr(config.constant[n]).callFn([...baseArgs, ...interpolationArgs], sourceSpan);
|
|
19656
19786
|
} else if (config.variable !== null) {
|
|
19657
|
-
return importExpr(config.variable).callFn([...baseArgs, literalArr(interpolationArgs)
|
|
19787
|
+
return importExpr(config.variable).callFn([...baseArgs, literalArr(interpolationArgs)], sourceSpan);
|
|
19658
19788
|
} else {
|
|
19659
19789
|
throw new Error(`AssertionError: unable to call variadic function`);
|
|
19660
19790
|
}
|
|
19661
19791
|
}
|
|
19662
|
-
function callVariadicInstruction(config, baseArgs, interpolationArgs,
|
|
19663
|
-
return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs,
|
|
19792
|
+
function callVariadicInstruction(config, baseArgs, interpolationArgs, sourceSpan) {
|
|
19793
|
+
return createStatementOp(callVariadicInstructionExpr(config, baseArgs, interpolationArgs, sourceSpan).toStmt());
|
|
19664
19794
|
}
|
|
19665
19795
|
|
|
19666
19796
|
const GLOBAL_TARGET_RESOLVERS = new Map([['window', Identifiers.resolveWindow], ['document', Identifiers.resolveDocument], ['body', Identifiers.resolveBody]]);
|
|
@@ -20003,7 +20133,7 @@ function reifyProperty(op) {
|
|
|
20003
20133
|
return isAriaAttribute(op.name) ? ariaProperty(op.name, op.expression, op.sourceSpan) : property(op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
20004
20134
|
}
|
|
20005
20135
|
function reifyControl(op) {
|
|
20006
|
-
return control(op.expression, op.sanitizer, op.sourceSpan);
|
|
20136
|
+
return control(op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
20007
20137
|
}
|
|
20008
20138
|
function reifyIrExpression(expr) {
|
|
20009
20139
|
if (!isIrExpression(expr)) {
|
|
@@ -21800,7 +21930,7 @@ function ingestElement(unit, element) {
|
|
|
21800
21930
|
ingestNodes(unit, element.children);
|
|
21801
21931
|
const endOp = createElementEndOp(id, element.endSourceSpan ?? element.startSourceSpan);
|
|
21802
21932
|
unit.create.push(endOp);
|
|
21803
|
-
const fieldInput = element.inputs.find(input => input.name === '
|
|
21933
|
+
const fieldInput = element.inputs.find(input => input.name === 'formField' && input.type === BindingType.Property);
|
|
21804
21934
|
if (fieldInput) {
|
|
21805
21935
|
unit.create.push(createControlCreateOp(fieldInput.sourceSpan));
|
|
21806
21936
|
}
|
|
@@ -21910,32 +22040,34 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
21910
22040
|
unit.update.push(createConditionalOp(firstXref, null, conditions, ifBlock.sourceSpan));
|
|
21911
22041
|
}
|
|
21912
22042
|
function ingestSwitchBlock(unit, switchBlock) {
|
|
21913
|
-
if (switchBlock.
|
|
22043
|
+
if (switchBlock.groups.length === 0) {
|
|
21914
22044
|
return;
|
|
21915
22045
|
}
|
|
21916
22046
|
let firstXref = null;
|
|
21917
22047
|
let conditions = [];
|
|
21918
|
-
for (let i = 0; i < switchBlock.
|
|
21919
|
-
const
|
|
22048
|
+
for (let i = 0; i < switchBlock.groups.length; i++) {
|
|
22049
|
+
const switchCaseGroup = switchBlock.groups[i];
|
|
21920
22050
|
const cView = unit.job.allocateView(unit.xref);
|
|
21921
|
-
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref,
|
|
22051
|
+
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCaseGroup);
|
|
21922
22052
|
let switchCaseI18nMeta = undefined;
|
|
21923
|
-
if (
|
|
21924
|
-
if (!(
|
|
21925
|
-
throw Error(`Unhandled i18n metadata type for switch block: ${
|
|
22053
|
+
if (switchCaseGroup.i18n !== undefined) {
|
|
22054
|
+
if (!(switchCaseGroup.i18n instanceof BlockPlaceholder)) {
|
|
22055
|
+
throw Error(`Unhandled i18n metadata type for switch block: ${switchCaseGroup.i18n?.constructor.name}`);
|
|
21926
22056
|
}
|
|
21927
|
-
switchCaseI18nMeta =
|
|
22057
|
+
switchCaseI18nMeta = switchCaseGroup.i18n;
|
|
21928
22058
|
}
|
|
21929
22059
|
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
21930
|
-
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, 'Case', Namespace.HTML, switchCaseI18nMeta,
|
|
22060
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, 'Case', Namespace.HTML, switchCaseI18nMeta, switchCaseGroup.startSourceSpan, switchCaseGroup.sourceSpan);
|
|
21931
22061
|
unit.create.push(conditionalCreateOp);
|
|
21932
22062
|
if (firstXref === null) {
|
|
21933
22063
|
firstXref = cView.xref;
|
|
21934
22064
|
}
|
|
21935
|
-
const
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
22065
|
+
for (const switchCase of switchCaseGroup.cases) {
|
|
22066
|
+
const caseExpr = switchCase.expression ? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan) : null;
|
|
22067
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle);
|
|
22068
|
+
conditions.push(conditionalCaseExpr);
|
|
22069
|
+
}
|
|
22070
|
+
ingestNodes(cView, switchCaseGroup.children);
|
|
21939
22071
|
}
|
|
21940
22072
|
unit.update.push(createConditionalOp(firstXref, convertAst(switchBlock.expression, unit.job, null), conditions, switchBlock.sourceSpan));
|
|
21941
22073
|
}
|
|
@@ -22161,8 +22293,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
22161
22293
|
if (ast instanceof ASTWithSource) {
|
|
22162
22294
|
return convertAst(ast.ast, job, baseSourceSpan);
|
|
22163
22295
|
} else if (ast instanceof PropertyRead) {
|
|
22164
|
-
|
|
22165
|
-
if (isImplicitReceiver) {
|
|
22296
|
+
if (ast.receiver instanceof ImplicitReceiver) {
|
|
22166
22297
|
return new LexicalReadExpr(ast.name);
|
|
22167
22298
|
} else {
|
|
22168
22299
|
return new ReadPropExpr(convertAst(ast.receiver, job, baseSourceSpan), ast.name, null, convertSourceSpan(ast.span, baseSourceSpan));
|
|
@@ -22198,8 +22329,8 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
22198
22329
|
throw new Error(`AssertionError: Chain in unknown context`);
|
|
22199
22330
|
} else if (ast instanceof LiteralMap) {
|
|
22200
22331
|
const entries = ast.keys.map((key, idx) => {
|
|
22201
|
-
const value = ast.values[idx];
|
|
22202
|
-
return new
|
|
22332
|
+
const value = convertAst(ast.values[idx], job, baseSourceSpan);
|
|
22333
|
+
return key.kind === 'spread' ? new LiteralMapSpreadAssignment(value) : new LiteralMapPropertyAssignment(key.key, value, key.quoted);
|
|
22203
22334
|
});
|
|
22204
22335
|
return new LiteralMapExpr(entries, undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
22205
22336
|
} else if (ast instanceof LiteralArray) {
|
|
@@ -22232,6 +22363,8 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
22232
22363
|
return new ParenthesizedExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
22233
22364
|
} else if (ast instanceof RegularExpressionLiteral) {
|
|
22234
22365
|
return new RegularExpressionLiteralExpr(ast.body, ast.flags, baseSourceSpan);
|
|
22366
|
+
} else if (ast instanceof SpreadElement) {
|
|
22367
|
+
return new SpreadElementExpr(convertAst(ast.expression, job, baseSourceSpan));
|
|
22235
22368
|
} else {
|
|
22236
22369
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
22237
22370
|
}
|
|
@@ -22931,7 +23064,7 @@ class BindingParser {
|
|
|
22931
23064
|
if (ast instanceof NonNullAssert) {
|
|
22932
23065
|
return this._isAllowedAssignmentEvent(ast.expression);
|
|
22933
23066
|
}
|
|
22934
|
-
if (ast instanceof Call && ast.args.length === 1 && ast.receiver instanceof PropertyRead && ast.receiver.name === '$any' && ast.receiver.receiver instanceof ImplicitReceiver
|
|
23067
|
+
if (ast instanceof Call && ast.args.length === 1 && ast.receiver instanceof PropertyRead && ast.receiver.name === '$any' && ast.receiver.receiver instanceof ImplicitReceiver) {
|
|
22935
23068
|
return this._isAllowedAssignmentEvent(ast.args[0]);
|
|
22936
23069
|
}
|
|
22937
23070
|
if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
|
|
@@ -23141,9 +23274,10 @@ function createForLoop(ast, connectedBlocks, visitor, bindingParser) {
|
|
|
23141
23274
|
function createSwitchBlock(ast, visitor, bindingParser) {
|
|
23142
23275
|
const errors = validateSwitchBlock(ast);
|
|
23143
23276
|
const primaryExpression = ast.parameters.length > 0 ? parseBlockParameterToBinding(ast.parameters[0], bindingParser) : bindingParser.parseBinding('', false, ast.sourceSpan, 0);
|
|
23144
|
-
const
|
|
23277
|
+
const groups = [];
|
|
23145
23278
|
const unknownBlocks = [];
|
|
23146
|
-
let
|
|
23279
|
+
let collectedCases = [];
|
|
23280
|
+
let firstCaseStart = null;
|
|
23147
23281
|
for (const node of ast.children) {
|
|
23148
23282
|
if (!(node instanceof Block)) {
|
|
23149
23283
|
continue;
|
|
@@ -23152,19 +23286,34 @@ function createSwitchBlock(ast, visitor, bindingParser) {
|
|
|
23152
23286
|
unknownBlocks.push(new UnknownBlock(node.name, node.sourceSpan, node.nameSpan));
|
|
23153
23287
|
continue;
|
|
23154
23288
|
}
|
|
23155
|
-
const
|
|
23156
|
-
|
|
23157
|
-
if (
|
|
23158
|
-
|
|
23159
|
-
} else {
|
|
23160
|
-
cases.push(ast);
|
|
23289
|
+
const isCase = node.name === 'case';
|
|
23290
|
+
let expression = null;
|
|
23291
|
+
if (isCase) {
|
|
23292
|
+
expression = parseBlockParameterToBinding(node.parameters[0], bindingParser);
|
|
23161
23293
|
}
|
|
23294
|
+
const switchCase = new SwitchBlockCase(expression, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
23295
|
+
collectedCases.push(switchCase);
|
|
23296
|
+
const caseWithoutBody = node.children.length === 0 && node.endSourceSpan !== null && node.endSourceSpan.start.offset === node.endSourceSpan.end.offset;
|
|
23297
|
+
if (caseWithoutBody) {
|
|
23298
|
+
if (firstCaseStart === null) {
|
|
23299
|
+
firstCaseStart = node.sourceSpan;
|
|
23300
|
+
}
|
|
23301
|
+
continue;
|
|
23302
|
+
}
|
|
23303
|
+
let sourceSpan = node.sourceSpan;
|
|
23304
|
+
let startSourceSpan = node.startSourceSpan;
|
|
23305
|
+
if (firstCaseStart !== null) {
|
|
23306
|
+
sourceSpan = new ParseSourceSpan(firstCaseStart.start, node.sourceSpan.end);
|
|
23307
|
+
startSourceSpan = new ParseSourceSpan(firstCaseStart.start, node.startSourceSpan.end);
|
|
23308
|
+
firstCaseStart = null;
|
|
23309
|
+
}
|
|
23310
|
+
const group = new SwitchBlockCaseGroup(collectedCases, visitAll(visitor, node.children, node.children), sourceSpan, startSourceSpan, node.endSourceSpan, node.nameSpan, node.i18n);
|
|
23311
|
+
groups.push(group);
|
|
23312
|
+
collectedCases = [];
|
|
23162
23313
|
}
|
|
23163
|
-
|
|
23164
|
-
cases.push(defaultCase);
|
|
23165
|
-
}
|
|
23314
|
+
const node = new SwitchBlock(primaryExpression, groups, unknownBlocks, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.nameSpan);
|
|
23166
23315
|
return {
|
|
23167
|
-
node
|
|
23316
|
+
node,
|
|
23168
23317
|
errors
|
|
23169
23318
|
};
|
|
23170
23319
|
}
|
|
@@ -23684,17 +23833,19 @@ function createViewportTrigger(start, isHydrationTrigger, bindingParser, paramet
|
|
|
23684
23833
|
const parsed = bindingParser.parseBinding(parameters[0].expression, false, sourceSpan, sourceSpan.start.offset + start + parameters[0].start);
|
|
23685
23834
|
if (!(parsed.ast instanceof LiteralMap)) {
|
|
23686
23835
|
throw new Error('Options parameter of the "viewport" trigger must be an object literal');
|
|
23687
|
-
} else if (parsed.ast.keys.some(key => key.
|
|
23836
|
+
} else if (parsed.ast.keys.some(key => key.kind === 'spread')) {
|
|
23837
|
+
throw new Error('Spread operator are not allowed in this context');
|
|
23838
|
+
} else if (parsed.ast.keys.some(key => key.kind === 'property' && key.key === 'root')) {
|
|
23688
23839
|
throw new Error('The "root" option is not supported in the options parameter of the "viewport" trigger');
|
|
23689
23840
|
}
|
|
23690
|
-
const triggerIndex = parsed.ast.keys.findIndex(key => key.key === 'trigger');
|
|
23841
|
+
const triggerIndex = parsed.ast.keys.findIndex(key => key.kind === 'property' && key.key === 'trigger');
|
|
23691
23842
|
if (triggerIndex === -1) {
|
|
23692
23843
|
reference = null;
|
|
23693
23844
|
options = parsed.ast;
|
|
23694
23845
|
} else {
|
|
23695
23846
|
const value = parsed.ast.values[triggerIndex];
|
|
23696
23847
|
const triggerFilter = (_, index) => index !== triggerIndex;
|
|
23697
|
-
if (!(value instanceof PropertyRead) || !(value.receiver instanceof ImplicitReceiver)
|
|
23848
|
+
if (!(value instanceof PropertyRead) || !(value.receiver instanceof ImplicitReceiver)) {
|
|
23698
23849
|
throw new Error(`"trigger" option of the "viewport" trigger must be an identifier`);
|
|
23699
23850
|
}
|
|
23700
23851
|
reference = value.name;
|
|
@@ -25099,10 +25250,13 @@ class CombinedRecursiveAstVisitor extends RecursiveAstVisitor {
|
|
|
25099
25250
|
}
|
|
25100
25251
|
visitSwitchBlock(block) {
|
|
25101
25252
|
this.visit(block.expression);
|
|
25102
|
-
this.visitAllTemplateNodes(block.
|
|
25253
|
+
this.visitAllTemplateNodes(block.groups);
|
|
25103
25254
|
}
|
|
25104
25255
|
visitSwitchBlockCase(block) {
|
|
25105
25256
|
block.expression && this.visit(block.expression);
|
|
25257
|
+
}
|
|
25258
|
+
visitSwitchBlockCaseGroup(block) {
|
|
25259
|
+
this.visitAllTemplateNodes(block.cases);
|
|
25106
25260
|
this.visitAllTemplateNodes(block.children);
|
|
25107
25261
|
}
|
|
25108
25262
|
visitForLoopBlock(block) {
|
|
@@ -25261,7 +25415,7 @@ class Scope {
|
|
|
25261
25415
|
this.visitVariable(nodeOrNodes.item);
|
|
25262
25416
|
nodeOrNodes.contextVariables.forEach(v => this.visitVariable(v));
|
|
25263
25417
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
25264
|
-
} else if (nodeOrNodes instanceof
|
|
25418
|
+
} else if (nodeOrNodes instanceof SwitchBlockCaseGroup || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
25265
25419
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
25266
25420
|
} else if (!(nodeOrNodes instanceof HostElement)) {
|
|
25267
25421
|
nodeOrNodes.forEach(node => node.visit(this));
|
|
@@ -25297,9 +25451,10 @@ class Scope {
|
|
|
25297
25451
|
this.ingestScopedNode(block);
|
|
25298
25452
|
}
|
|
25299
25453
|
visitSwitchBlock(block) {
|
|
25300
|
-
block.
|
|
25454
|
+
block.groups.forEach(node => node.visit(this));
|
|
25301
25455
|
}
|
|
25302
|
-
visitSwitchBlockCase(block) {
|
|
25456
|
+
visitSwitchBlockCase(block) {}
|
|
25457
|
+
visitSwitchBlockCaseGroup(block) {
|
|
25303
25458
|
this.ingestScopedNode(block);
|
|
25304
25459
|
}
|
|
25305
25460
|
visitForLoopBlock(block) {
|
|
@@ -25416,9 +25571,10 @@ class DirectiveBinder {
|
|
|
25416
25571
|
block.children.forEach(child => child.visit(this));
|
|
25417
25572
|
}
|
|
25418
25573
|
visitSwitchBlock(block) {
|
|
25419
|
-
block.
|
|
25574
|
+
block.groups.forEach(node => node.visit(this));
|
|
25420
25575
|
}
|
|
25421
|
-
visitSwitchBlockCase(block) {
|
|
25576
|
+
visitSwitchBlockCase(block) {}
|
|
25577
|
+
visitSwitchBlockCaseGroup(block) {
|
|
25422
25578
|
block.children.forEach(node => node.visit(this));
|
|
25423
25579
|
}
|
|
25424
25580
|
visitForLoopBlock(block) {
|
|
@@ -25604,7 +25760,7 @@ class TemplateBinder extends CombinedRecursiveAstVisitor {
|
|
|
25604
25760
|
this.deferBlocks.push([nodeOrNodes, this.scope]);
|
|
25605
25761
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
25606
25762
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
25607
|
-
} else if (nodeOrNodes instanceof
|
|
25763
|
+
} else if (nodeOrNodes instanceof SwitchBlockCaseGroup || nodeOrNodes instanceof ForLoopBlockEmpty || nodeOrNodes instanceof DeferredBlockError || nodeOrNodes instanceof DeferredBlockPlaceholder || nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
25608
25764
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
25609
25765
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
25610
25766
|
} else if (nodeOrNodes instanceof HostElement) {
|
|
@@ -25652,6 +25808,9 @@ class TemplateBinder extends CombinedRecursiveAstVisitor {
|
|
|
25652
25808
|
}
|
|
25653
25809
|
visitSwitchBlockCase(block) {
|
|
25654
25810
|
block.expression?.visit(this);
|
|
25811
|
+
}
|
|
25812
|
+
visitSwitchBlockCaseGroup(block) {
|
|
25813
|
+
block.cases.forEach(caseNode => caseNode.visit(this));
|
|
25655
25814
|
this.ingestScopedNode(block);
|
|
25656
25815
|
}
|
|
25657
25816
|
visitForLoopBlock(block) {
|
|
@@ -25696,7 +25855,7 @@ class TemplateBinder extends CombinedRecursiveAstVisitor {
|
|
|
25696
25855
|
binder.ingest(node);
|
|
25697
25856
|
}
|
|
25698
25857
|
maybeMap(ast, name) {
|
|
25699
|
-
if (!(ast.receiver instanceof ImplicitReceiver)
|
|
25858
|
+
if (!(ast.receiver instanceof ImplicitReceiver)) {
|
|
25700
25859
|
return;
|
|
25701
25860
|
}
|
|
25702
25861
|
const target = this.scope.lookup(name);
|
|
@@ -28046,7 +28205,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
28046
28205
|
function compileDeclareClassMetadata(metadata) {
|
|
28047
28206
|
const definitionMap = new DefinitionMap();
|
|
28048
28207
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
28049
|
-
definitionMap.set('version', literal('21.1.0
|
|
28208
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28050
28209
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28051
28210
|
definitionMap.set('type', metadata.type);
|
|
28052
28211
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -28064,7 +28223,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
28064
28223
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
28065
28224
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
28066
28225
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
28067
|
-
definitionMap.set('version', literal('21.1.0
|
|
28226
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28068
28227
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28069
28228
|
definitionMap.set('type', metadata.type);
|
|
28070
28229
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -28137,7 +28296,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
28137
28296
|
const definitionMap = new DefinitionMap();
|
|
28138
28297
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
28139
28298
|
definitionMap.set('minVersion', literal(minVersion));
|
|
28140
|
-
definitionMap.set('version', literal('21.1.0
|
|
28299
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28141
28300
|
definitionMap.set('type', meta.type.value);
|
|
28142
28301
|
if (meta.isStandalone !== undefined) {
|
|
28143
28302
|
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
@@ -28463,13 +28622,16 @@ class BlockPresenceVisitor extends RecursiveVisitor$1 {
|
|
|
28463
28622
|
visitSwitchBlockCase() {
|
|
28464
28623
|
this.hasBlocks = true;
|
|
28465
28624
|
}
|
|
28625
|
+
visitSwitchBlockCaseGroup() {
|
|
28626
|
+
this.hasBlocks = true;
|
|
28627
|
+
}
|
|
28466
28628
|
}
|
|
28467
28629
|
|
|
28468
28630
|
const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
28469
28631
|
function compileDeclareFactoryFunction(meta) {
|
|
28470
28632
|
const definitionMap = new DefinitionMap();
|
|
28471
28633
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
28472
|
-
definitionMap.set('version', literal('21.1.0
|
|
28634
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28473
28635
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28474
28636
|
definitionMap.set('type', meta.type.value);
|
|
28475
28637
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -28495,7 +28657,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
28495
28657
|
function createInjectableDefinitionMap(meta) {
|
|
28496
28658
|
const definitionMap = new DefinitionMap();
|
|
28497
28659
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
28498
|
-
definitionMap.set('version', literal('21.1.0
|
|
28660
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28499
28661
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28500
28662
|
definitionMap.set('type', meta.type.value);
|
|
28501
28663
|
if (meta.providedIn !== undefined) {
|
|
@@ -28536,7 +28698,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
28536
28698
|
function createInjectorDefinitionMap(meta) {
|
|
28537
28699
|
const definitionMap = new DefinitionMap();
|
|
28538
28700
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
28539
|
-
definitionMap.set('version', literal('21.1.0
|
|
28701
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28540
28702
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28541
28703
|
definitionMap.set('type', meta.type.value);
|
|
28542
28704
|
definitionMap.set('providers', meta.providers);
|
|
@@ -28563,7 +28725,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
28563
28725
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
28564
28726
|
}
|
|
28565
28727
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
28566
|
-
definitionMap.set('version', literal('21.1.0
|
|
28728
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28567
28729
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28568
28730
|
definitionMap.set('type', meta.type.value);
|
|
28569
28731
|
if (meta.bootstrap.length > 0) {
|
|
@@ -28601,7 +28763,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
28601
28763
|
function createPipeDefinitionMap(meta) {
|
|
28602
28764
|
const definitionMap = new DefinitionMap();
|
|
28603
28765
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
28604
|
-
definitionMap.set('version', literal('21.1.0
|
|
28766
|
+
definitionMap.set('version', literal('21.1.0'));
|
|
28605
28767
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28606
28768
|
definitionMap.set('type', meta.type.value);
|
|
28607
28769
|
if (meta.isStandalone !== undefined) {
|
|
@@ -28675,9 +28837,9 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
28675
28837
|
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
28676
28838
|
}
|
|
28677
28839
|
|
|
28678
|
-
const VERSION = new Version('21.1.0
|
|
28840
|
+
const VERSION = new Version('21.1.0');
|
|
28679
28841
|
|
|
28680
28842
|
publishFacade(_global);
|
|
28681
28843
|
|
|
28682
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingPipeType, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CombinedRecursiveAstVisitor, CommaExpr, Comment, CompilerConfig, CompilerFacadeImpl, Component, Conditional, ConditionalExpr, ConstantPool, CssSelector, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, Directive, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, PrefixNot, PropertyRead, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, RegularExpressionLiteral, RegularExpressionLiteralExpr, ResourceLoader, ReturnStatement, SCHEMA, SECURITY_SCHEMA, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, SelectorlessMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Component$1 as TmplAstComponent, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Directive$1 as TmplAstDirective, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HostElement as TmplAstHostElement, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation$1 as ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ATTR_TO_PROP, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, escapeRegExp, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, setEnableTemplateSourceLocations, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
28844
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingPipeType, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CombinedRecursiveAstVisitor, CommaExpr, Comment, CompilerConfig, CompilerFacadeImpl, Component, Conditional, ConditionalExpr, ConstantPool, CssSelector, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, Directive, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralMapPropertyAssignment, LiteralMapSpreadAssignment, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, PrefixNot, PropertyRead, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, RegularExpressionLiteral, RegularExpressionLiteralExpr, ResourceLoader, ReturnStatement, SCHEMA, SECURITY_SCHEMA, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, SelectorlessMatcher, Serializer, SplitInterpolation, SpreadElement, SpreadElementExpr, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Component$1 as TmplAstComponent, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Directive$1 as TmplAstDirective, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HostElement as TmplAstHostElement, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, SwitchBlockCaseGroup as TmplAstSwitchBlockCaseGroup, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation$1 as ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ATTR_TO_PROP, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, escapeRegExp, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, setEnableTemplateSourceLocations, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
28683
28845
|
//# sourceMappingURL=compiler.mjs.map
|