@angular/compiler 20.0.0-next.0 → 20.0.0-next.2
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/fesm2022/compiler.mjs +563 -523
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +4345 -4709
- package/package.json +5 -3
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v20.0.0-next.2
|
|
3
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -399,6 +399,10 @@ class SelectorContext {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
// Attention:
|
|
402
|
+
// This file duplicates types and values from @angular/core
|
|
403
|
+
// so that we are able to make @angular/compiler independent of @angular/core.
|
|
404
|
+
// This is important to prevent a build cycle, as @angular/core needs to
|
|
405
|
+
// be compiled with the compiler.
|
|
402
406
|
// Stores the default value of `emitDistinctChangesOnly` when the `emitDistinctChangesOnly` is not
|
|
403
407
|
// explicitly set.
|
|
404
408
|
const emitDistinctChangesOnlyDefaultValue = true;
|
|
@@ -484,15 +488,15 @@ function parseSelectorToR3Selector(selector) {
|
|
|
484
488
|
|
|
485
489
|
var core = /*#__PURE__*/Object.freeze({
|
|
486
490
|
__proto__: null,
|
|
487
|
-
|
|
488
|
-
get ViewEncapsulation () { return ViewEncapsulation; },
|
|
491
|
+
CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
|
|
489
492
|
get ChangeDetectionStrategy () { return ChangeDetectionStrategy; },
|
|
490
493
|
get InputFlags () { return InputFlags; },
|
|
491
|
-
|
|
494
|
+
get MissingTranslationStrategy () { return MissingTranslationStrategy; },
|
|
492
495
|
NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
|
|
493
|
-
Type: Type$1,
|
|
494
496
|
get SecurityContext () { return SecurityContext; },
|
|
495
|
-
|
|
497
|
+
Type: Type$1,
|
|
498
|
+
get ViewEncapsulation () { return ViewEncapsulation; },
|
|
499
|
+
emitDistinctChangesOnlyDefaultValue: emitDistinctChangesOnlyDefaultValue,
|
|
496
500
|
parseSelectorToR3Selector: parseSelectorToR3Selector
|
|
497
501
|
});
|
|
498
502
|
|
|
@@ -663,7 +667,7 @@ function fingerprint(str) {
|
|
|
663
667
|
let lo = hash32(view, utf8.length, 102072);
|
|
664
668
|
if (hi == 0 && (lo == 0 || lo == 1)) {
|
|
665
669
|
hi = hi ^ 0x130f9bef;
|
|
666
|
-
lo = lo ^ -
|
|
670
|
+
lo = lo ^ -1801410264;
|
|
667
671
|
}
|
|
668
672
|
return (BigInt.asUintN(32, BigInt(hi)) << BigInt(32)) | BigInt.asUintN(32, BigInt(lo));
|
|
669
673
|
}
|
|
@@ -1001,11 +1005,11 @@ class Expression {
|
|
|
1001
1005
|
and(rhs, sourceSpan) {
|
|
1002
1006
|
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
|
|
1003
1007
|
}
|
|
1004
|
-
bitwiseOr(rhs, sourceSpan
|
|
1005
|
-
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan
|
|
1008
|
+
bitwiseOr(rhs, sourceSpan) {
|
|
1009
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan);
|
|
1006
1010
|
}
|
|
1007
|
-
bitwiseAnd(rhs, sourceSpan
|
|
1008
|
-
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan
|
|
1011
|
+
bitwiseAnd(rhs, sourceSpan) {
|
|
1012
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan);
|
|
1009
1013
|
}
|
|
1010
1014
|
or(rhs, sourceSpan) {
|
|
1011
1015
|
return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
|
|
@@ -1678,16 +1682,34 @@ class UnaryOperatorExpr extends Expression {
|
|
|
1678
1682
|
return new UnaryOperatorExpr(this.operator, this.expr.clone(), this.type, this.sourceSpan, this.parens);
|
|
1679
1683
|
}
|
|
1680
1684
|
}
|
|
1685
|
+
class ParenthesizedExpr extends Expression {
|
|
1686
|
+
expr;
|
|
1687
|
+
constructor(expr, type, sourceSpan) {
|
|
1688
|
+
super(type, sourceSpan);
|
|
1689
|
+
this.expr = expr;
|
|
1690
|
+
}
|
|
1691
|
+
visitExpression(visitor, context) {
|
|
1692
|
+
return visitor.visitParenthesizedExpr(this, context);
|
|
1693
|
+
}
|
|
1694
|
+
isEquivalent(e) {
|
|
1695
|
+
// TODO: should this ignore paren depth? i.e. is `(1)` equivalent to `1`?
|
|
1696
|
+
return e instanceof ParenthesizedExpr && e.expr.isEquivalent(this.expr);
|
|
1697
|
+
}
|
|
1698
|
+
isConstant() {
|
|
1699
|
+
return this.expr.isConstant();
|
|
1700
|
+
}
|
|
1701
|
+
clone() {
|
|
1702
|
+
return new ParenthesizedExpr(this.expr.clone());
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1681
1705
|
class BinaryOperatorExpr extends Expression {
|
|
1682
1706
|
operator;
|
|
1683
1707
|
rhs;
|
|
1684
|
-
parens;
|
|
1685
1708
|
lhs;
|
|
1686
|
-
constructor(operator, lhs, rhs, type, sourceSpan
|
|
1709
|
+
constructor(operator, lhs, rhs, type, sourceSpan) {
|
|
1687
1710
|
super(type || lhs.type, sourceSpan);
|
|
1688
1711
|
this.operator = operator;
|
|
1689
1712
|
this.rhs = rhs;
|
|
1690
|
-
this.parens = parens;
|
|
1691
1713
|
this.lhs = lhs;
|
|
1692
1714
|
}
|
|
1693
1715
|
isEquivalent(e) {
|
|
@@ -1703,7 +1725,7 @@ class BinaryOperatorExpr extends Expression {
|
|
|
1703
1725
|
return visitor.visitBinaryOperatorExpr(this, context);
|
|
1704
1726
|
}
|
|
1705
1727
|
clone() {
|
|
1706
|
-
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan
|
|
1728
|
+
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan);
|
|
1707
1729
|
}
|
|
1708
1730
|
}
|
|
1709
1731
|
class ReadPropExpr extends Expression {
|
|
@@ -1975,7 +1997,7 @@ class IfStmt extends Statement {
|
|
|
1975
1997
|
return visitor.visitIfStmt(this, context);
|
|
1976
1998
|
}
|
|
1977
1999
|
}
|
|
1978
|
-
|
|
2000
|
+
let RecursiveAstVisitor$1 = class RecursiveAstVisitor {
|
|
1979
2001
|
visitType(ast, context) {
|
|
1980
2002
|
return ast;
|
|
1981
2003
|
}
|
|
@@ -2007,12 +2029,6 @@ class RecursiveAstVisitor$1 {
|
|
|
2007
2029
|
visitWrappedNodeExpr(ast, context) {
|
|
2008
2030
|
return ast;
|
|
2009
2031
|
}
|
|
2010
|
-
visitTypeofExpr(ast, context) {
|
|
2011
|
-
return this.visitExpression(ast, context);
|
|
2012
|
-
}
|
|
2013
|
-
visitVoidExpr(ast, context) {
|
|
2014
|
-
return this.visitExpression(ast, context);
|
|
2015
|
-
}
|
|
2016
2032
|
visitReadVarExpr(ast, context) {
|
|
2017
2033
|
return this.visitExpression(ast, context);
|
|
2018
2034
|
}
|
|
@@ -2090,6 +2106,14 @@ class RecursiveAstVisitor$1 {
|
|
|
2090
2106
|
ast.expr.visitExpression(this, context);
|
|
2091
2107
|
return this.visitExpression(ast, context);
|
|
2092
2108
|
}
|
|
2109
|
+
visitTypeofExpr(ast, context) {
|
|
2110
|
+
ast.expr.visitExpression(this, context);
|
|
2111
|
+
return this.visitExpression(ast, context);
|
|
2112
|
+
}
|
|
2113
|
+
visitVoidExpr(ast, context) {
|
|
2114
|
+
ast.expr.visitExpression(this, context);
|
|
2115
|
+
return this.visitExpression(ast, context);
|
|
2116
|
+
}
|
|
2093
2117
|
visitBinaryOperatorExpr(ast, context) {
|
|
2094
2118
|
ast.lhs.visitExpression(this, context);
|
|
2095
2119
|
ast.rhs.visitExpression(this, context);
|
|
@@ -2124,6 +2148,10 @@ class RecursiveAstVisitor$1 {
|
|
|
2124
2148
|
visitTemplateLiteralElementExpr(ast, context) {
|
|
2125
2149
|
return this.visitExpression(ast, context);
|
|
2126
2150
|
}
|
|
2151
|
+
visitParenthesizedExpr(ast, context) {
|
|
2152
|
+
ast.expr.visitExpression(this, context);
|
|
2153
|
+
return this.visitExpression(ast, context);
|
|
2154
|
+
}
|
|
2127
2155
|
visitAllExpressions(exprs, context) {
|
|
2128
2156
|
exprs.forEach((expr) => expr.visitExpression(this, context));
|
|
2129
2157
|
}
|
|
@@ -2160,7 +2188,7 @@ class RecursiveAstVisitor$1 {
|
|
|
2160
2188
|
visitAllStatements(stmts, context) {
|
|
2161
2189
|
stmts.forEach((stmt) => stmt.visitStatement(this, context));
|
|
2162
2190
|
}
|
|
2163
|
-
}
|
|
2191
|
+
};
|
|
2164
2192
|
function leadingComment(text, multiline = false, trailingNewline = true) {
|
|
2165
2193
|
return new LeadingComment(text, multiline, trailingNewline);
|
|
2166
2194
|
}
|
|
@@ -2255,90 +2283,91 @@ function serializeTags(tags) {
|
|
|
2255
2283
|
|
|
2256
2284
|
var output_ast = /*#__PURE__*/Object.freeze({
|
|
2257
2285
|
__proto__: null,
|
|
2258
|
-
get TypeModifier () { return TypeModifier; },
|
|
2259
|
-
Type: Type,
|
|
2260
|
-
get BuiltinTypeName () { return BuiltinTypeName; },
|
|
2261
|
-
BuiltinType: BuiltinType,
|
|
2262
|
-
ExpressionType: ExpressionType,
|
|
2263
2286
|
ArrayType: ArrayType,
|
|
2264
|
-
|
|
2265
|
-
TransplantedType: TransplantedType,
|
|
2266
|
-
DYNAMIC_TYPE: DYNAMIC_TYPE,
|
|
2267
|
-
INFERRED_TYPE: INFERRED_TYPE,
|
|
2287
|
+
ArrowFunctionExpr: ArrowFunctionExpr,
|
|
2268
2288
|
BOOL_TYPE: BOOL_TYPE,
|
|
2269
|
-
INT_TYPE: INT_TYPE,
|
|
2270
|
-
NUMBER_TYPE: NUMBER_TYPE,
|
|
2271
|
-
STRING_TYPE: STRING_TYPE,
|
|
2272
|
-
FUNCTION_TYPE: FUNCTION_TYPE,
|
|
2273
|
-
NONE_TYPE: NONE_TYPE,
|
|
2274
|
-
get UnaryOperator () { return UnaryOperator; },
|
|
2275
2289
|
get BinaryOperator () { return BinaryOperator; },
|
|
2276
|
-
|
|
2277
|
-
|
|
2290
|
+
BinaryOperatorExpr: BinaryOperatorExpr,
|
|
2291
|
+
BuiltinType: BuiltinType,
|
|
2292
|
+
get BuiltinTypeName () { return BuiltinTypeName; },
|
|
2293
|
+
CommaExpr: CommaExpr,
|
|
2294
|
+
ConditionalExpr: ConditionalExpr,
|
|
2295
|
+
DYNAMIC_TYPE: DYNAMIC_TYPE,
|
|
2296
|
+
DeclareFunctionStmt: DeclareFunctionStmt,
|
|
2297
|
+
DeclareVarStmt: DeclareVarStmt,
|
|
2298
|
+
DynamicImportExpr: DynamicImportExpr,
|
|
2278
2299
|
Expression: Expression,
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
VoidExpr: VoidExpr,
|
|
2282
|
-
WrappedNodeExpr: WrappedNodeExpr,
|
|
2283
|
-
WriteVarExpr: WriteVarExpr,
|
|
2284
|
-
WriteKeyExpr: WriteKeyExpr,
|
|
2285
|
-
WritePropExpr: WritePropExpr,
|
|
2286
|
-
InvokeFunctionExpr: InvokeFunctionExpr,
|
|
2287
|
-
TaggedTemplateLiteralExpr: TaggedTemplateLiteralExpr,
|
|
2288
|
-
InstantiateExpr: InstantiateExpr,
|
|
2289
|
-
LiteralExpr: LiteralExpr,
|
|
2290
|
-
TemplateLiteralExpr: TemplateLiteralExpr,
|
|
2291
|
-
TemplateLiteralElementExpr: TemplateLiteralElementExpr,
|
|
2292
|
-
LiteralPiece: LiteralPiece,
|
|
2293
|
-
PlaceholderPiece: PlaceholderPiece,
|
|
2294
|
-
LocalizedString: LocalizedString,
|
|
2300
|
+
ExpressionStatement: ExpressionStatement,
|
|
2301
|
+
ExpressionType: ExpressionType,
|
|
2295
2302
|
ExternalExpr: ExternalExpr,
|
|
2296
2303
|
ExternalReference: ExternalReference,
|
|
2297
|
-
|
|
2298
|
-
DynamicImportExpr: DynamicImportExpr,
|
|
2299
|
-
NotExpr: NotExpr,
|
|
2304
|
+
FUNCTION_TYPE: FUNCTION_TYPE,
|
|
2300
2305
|
FnParam: FnParam,
|
|
2301
2306
|
FunctionExpr: FunctionExpr,
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
+
INFERRED_TYPE: INFERRED_TYPE,
|
|
2308
|
+
INT_TYPE: INT_TYPE,
|
|
2309
|
+
IfStmt: IfStmt,
|
|
2310
|
+
InstantiateExpr: InstantiateExpr,
|
|
2311
|
+
InvokeFunctionExpr: InvokeFunctionExpr,
|
|
2312
|
+
JSDocComment: JSDocComment,
|
|
2313
|
+
LeadingComment: LeadingComment,
|
|
2307
2314
|
LiteralArrayExpr: LiteralArrayExpr,
|
|
2315
|
+
LiteralExpr: LiteralExpr,
|
|
2308
2316
|
LiteralMapEntry: LiteralMapEntry,
|
|
2309
2317
|
LiteralMapExpr: LiteralMapExpr,
|
|
2310
|
-
|
|
2318
|
+
LiteralPiece: LiteralPiece,
|
|
2319
|
+
LocalizedString: LocalizedString,
|
|
2320
|
+
MapType: MapType,
|
|
2321
|
+
NONE_TYPE: NONE_TYPE,
|
|
2311
2322
|
NULL_EXPR: NULL_EXPR,
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
ExpressionStatement: ExpressionStatement,
|
|
2320
|
-
ReturnStatement: ReturnStatement,
|
|
2321
|
-
IfStmt: IfStmt,
|
|
2323
|
+
NUMBER_TYPE: NUMBER_TYPE,
|
|
2324
|
+
NotExpr: NotExpr,
|
|
2325
|
+
ParenthesizedExpr: ParenthesizedExpr,
|
|
2326
|
+
PlaceholderPiece: PlaceholderPiece,
|
|
2327
|
+
ReadKeyExpr: ReadKeyExpr,
|
|
2328
|
+
ReadPropExpr: ReadPropExpr,
|
|
2329
|
+
ReadVarExpr: ReadVarExpr,
|
|
2322
2330
|
RecursiveAstVisitor: RecursiveAstVisitor$1,
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2331
|
+
ReturnStatement: ReturnStatement,
|
|
2332
|
+
STRING_TYPE: STRING_TYPE,
|
|
2333
|
+
Statement: Statement,
|
|
2334
|
+
get StmtModifier () { return StmtModifier; },
|
|
2335
|
+
TYPED_NULL_EXPR: TYPED_NULL_EXPR,
|
|
2336
|
+
TaggedTemplateLiteralExpr: TaggedTemplateLiteralExpr,
|
|
2337
|
+
TemplateLiteralElementExpr: TemplateLiteralElementExpr,
|
|
2338
|
+
TemplateLiteralExpr: TemplateLiteralExpr,
|
|
2339
|
+
TransplantedType: TransplantedType,
|
|
2340
|
+
Type: Type,
|
|
2341
|
+
get TypeModifier () { return TypeModifier; },
|
|
2342
|
+
TypeofExpr: TypeofExpr,
|
|
2343
|
+
get UnaryOperator () { return UnaryOperator; },
|
|
2344
|
+
UnaryOperatorExpr: UnaryOperatorExpr,
|
|
2345
|
+
VoidExpr: VoidExpr,
|
|
2346
|
+
WrappedNodeExpr: WrappedNodeExpr,
|
|
2347
|
+
WriteKeyExpr: WriteKeyExpr,
|
|
2348
|
+
WritePropExpr: WritePropExpr,
|
|
2349
|
+
WriteVarExpr: WriteVarExpr,
|
|
2350
|
+
areAllEquivalent: areAllEquivalent,
|
|
2351
|
+
arrowFn: arrowFn,
|
|
2352
|
+
expressionType: expressionType,
|
|
2353
|
+
fn: fn,
|
|
2354
|
+
ifStmt: ifStmt,
|
|
2326
2355
|
importExpr: importExpr,
|
|
2327
2356
|
importType: importType,
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2357
|
+
isNull: isNull,
|
|
2358
|
+
jsDocComment: jsDocComment,
|
|
2359
|
+
leadingComment: leadingComment,
|
|
2360
|
+
literal: literal,
|
|
2331
2361
|
literalArr: literalArr,
|
|
2332
2362
|
literalMap: literalMap,
|
|
2333
|
-
|
|
2363
|
+
localizedString: localizedString,
|
|
2334
2364
|
not: not,
|
|
2335
|
-
|
|
2336
|
-
arrowFn: arrowFn,
|
|
2337
|
-
ifStmt: ifStmt,
|
|
2365
|
+
nullSafeIsEquivalent: nullSafeIsEquivalent,
|
|
2338
2366
|
taggedTemplate: taggedTemplate,
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2367
|
+
transplantedType: transplantedType,
|
|
2368
|
+
typeofExpr: typeofExpr,
|
|
2369
|
+
unary: unary,
|
|
2370
|
+
variable: variable
|
|
2342
2371
|
});
|
|
2343
2372
|
|
|
2344
2373
|
const CONSTANT_PREFIX = '_c';
|
|
@@ -3142,13 +3171,6 @@ function _splitAt(input, character, defaultValues) {
|
|
|
3142
3171
|
function noUndefined(val) {
|
|
3143
3172
|
return val === undefined ? null : val;
|
|
3144
3173
|
}
|
|
3145
|
-
function error(msg) {
|
|
3146
|
-
throw new Error(`Internal Error: ${msg}`);
|
|
3147
|
-
}
|
|
3148
|
-
// Escape characters that have a special meaning in Regular Expressions
|
|
3149
|
-
function escapeRegExp(s) {
|
|
3150
|
-
return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
|
|
3151
|
-
}
|
|
3152
3174
|
function utf8Encode(str) {
|
|
3153
3175
|
let encoded = [];
|
|
3154
3176
|
for (let index = 0; index < str.length; index++) {
|
|
@@ -3219,29 +3241,6 @@ class Version {
|
|
|
3219
3241
|
}
|
|
3220
3242
|
}
|
|
3221
3243
|
const _global = globalThis;
|
|
3222
|
-
function newArray(size, value) {
|
|
3223
|
-
const list = [];
|
|
3224
|
-
for (let i = 0; i < size; i++) {
|
|
3225
|
-
list.push(value);
|
|
3226
|
-
}
|
|
3227
|
-
return list;
|
|
3228
|
-
}
|
|
3229
|
-
/**
|
|
3230
|
-
* Partitions a given array into 2 arrays, based on a boolean value returned by the condition
|
|
3231
|
-
* function.
|
|
3232
|
-
*
|
|
3233
|
-
* @param arr Input array that should be partitioned
|
|
3234
|
-
* @param conditionFn Condition function that is called for each item in a given array and returns a
|
|
3235
|
-
* boolean value.
|
|
3236
|
-
*/
|
|
3237
|
-
function partitionArray(arr, conditionFn) {
|
|
3238
|
-
const truthy = [];
|
|
3239
|
-
const falsy = [];
|
|
3240
|
-
for (const item of arr) {
|
|
3241
|
-
(conditionFn(item) ? truthy : falsy).push(item);
|
|
3242
|
-
}
|
|
3243
|
-
return [truthy, falsy];
|
|
3244
|
-
}
|
|
3245
3244
|
const V1_TO_18 = /^([1-9]|1[0-8])\./;
|
|
3246
3245
|
function getJitStandaloneDefaultForVersion(version) {
|
|
3247
3246
|
if (version.startsWith('0.')) {
|
|
@@ -3548,6 +3547,7 @@ class EmitterVisitorContext {
|
|
|
3548
3547
|
}
|
|
3549
3548
|
class AbstractEmitterVisitor {
|
|
3550
3549
|
_escapeDollarInStrings;
|
|
3550
|
+
lastIfCondition = null;
|
|
3551
3551
|
constructor(_escapeDollarInStrings) {
|
|
3552
3552
|
this._escapeDollarInStrings = _escapeDollarInStrings;
|
|
3553
3553
|
}
|
|
@@ -3587,7 +3587,9 @@ class AbstractEmitterVisitor {
|
|
|
3587
3587
|
visitIfStmt(stmt, ctx) {
|
|
3588
3588
|
this.printLeadingComments(stmt, ctx);
|
|
3589
3589
|
ctx.print(stmt, `if (`);
|
|
3590
|
+
this.lastIfCondition = stmt.condition; // We can skip redundant parentheses for the condition.
|
|
3590
3591
|
stmt.condition.visitExpression(this, ctx);
|
|
3592
|
+
this.lastIfCondition = null;
|
|
3591
3593
|
ctx.print(stmt, `) {`);
|
|
3592
3594
|
const hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
|
|
3593
3595
|
if (stmt.trueCase.length <= 1 && !hasElseCase) {
|
|
@@ -3760,11 +3762,12 @@ class AbstractEmitterVisitor {
|
|
|
3760
3762
|
default:
|
|
3761
3763
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3762
3764
|
}
|
|
3763
|
-
|
|
3765
|
+
const parens = ast !== this.lastIfCondition;
|
|
3766
|
+
if (parens)
|
|
3764
3767
|
ctx.print(ast, `(`);
|
|
3765
3768
|
ctx.print(ast, opStr);
|
|
3766
3769
|
ast.expr.visitExpression(this, ctx);
|
|
3767
|
-
if (
|
|
3770
|
+
if (parens)
|
|
3768
3771
|
ctx.print(ast, `)`);
|
|
3769
3772
|
return null;
|
|
3770
3773
|
}
|
|
@@ -3831,12 +3834,13 @@ class AbstractEmitterVisitor {
|
|
|
3831
3834
|
default:
|
|
3832
3835
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3833
3836
|
}
|
|
3834
|
-
|
|
3837
|
+
const parens = ast !== this.lastIfCondition;
|
|
3838
|
+
if (parens)
|
|
3835
3839
|
ctx.print(ast, `(`);
|
|
3836
3840
|
ast.lhs.visitExpression(this, ctx);
|
|
3837
3841
|
ctx.print(ast, ` ${opStr} `);
|
|
3838
3842
|
ast.rhs.visitExpression(this, ctx);
|
|
3839
|
-
if (
|
|
3843
|
+
if (parens)
|
|
3840
3844
|
ctx.print(ast, `)`);
|
|
3841
3845
|
return null;
|
|
3842
3846
|
}
|
|
@@ -3874,6 +3878,12 @@ class AbstractEmitterVisitor {
|
|
|
3874
3878
|
ctx.print(ast, ')');
|
|
3875
3879
|
return null;
|
|
3876
3880
|
}
|
|
3881
|
+
visitParenthesizedExpr(ast, ctx) {
|
|
3882
|
+
// We parenthesize everything regardless of an explicit ParenthesizedExpr, so we can just visit
|
|
3883
|
+
// the inner expression.
|
|
3884
|
+
// TODO: Do we *need* to parenthesize everything?
|
|
3885
|
+
ast.expr.visitExpression(this, ctx);
|
|
3886
|
+
}
|
|
3877
3887
|
visitAllExpressions(expressions, ctx, separator) {
|
|
3878
3888
|
this.visitAllObjects((expr) => expr.visitExpression(this, ctx), expressions, ctx, separator);
|
|
3879
3889
|
}
|
|
@@ -3945,20 +3955,10 @@ function typeWithParameters(type, numParams) {
|
|
|
3945
3955
|
}
|
|
3946
3956
|
return expressionType(type, undefined, params);
|
|
3947
3957
|
}
|
|
3948
|
-
const ANIMATE_SYMBOL_PREFIX = '@';
|
|
3949
|
-
function prepareSyntheticPropertyName(name) {
|
|
3950
|
-
return `${ANIMATE_SYMBOL_PREFIX}${name}`;
|
|
3951
|
-
}
|
|
3952
|
-
function prepareSyntheticListenerName(name, phase) {
|
|
3953
|
-
return `${ANIMATE_SYMBOL_PREFIX}${name}.${phase}`;
|
|
3954
|
-
}
|
|
3955
3958
|
function getSafePropertyAccessString(accessor, name) {
|
|
3956
3959
|
const escapedName = escapeIdentifier(name, false, false);
|
|
3957
3960
|
return escapedName !== name ? `${accessor}[${escapedName}]` : `${accessor}.${name}`;
|
|
3958
3961
|
}
|
|
3959
|
-
function prepareSyntheticListenerFunctionName(name, phase) {
|
|
3960
|
-
return `animation_${name}_${phase}`;
|
|
3961
|
-
}
|
|
3962
3962
|
function jitOnlyGuardedExpression(expr) {
|
|
3963
3963
|
return guardedExpression('ngJitMode', expr);
|
|
3964
3964
|
}
|
|
@@ -3970,7 +3970,7 @@ function guardedExpression(guard, expr) {
|
|
|
3970
3970
|
const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal('undefined'));
|
|
3971
3971
|
const guardUndefinedOrTrue = new BinaryOperatorExpr(BinaryOperator.Or, guardNotDefined, guardExpr,
|
|
3972
3972
|
/* type */ undefined,
|
|
3973
|
-
/* sourceSpan */ undefined
|
|
3973
|
+
/* sourceSpan */ undefined);
|
|
3974
3974
|
return new BinaryOperatorExpr(BinaryOperator.And, guardUndefinedOrTrue, expr);
|
|
3975
3975
|
}
|
|
3976
3976
|
function wrapReference(value) {
|
|
@@ -4256,11 +4256,11 @@ class ASTWithName extends AST {
|
|
|
4256
4256
|
this.nameSpan = nameSpan;
|
|
4257
4257
|
}
|
|
4258
4258
|
}
|
|
4259
|
-
|
|
4259
|
+
let EmptyExpr$1 = class EmptyExpr extends AST {
|
|
4260
4260
|
visit(visitor, context = null) {
|
|
4261
4261
|
// do nothing
|
|
4262
4262
|
}
|
|
4263
|
-
}
|
|
4263
|
+
};
|
|
4264
4264
|
class ImplicitReceiver extends AST {
|
|
4265
4265
|
visit(visitor, context = null) {
|
|
4266
4266
|
return visitor.visitImplicitReceiver(this, context);
|
|
@@ -4428,7 +4428,7 @@ class LiteralMap extends AST {
|
|
|
4428
4428
|
return visitor.visitLiteralMap(this, context);
|
|
4429
4429
|
}
|
|
4430
4430
|
}
|
|
4431
|
-
|
|
4431
|
+
let Interpolation$1 = class Interpolation extends AST {
|
|
4432
4432
|
strings;
|
|
4433
4433
|
expressions;
|
|
4434
4434
|
constructor(span, sourceSpan, strings, expressions) {
|
|
@@ -4439,7 +4439,7 @@ class Interpolation$1 extends AST {
|
|
|
4439
4439
|
visit(visitor, context = null) {
|
|
4440
4440
|
return visitor.visitInterpolation(this, context);
|
|
4441
4441
|
}
|
|
4442
|
-
}
|
|
4442
|
+
};
|
|
4443
4443
|
class Binary extends AST {
|
|
4444
4444
|
operation;
|
|
4445
4445
|
left;
|
|
@@ -4563,6 +4563,18 @@ class SafeCall extends AST {
|
|
|
4563
4563
|
return visitor.visitSafeCall(this, context);
|
|
4564
4564
|
}
|
|
4565
4565
|
}
|
|
4566
|
+
class TaggedTemplateLiteral extends AST {
|
|
4567
|
+
tag;
|
|
4568
|
+
template;
|
|
4569
|
+
constructor(span, sourceSpan, tag, template) {
|
|
4570
|
+
super(span, sourceSpan);
|
|
4571
|
+
this.tag = tag;
|
|
4572
|
+
this.template = template;
|
|
4573
|
+
}
|
|
4574
|
+
visit(visitor, context) {
|
|
4575
|
+
return visitor.visitTaggedTemplateLiteral(this, context);
|
|
4576
|
+
}
|
|
4577
|
+
}
|
|
4566
4578
|
class TemplateLiteral extends AST {
|
|
4567
4579
|
elements;
|
|
4568
4580
|
expressions;
|
|
@@ -4585,6 +4597,16 @@ class TemplateLiteralElement extends AST {
|
|
|
4585
4597
|
return visitor.visitTemplateLiteralElement(this, context);
|
|
4586
4598
|
}
|
|
4587
4599
|
}
|
|
4600
|
+
class ParenthesizedExpression extends AST {
|
|
4601
|
+
expression;
|
|
4602
|
+
constructor(span, sourceSpan, expression) {
|
|
4603
|
+
super(span, sourceSpan);
|
|
4604
|
+
this.expression = expression;
|
|
4605
|
+
}
|
|
4606
|
+
visit(visitor, context) {
|
|
4607
|
+
return visitor.visitParenthesizedExpression(this, context);
|
|
4608
|
+
}
|
|
4609
|
+
}
|
|
4588
4610
|
/**
|
|
4589
4611
|
* Records the absolute position of a text span in a source file, where `start` and `end` are the
|
|
4590
4612
|
* starting and ending byte offsets, respectively, of the text span in a source file.
|
|
@@ -4747,6 +4769,13 @@ class RecursiveAstVisitor {
|
|
|
4747
4769
|
}
|
|
4748
4770
|
}
|
|
4749
4771
|
visitTemplateLiteralElement(ast, context) { }
|
|
4772
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
4773
|
+
this.visit(ast.tag, context);
|
|
4774
|
+
this.visit(ast.template, context);
|
|
4775
|
+
}
|
|
4776
|
+
visitParenthesizedExpression(ast, context) {
|
|
4777
|
+
this.visit(ast.expression, context);
|
|
4778
|
+
}
|
|
4750
4779
|
// This is not part of the AstVisitor interface, just a helper method
|
|
4751
4780
|
visitAll(asts, context) {
|
|
4752
4781
|
for (const ast of asts) {
|
|
@@ -4908,7 +4937,7 @@ function mergeNsAndName(prefix, localName) {
|
|
|
4908
4937
|
* the top-level of the R3 AST, and only if `Render3ParseOptions['collectCommentNodes']`
|
|
4909
4938
|
* is true.
|
|
4910
4939
|
*/
|
|
4911
|
-
|
|
4940
|
+
let Comment$1 = class Comment {
|
|
4912
4941
|
value;
|
|
4913
4942
|
sourceSpan;
|
|
4914
4943
|
constructor(value, sourceSpan) {
|
|
@@ -4918,8 +4947,8 @@ class Comment$1 {
|
|
|
4918
4947
|
visit(_visitor) {
|
|
4919
4948
|
throw new Error('visit() not implemented for Comment');
|
|
4920
4949
|
}
|
|
4921
|
-
}
|
|
4922
|
-
|
|
4950
|
+
};
|
|
4951
|
+
let Text$3 = class Text {
|
|
4923
4952
|
value;
|
|
4924
4953
|
sourceSpan;
|
|
4925
4954
|
constructor(value, sourceSpan) {
|
|
@@ -4929,7 +4958,7 @@ class Text$3 {
|
|
|
4929
4958
|
visit(visitor) {
|
|
4930
4959
|
return visitor.visitText(this);
|
|
4931
4960
|
}
|
|
4932
|
-
}
|
|
4961
|
+
};
|
|
4933
4962
|
class BoundText {
|
|
4934
4963
|
value;
|
|
4935
4964
|
sourceSpan;
|
|
@@ -5030,7 +5059,7 @@ class BoundEvent {
|
|
|
5030
5059
|
return visitor.visitBoundEvent(this);
|
|
5031
5060
|
}
|
|
5032
5061
|
}
|
|
5033
|
-
|
|
5062
|
+
let Element$1 = class Element {
|
|
5034
5063
|
name;
|
|
5035
5064
|
attributes;
|
|
5036
5065
|
inputs;
|
|
@@ -5056,7 +5085,7 @@ class Element$1 {
|
|
|
5056
5085
|
visit(visitor) {
|
|
5057
5086
|
return visitor.visitElement(this);
|
|
5058
5087
|
}
|
|
5059
|
-
}
|
|
5088
|
+
};
|
|
5060
5089
|
class DeferredTrigger {
|
|
5061
5090
|
nameSpan;
|
|
5062
5091
|
sourceSpan;
|
|
@@ -5327,7 +5356,7 @@ class UnknownBlock {
|
|
|
5327
5356
|
return visitor.visitUnknownBlock(this);
|
|
5328
5357
|
}
|
|
5329
5358
|
}
|
|
5330
|
-
|
|
5359
|
+
let LetDeclaration$1 = class LetDeclaration {
|
|
5331
5360
|
name;
|
|
5332
5361
|
value;
|
|
5333
5362
|
sourceSpan;
|
|
@@ -5343,7 +5372,7 @@ class LetDeclaration$1 {
|
|
|
5343
5372
|
visit(visitor) {
|
|
5344
5373
|
return visitor.visitLetDeclaration(this);
|
|
5345
5374
|
}
|
|
5346
|
-
}
|
|
5375
|
+
};
|
|
5347
5376
|
class Template {
|
|
5348
5377
|
tagName;
|
|
5349
5378
|
attributes;
|
|
@@ -5432,7 +5461,7 @@ class Reference {
|
|
|
5432
5461
|
return visitor.visitReference(this);
|
|
5433
5462
|
}
|
|
5434
5463
|
}
|
|
5435
|
-
|
|
5464
|
+
let Icu$1 = class Icu {
|
|
5436
5465
|
vars;
|
|
5437
5466
|
placeholders;
|
|
5438
5467
|
sourceSpan;
|
|
@@ -5446,8 +5475,8 @@ class Icu$1 {
|
|
|
5446
5475
|
visit(visitor) {
|
|
5447
5476
|
return visitor.visitIcu(this);
|
|
5448
5477
|
}
|
|
5449
|
-
}
|
|
5450
|
-
|
|
5478
|
+
};
|
|
5479
|
+
let RecursiveVisitor$1 = class RecursiveVisitor {
|
|
5451
5480
|
visitElement(element) {
|
|
5452
5481
|
visitAll$1(this, element.attributes);
|
|
5453
5482
|
visitAll$1(this, element.inputs);
|
|
@@ -5511,7 +5540,7 @@ class RecursiveVisitor$1 {
|
|
|
5511
5540
|
visitDeferredTrigger(trigger) { }
|
|
5512
5541
|
visitUnknownBlock(block) { }
|
|
5513
5542
|
visitLetDeclaration(decl) { }
|
|
5514
|
-
}
|
|
5543
|
+
};
|
|
5515
5544
|
function visitAll$1(visitor, nodes) {
|
|
5516
5545
|
const result = [];
|
|
5517
5546
|
if (visitor.visit) {
|
|
@@ -5575,7 +5604,7 @@ class Message {
|
|
|
5575
5604
|
}
|
|
5576
5605
|
}
|
|
5577
5606
|
}
|
|
5578
|
-
|
|
5607
|
+
let Text$2 = class Text {
|
|
5579
5608
|
value;
|
|
5580
5609
|
sourceSpan;
|
|
5581
5610
|
constructor(value, sourceSpan) {
|
|
@@ -5585,7 +5614,7 @@ class Text$2 {
|
|
|
5585
5614
|
visit(visitor, context) {
|
|
5586
5615
|
return visitor.visitText(this, context);
|
|
5587
5616
|
}
|
|
5588
|
-
}
|
|
5617
|
+
};
|
|
5589
5618
|
// TODO(vicb): do we really need this node (vs an array) ?
|
|
5590
5619
|
class Container {
|
|
5591
5620
|
children;
|
|
@@ -5848,7 +5877,7 @@ class SimplePlaceholderMapper extends RecurseVisitor {
|
|
|
5848
5877
|
}
|
|
5849
5878
|
}
|
|
5850
5879
|
|
|
5851
|
-
|
|
5880
|
+
let _Visitor$2 = class _Visitor {
|
|
5852
5881
|
visitTag(tag) {
|
|
5853
5882
|
const strAttrs = this._serializeAttributes(tag.attrs);
|
|
5854
5883
|
if (tag.children.length == 0) {
|
|
@@ -5872,7 +5901,7 @@ class _Visitor$2 {
|
|
|
5872
5901
|
visitDoctype(doctype) {
|
|
5873
5902
|
return `<!DOCTYPE ${doctype.rootTag} [\n${doctype.dtd}\n]>`;
|
|
5874
5903
|
}
|
|
5875
|
-
}
|
|
5904
|
+
};
|
|
5876
5905
|
const _visitor = new _Visitor$2();
|
|
5877
5906
|
function serialize$1(nodes) {
|
|
5878
5907
|
return nodes.map((node) => node.visit(_visitor)).join('');
|
|
@@ -5914,7 +5943,7 @@ class Tag {
|
|
|
5914
5943
|
return visitor.visitTag(this);
|
|
5915
5944
|
}
|
|
5916
5945
|
}
|
|
5917
|
-
|
|
5946
|
+
let Text$1 = class Text {
|
|
5918
5947
|
value;
|
|
5919
5948
|
constructor(unescapedValue) {
|
|
5920
5949
|
this.value = escapeXml(unescapedValue);
|
|
@@ -5922,7 +5951,7 @@ class Text$1 {
|
|
|
5922
5951
|
visit(visitor) {
|
|
5923
5952
|
return visitor.visitText(this);
|
|
5924
5953
|
}
|
|
5925
|
-
}
|
|
5954
|
+
};
|
|
5926
5955
|
class CR extends Text$1 {
|
|
5927
5956
|
constructor(ws = 0) {
|
|
5928
5957
|
super(`\n${new Array(ws + 1).join(' ')}`);
|
|
@@ -6014,7 +6043,7 @@ class Xmb extends Serializer {
|
|
|
6014
6043
|
return new SimplePlaceholderMapper(message, toPublicName);
|
|
6015
6044
|
}
|
|
6016
6045
|
}
|
|
6017
|
-
|
|
6046
|
+
let _Visitor$1 = class _Visitor {
|
|
6018
6047
|
visitText(text, context) {
|
|
6019
6048
|
return [new Text$1(text.value)];
|
|
6020
6049
|
}
|
|
@@ -6088,7 +6117,7 @@ class _Visitor$1 {
|
|
|
6088
6117
|
serialize(nodes) {
|
|
6089
6118
|
return [].concat(...nodes.map((node) => node.visit(this)));
|
|
6090
6119
|
}
|
|
6091
|
-
}
|
|
6120
|
+
};
|
|
6092
6121
|
function digest(message) {
|
|
6093
6122
|
return decimalDigest(message);
|
|
6094
6123
|
}
|
|
@@ -6132,13 +6161,6 @@ function hasI18nAttrs(element) {
|
|
|
6132
6161
|
function icuFromI18nMessage(message) {
|
|
6133
6162
|
return message.nodes[0];
|
|
6134
6163
|
}
|
|
6135
|
-
function placeholdersToParams(placeholders) {
|
|
6136
|
-
const params = {};
|
|
6137
|
-
placeholders.forEach((values, key) => {
|
|
6138
|
-
params[key] = literal(values.length > 1 ? `[${values.join('|')}]` : values[0]);
|
|
6139
|
-
});
|
|
6140
|
-
return params;
|
|
6141
|
-
}
|
|
6142
6164
|
/**
|
|
6143
6165
|
* Format the placeholder names in a map of placeholders to expressions.
|
|
6144
6166
|
*
|
|
@@ -6216,9 +6238,6 @@ function temporaryAllocator(pushStatement, name) {
|
|
|
6216
6238
|
return temp;
|
|
6217
6239
|
};
|
|
6218
6240
|
}
|
|
6219
|
-
function invalid(arg) {
|
|
6220
|
-
throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
|
|
6221
|
-
}
|
|
6222
6241
|
function asLiteral(value) {
|
|
6223
6242
|
if (Array.isArray(value)) {
|
|
6224
6243
|
return literalArr(value.map(asLiteral));
|
|
@@ -6586,8 +6605,6 @@ const $LBRACE = 123;
|
|
|
6586
6605
|
const $BAR = 124;
|
|
6587
6606
|
const $RBRACE = 125;
|
|
6588
6607
|
const $NBSP = 160;
|
|
6589
|
-
const $PIPE = 124;
|
|
6590
|
-
const $TILDA = 126;
|
|
6591
6608
|
const $AT = 64;
|
|
6592
6609
|
const $BT = 96;
|
|
6593
6610
|
function isWhitespace(code) {
|
|
@@ -7300,9 +7317,7 @@ function compileNgModule(meta) {
|
|
|
7300
7317
|
statements.push(setNgModuleScopeCall);
|
|
7301
7318
|
}
|
|
7302
7319
|
}
|
|
7303
|
-
else
|
|
7304
|
-
// Selector scope emit was not requested, so skip it.
|
|
7305
|
-
}
|
|
7320
|
+
else ;
|
|
7306
7321
|
if (meta.schemas !== null && meta.schemas.length > 0) {
|
|
7307
7322
|
definitionMap.set('schemas', literalArr(meta.schemas.map((ref) => ref.value)));
|
|
7308
7323
|
}
|
|
@@ -10495,19 +10510,18 @@ function transformExpressionsInExpression(expr, transform, flags) {
|
|
|
10495
10510
|
expr.body = transformExpressionsInExpression(expr.body, transform, flags);
|
|
10496
10511
|
}
|
|
10497
10512
|
}
|
|
10498
|
-
else if (expr instanceof WrappedNodeExpr)
|
|
10499
|
-
// TODO: Do we need to transform any TS nodes nested inside of this expression?
|
|
10500
|
-
}
|
|
10513
|
+
else if (expr instanceof WrappedNodeExpr) ;
|
|
10501
10514
|
else if (expr instanceof TemplateLiteralExpr) {
|
|
10502
10515
|
for (let i = 0; i < expr.expressions.length; i++) {
|
|
10503
10516
|
expr.expressions[i] = transformExpressionsInExpression(expr.expressions[i], transform, flags);
|
|
10504
10517
|
}
|
|
10505
10518
|
}
|
|
10519
|
+
else if (expr instanceof ParenthesizedExpr) {
|
|
10520
|
+
expr.expr = transformExpressionsInExpression(expr.expr, transform, flags);
|
|
10521
|
+
}
|
|
10506
10522
|
else if (expr instanceof ReadVarExpr ||
|
|
10507
10523
|
expr instanceof ExternalExpr ||
|
|
10508
|
-
expr instanceof LiteralExpr)
|
|
10509
|
-
// No action for these types.
|
|
10510
|
-
}
|
|
10524
|
+
expr instanceof LiteralExpr) ;
|
|
10511
10525
|
else {
|
|
10512
10526
|
throw new Error(`Unhandled expression kind: ${expr.constructor.name}`);
|
|
10513
10527
|
}
|
|
@@ -11577,6 +11591,33 @@ function assignI18nSlotDependencies(job) {
|
|
|
11577
11591
|
}
|
|
11578
11592
|
}
|
|
11579
11593
|
|
|
11594
|
+
/**
|
|
11595
|
+
* Locates all of the elements defined in a creation block and outputs an op
|
|
11596
|
+
* that will expose their definition location in the DOM.
|
|
11597
|
+
*/
|
|
11598
|
+
function attachSourceLocations(job) {
|
|
11599
|
+
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
11600
|
+
return;
|
|
11601
|
+
}
|
|
11602
|
+
for (const unit of job.units) {
|
|
11603
|
+
const locations = [];
|
|
11604
|
+
for (const op of unit.create) {
|
|
11605
|
+
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
11606
|
+
const start = op.startSourceSpan.start;
|
|
11607
|
+
locations.push({
|
|
11608
|
+
targetSlot: op.handle,
|
|
11609
|
+
offset: start.offset,
|
|
11610
|
+
line: start.line,
|
|
11611
|
+
column: start.col,
|
|
11612
|
+
});
|
|
11613
|
+
}
|
|
11614
|
+
}
|
|
11615
|
+
if (locations.length > 0) {
|
|
11616
|
+
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
}
|
|
11620
|
+
|
|
11580
11621
|
/**
|
|
11581
11622
|
* Gets a map of all elements in the given view by their xref id.
|
|
11582
11623
|
*/
|
|
@@ -12267,29 +12308,6 @@ function convertI18nBindings(job) {
|
|
|
12267
12308
|
}
|
|
12268
12309
|
}
|
|
12269
12310
|
|
|
12270
|
-
/**
|
|
12271
|
-
* Resolve the dependency function of a deferred block.
|
|
12272
|
-
*/
|
|
12273
|
-
function resolveDeferDepsFns(job) {
|
|
12274
|
-
for (const unit of job.units) {
|
|
12275
|
-
for (const op of unit.create) {
|
|
12276
|
-
if (op.kind === OpKind.Defer) {
|
|
12277
|
-
if (op.resolverFn !== null) {
|
|
12278
|
-
continue;
|
|
12279
|
-
}
|
|
12280
|
-
if (op.ownResolverFn !== null) {
|
|
12281
|
-
if (op.handle.slot === null) {
|
|
12282
|
-
throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');
|
|
12283
|
-
}
|
|
12284
|
-
const fullPathName = unit.fnName?.replace('_Template', '');
|
|
12285
|
-
op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
12286
|
-
/* Don't use unique names for TDB compatibility */ false);
|
|
12287
|
-
}
|
|
12288
|
-
}
|
|
12289
|
-
}
|
|
12290
|
-
}
|
|
12291
|
-
}
|
|
12292
|
-
|
|
12293
12311
|
/**
|
|
12294
12312
|
* Create one helper context op per i18n block (including generate descending blocks).
|
|
12295
12313
|
*
|
|
@@ -12406,11 +12424,6 @@ function deduplicateTextBindings(job) {
|
|
|
12406
12424
|
OpList.remove(op);
|
|
12407
12425
|
}
|
|
12408
12426
|
}
|
|
12409
|
-
else {
|
|
12410
|
-
// TODO: Determine the correct behavior. It would probably make sense to merge multiple
|
|
12411
|
-
// style and class attributes. Alternatively we could just throw an error, as HTML
|
|
12412
|
-
// doesn't permit duplicate attributes.
|
|
12413
|
-
}
|
|
12414
12427
|
}
|
|
12415
12428
|
seenForElement.add(op.name);
|
|
12416
12429
|
seen.set(op.target, seenForElement);
|
|
@@ -12541,9 +12554,9 @@ function resolveDeferTargetNames(job) {
|
|
|
12541
12554
|
}
|
|
12542
12555
|
}
|
|
12543
12556
|
}
|
|
12544
|
-
|
|
12557
|
+
let Scope$1 = class Scope {
|
|
12545
12558
|
targets = new Map();
|
|
12546
|
-
}
|
|
12559
|
+
};
|
|
12547
12560
|
|
|
12548
12561
|
const REPLACEMENTS = new Map([
|
|
12549
12562
|
[OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
|
|
@@ -12599,14 +12612,6 @@ function expandSafeReads(job) {
|
|
|
12599
12612
|
}
|
|
12600
12613
|
}
|
|
12601
12614
|
}
|
|
12602
|
-
// A lookup set of all the expression kinds that require a temporary variable to be generated.
|
|
12603
|
-
const requiresTemporary = [
|
|
12604
|
-
InvokeFunctionExpr,
|
|
12605
|
-
LiteralArrayExpr,
|
|
12606
|
-
LiteralMapExpr,
|
|
12607
|
-
SafeInvokeFunctionExpr,
|
|
12608
|
-
PipeBindingExpr,
|
|
12609
|
-
].map((e) => e.constructor.name);
|
|
12610
12615
|
function needsTemporaryInSafeAccess(e) {
|
|
12611
12616
|
// TODO: We probably want to use an expression visitor to recursively visit all descendents.
|
|
12612
12617
|
// However, that would potentially do a lot of extra work (because it cannot short circuit), so we
|
|
@@ -12634,6 +12639,9 @@ function needsTemporaryInSafeAccess(e) {
|
|
|
12634
12639
|
else if (e instanceof ReadKeyExpr) {
|
|
12635
12640
|
return needsTemporaryInSafeAccess(e.receiver) || needsTemporaryInSafeAccess(e.index);
|
|
12636
12641
|
}
|
|
12642
|
+
else if (e instanceof ParenthesizedExpr) {
|
|
12643
|
+
return needsTemporaryInSafeAccess(e.expr);
|
|
12644
|
+
}
|
|
12637
12645
|
// TODO: Switch to a method which is exhaustive of newly added expression subtypes.
|
|
12638
12646
|
return (e instanceof InvokeFunctionExpr ||
|
|
12639
12647
|
e instanceof LiteralArrayExpr ||
|
|
@@ -12764,7 +12772,7 @@ function ternaryTransform(e) {
|
|
|
12764
12772
|
if (!(e instanceof SafeTernaryExpr)) {
|
|
12765
12773
|
return e;
|
|
12766
12774
|
}
|
|
12767
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr);
|
|
12775
|
+
return new ParenthesizedExpr(new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.Equals, e.guard, NULL_EXPR), NULL_EXPR, e.expr));
|
|
12768
12776
|
}
|
|
12769
12777
|
|
|
12770
12778
|
/**
|
|
@@ -12878,7 +12886,7 @@ function createI18nMessage(job, context, messagePlaceholder) {
|
|
|
12878
12886
|
let formattedParams = formatParams(context.params);
|
|
12879
12887
|
const formattedPostprocessingParams = formatParams(context.postprocessingParams);
|
|
12880
12888
|
let needsPostprocessing = [...context.params.values()].some((v) => v.length > 1);
|
|
12881
|
-
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message,
|
|
12889
|
+
return createI18nMessageOp(job.allocateXrefId(), context.xref, context.i18nBlock, context.message, null, formattedParams, formattedPostprocessingParams, needsPostprocessing);
|
|
12882
12890
|
}
|
|
12883
12891
|
/**
|
|
12884
12892
|
* Formats an ICU placeholder into a single string with expression placeholders.
|
|
@@ -13037,6 +13045,27 @@ function generateAdvance(job) {
|
|
|
13037
13045
|
}
|
|
13038
13046
|
}
|
|
13039
13047
|
|
|
13048
|
+
/**
|
|
13049
|
+
* Replaces the `storeLet` ops with variables that can be
|
|
13050
|
+
* used to reference the value within the same view.
|
|
13051
|
+
*/
|
|
13052
|
+
function generateLocalLetReferences(job) {
|
|
13053
|
+
for (const unit of job.units) {
|
|
13054
|
+
for (const op of unit.update) {
|
|
13055
|
+
if (op.kind !== OpKind.StoreLet) {
|
|
13056
|
+
continue;
|
|
13057
|
+
}
|
|
13058
|
+
const variable = {
|
|
13059
|
+
kind: SemanticVariableKind.Identifier,
|
|
13060
|
+
name: null,
|
|
13061
|
+
identifier: op.declaredName,
|
|
13062
|
+
local: true,
|
|
13063
|
+
};
|
|
13064
|
+
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
13065
|
+
}
|
|
13066
|
+
}
|
|
13067
|
+
}
|
|
13068
|
+
|
|
13040
13069
|
/**
|
|
13041
13070
|
* Locate projection slots, populate the each component's `ngContentSelectors` literal field,
|
|
13042
13071
|
* populate `project` arguments, and generate the required `projectionDef` instruction for the job's
|
|
@@ -13329,9 +13358,6 @@ function parseProperty(name) {
|
|
|
13329
13358
|
return { property, suffix };
|
|
13330
13359
|
}
|
|
13331
13360
|
|
|
13332
|
-
function mapEntry(key, value) {
|
|
13333
|
-
return { key, value, quoted: false };
|
|
13334
|
-
}
|
|
13335
13361
|
function mapLiteral(obj, quoted = false) {
|
|
13336
13362
|
return literalMap(Object.keys(obj).map((key) => ({
|
|
13337
13363
|
key,
|
|
@@ -16951,7 +16977,7 @@ class ParseTreeResult {
|
|
|
16951
16977
|
this.errors = errors;
|
|
16952
16978
|
}
|
|
16953
16979
|
}
|
|
16954
|
-
|
|
16980
|
+
let Parser$1 = class Parser {
|
|
16955
16981
|
getTagDefinition;
|
|
16956
16982
|
constructor(getTagDefinition) {
|
|
16957
16983
|
this.getTagDefinition = getTagDefinition;
|
|
@@ -16962,7 +16988,7 @@ class Parser$1 {
|
|
|
16962
16988
|
parser.build();
|
|
16963
16989
|
return new ParseTreeResult(parser.rootNodes, tokenizeResult.errors.concat(parser.errors));
|
|
16964
16990
|
}
|
|
16965
|
-
}
|
|
16991
|
+
};
|
|
16966
16992
|
class _TreeBuilder {
|
|
16967
16993
|
tokens;
|
|
16968
16994
|
getTagDefinition;
|
|
@@ -17643,9 +17669,6 @@ function transformTextToken({ type, parts, sourceSpan }, transform) {
|
|
|
17643
17669
|
function processWhitespace(text) {
|
|
17644
17670
|
return replaceNgsp(text).replace(WS_REPLACE_REGEXP, ' ');
|
|
17645
17671
|
}
|
|
17646
|
-
function removeWhitespaces(htmlAstWithErrors, preserveSignificantWhitespace) {
|
|
17647
|
-
return new ParseTreeResult(visitAllWithSiblings(new WhitespaceVisitor(preserveSignificantWhitespace), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
|
|
17648
|
-
}
|
|
17649
17672
|
function visitAllWithSiblings(visitor, nodes) {
|
|
17650
17673
|
const result = [];
|
|
17651
17674
|
nodes.forEach((ast, i) => {
|
|
@@ -17998,9 +18021,7 @@ class _Scanner {
|
|
|
17998
18021
|
let hasSeparators = false;
|
|
17999
18022
|
this.advance(); // Skip initial digit.
|
|
18000
18023
|
while (true) {
|
|
18001
|
-
if (isDigit(this.peek))
|
|
18002
|
-
// Do nothing.
|
|
18003
|
-
}
|
|
18024
|
+
if (isDigit(this.peek)) ;
|
|
18004
18025
|
else if (this.peek === $_) {
|
|
18005
18026
|
// Separators are only valid when they're surrounded by digits. E.g. `1_0_1` is
|
|
18006
18027
|
// valid while `_101` and `101_` are not. The separator can't be next to the decimal
|
|
@@ -18474,7 +18495,6 @@ class _ParseAST {
|
|
|
18474
18495
|
parseFlags;
|
|
18475
18496
|
errors;
|
|
18476
18497
|
offset;
|
|
18477
|
-
lastUnary = null;
|
|
18478
18498
|
rparensExpected = 0;
|
|
18479
18499
|
rbracketsExpected = 0;
|
|
18480
18500
|
rbracesExpected = 0;
|
|
@@ -18865,11 +18885,14 @@ class _ParseAST {
|
|
|
18865
18885
|
// This aligns with Javascript semantics which require any unary operator preceeding the
|
|
18866
18886
|
// exponentiation operation to be explicitly grouped as either applying to the base or result
|
|
18867
18887
|
// of the exponentiation operation.
|
|
18868
|
-
if (result
|
|
18888
|
+
if (result instanceof Unary ||
|
|
18889
|
+
result instanceof PrefixNot ||
|
|
18890
|
+
result instanceof TypeofExpression ||
|
|
18891
|
+
result instanceof VoidExpression) {
|
|
18869
18892
|
this.error('Unary operator used immediately before exponentiation expression. Parenthesis must be used to disambiguate operator precedence');
|
|
18870
18893
|
}
|
|
18871
18894
|
this.advance();
|
|
18872
|
-
const right = this.
|
|
18895
|
+
const right = this.parseExponentiation();
|
|
18873
18896
|
result = new Binary(this.span(start), this.sourceSpan(start), '**', result, right);
|
|
18874
18897
|
}
|
|
18875
18898
|
return result;
|
|
@@ -18883,28 +18906,28 @@ class _ParseAST {
|
|
|
18883
18906
|
case '+':
|
|
18884
18907
|
this.advance();
|
|
18885
18908
|
result = this.parsePrefix();
|
|
18886
|
-
return
|
|
18909
|
+
return Unary.createPlus(this.span(start), this.sourceSpan(start), result);
|
|
18887
18910
|
case '-':
|
|
18888
18911
|
this.advance();
|
|
18889
18912
|
result = this.parsePrefix();
|
|
18890
|
-
return
|
|
18913
|
+
return Unary.createMinus(this.span(start), this.sourceSpan(start), result);
|
|
18891
18914
|
case '!':
|
|
18892
18915
|
this.advance();
|
|
18893
18916
|
result = this.parsePrefix();
|
|
18894
|
-
return
|
|
18917
|
+
return new PrefixNot(this.span(start), this.sourceSpan(start), result);
|
|
18895
18918
|
}
|
|
18896
18919
|
}
|
|
18897
18920
|
else if (this.next.isKeywordTypeof()) {
|
|
18898
18921
|
this.advance();
|
|
18899
18922
|
const start = this.inputIndex;
|
|
18900
18923
|
let result = this.parsePrefix();
|
|
18901
|
-
return
|
|
18924
|
+
return new TypeofExpression(this.span(start), this.sourceSpan(start), result);
|
|
18902
18925
|
}
|
|
18903
18926
|
else if (this.next.isKeywordVoid()) {
|
|
18904
18927
|
this.advance();
|
|
18905
18928
|
const start = this.inputIndex;
|
|
18906
18929
|
let result = this.parsePrefix();
|
|
18907
|
-
return
|
|
18930
|
+
return new VoidExpression(this.span(start), this.sourceSpan(start), result);
|
|
18908
18931
|
}
|
|
18909
18932
|
return this.parseCallChain();
|
|
18910
18933
|
}
|
|
@@ -18934,6 +18957,12 @@ class _ParseAST {
|
|
|
18934
18957
|
else if (this.consumeOptionalOperator('!')) {
|
|
18935
18958
|
result = new NonNullAssert(this.span(start), this.sourceSpan(start), result);
|
|
18936
18959
|
}
|
|
18960
|
+
else if (this.next.isTemplateLiteralEnd()) {
|
|
18961
|
+
result = this.parseNoInterpolationTaggedTemplateLiteral(result, start);
|
|
18962
|
+
}
|
|
18963
|
+
else if (this.next.isTemplateLiteralPart()) {
|
|
18964
|
+
result = this.parseTaggedTemplateLiteral(result, start);
|
|
18965
|
+
}
|
|
18937
18966
|
else {
|
|
18938
18967
|
return result;
|
|
18939
18968
|
}
|
|
@@ -18945,9 +18974,8 @@ class _ParseAST {
|
|
|
18945
18974
|
this.rparensExpected++;
|
|
18946
18975
|
const result = this.parsePipe();
|
|
18947
18976
|
this.rparensExpected--;
|
|
18948
|
-
this.lastUnary = null;
|
|
18949
18977
|
this.expectCharacter($RPAREN);
|
|
18950
|
-
return result;
|
|
18978
|
+
return new ParenthesizedExpression(this.span(start), this.sourceSpan(start), result);
|
|
18951
18979
|
}
|
|
18952
18980
|
else if (this.next.isKeywordNull()) {
|
|
18953
18981
|
this.advance();
|
|
@@ -18988,7 +19016,7 @@ class _ParseAST {
|
|
|
18988
19016
|
return new LiteralPrimitive(this.span(start), this.sourceSpan(start), value);
|
|
18989
19017
|
}
|
|
18990
19018
|
else if (this.next.isTemplateLiteralEnd()) {
|
|
18991
|
-
return this.parseNoInterpolationTemplateLiteral(
|
|
19019
|
+
return this.parseNoInterpolationTemplateLiteral();
|
|
18992
19020
|
}
|
|
18993
19021
|
else if (this.next.isTemplateLiteralPart()) {
|
|
18994
19022
|
return this.parseTemplateLiteral();
|
|
@@ -19318,22 +19346,32 @@ class _ParseAST {
|
|
|
19318
19346
|
const sourceSpan = new AbsoluteSourceSpan(spanStart, this.currentAbsoluteOffset);
|
|
19319
19347
|
return new VariableBinding(sourceSpan, key, value);
|
|
19320
19348
|
}
|
|
19321
|
-
|
|
19349
|
+
parseNoInterpolationTaggedTemplateLiteral(tag, start) {
|
|
19350
|
+
const template = this.parseNoInterpolationTemplateLiteral();
|
|
19351
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template);
|
|
19352
|
+
}
|
|
19353
|
+
parseNoInterpolationTemplateLiteral() {
|
|
19322
19354
|
const text = this.next.strValue;
|
|
19355
|
+
const start = this.inputIndex;
|
|
19323
19356
|
this.advance();
|
|
19324
19357
|
const span = this.span(start);
|
|
19325
19358
|
const sourceSpan = this.sourceSpan(start);
|
|
19326
19359
|
return new TemplateLiteral(span, sourceSpan, [new TemplateLiteralElement(span, sourceSpan, text)], []);
|
|
19327
19360
|
}
|
|
19361
|
+
parseTaggedTemplateLiteral(tag, start) {
|
|
19362
|
+
const template = this.parseTemplateLiteral();
|
|
19363
|
+
return new TaggedTemplateLiteral(this.span(start), this.sourceSpan(start), tag, template);
|
|
19364
|
+
}
|
|
19328
19365
|
parseTemplateLiteral() {
|
|
19329
|
-
const start = this.inputIndex;
|
|
19330
19366
|
const elements = [];
|
|
19331
19367
|
const expressions = [];
|
|
19368
|
+
const start = this.inputIndex;
|
|
19332
19369
|
while (this.next !== EOF) {
|
|
19333
19370
|
const token = this.next;
|
|
19334
19371
|
if (token.isTemplateLiteralPart() || token.isTemplateLiteralEnd()) {
|
|
19335
|
-
|
|
19372
|
+
const partStart = this.inputIndex;
|
|
19336
19373
|
this.advance();
|
|
19374
|
+
elements.push(new TemplateLiteralElement(this.span(partStart), this.sourceSpan(partStart), token.strValue));
|
|
19337
19375
|
if (token.isTemplateLiteralEnd()) {
|
|
19338
19376
|
break;
|
|
19339
19377
|
}
|
|
@@ -19589,6 +19627,12 @@ class SerializeExpressionVisitor {
|
|
|
19589
19627
|
visitTemplateLiteralElement(ast, context) {
|
|
19590
19628
|
return ast.text;
|
|
19591
19629
|
}
|
|
19630
|
+
visitTaggedTemplateLiteral(ast, context) {
|
|
19631
|
+
return ast.tag.visit(this, context) + ast.template.visit(this, context);
|
|
19632
|
+
}
|
|
19633
|
+
visitParenthesizedExpression(ast, context) {
|
|
19634
|
+
return '(' + ast.expression.visit(this, context) + ')';
|
|
19635
|
+
}
|
|
19592
19636
|
}
|
|
19593
19637
|
/** Zips the two input arrays into a single array of pairs of elements at the same index. */
|
|
19594
19638
|
function zip(left, right) {
|
|
@@ -22138,30 +22182,6 @@ function disableBindings$1(job) {
|
|
|
22138
22182
|
}
|
|
22139
22183
|
}
|
|
22140
22184
|
|
|
22141
|
-
/**
|
|
22142
|
-
* Nullish coalescing expressions such as `a ?? b` have different semantics in Angular templates as
|
|
22143
|
-
* compared to JavaScript. In particular, they default to `null` instead of `undefined`. Therefore,
|
|
22144
|
-
* we replace them with ternary expressions, assigning temporaries as needed to avoid re-evaluating
|
|
22145
|
-
* the same sub-expression multiple times.
|
|
22146
|
-
*/
|
|
22147
|
-
function generateNullishCoalesceExpressions(job) {
|
|
22148
|
-
for (const unit of job.units) {
|
|
22149
|
-
for (const op of unit.ops()) {
|
|
22150
|
-
transformExpressionsInOp(op, (expr) => {
|
|
22151
|
-
if (!(expr instanceof BinaryOperatorExpr) ||
|
|
22152
|
-
expr.operator !== BinaryOperator.NullishCoalesce) {
|
|
22153
|
-
return expr;
|
|
22154
|
-
}
|
|
22155
|
-
const assignment = new AssignTemporaryExpr(expr.lhs.clone(), job.allocateXrefId());
|
|
22156
|
-
const read = new ReadTemporaryExpr(assignment.xref);
|
|
22157
|
-
// TODO: When not in compatibility mode for TemplateDefinitionBuilder, we can just emit
|
|
22158
|
-
// `t != null` instead of including an undefined check as well.
|
|
22159
|
-
return new ConditionalExpr(new BinaryOperatorExpr(BinaryOperator.And, new BinaryOperatorExpr(BinaryOperator.NotIdentical, assignment, NULL_EXPR), new BinaryOperatorExpr(BinaryOperator.NotIdentical, read, new LiteralExpr(undefined))), read.clone(), expr.rhs);
|
|
22160
|
-
}, VisitorContextFlag.None);
|
|
22161
|
-
}
|
|
22162
|
-
}
|
|
22163
|
-
}
|
|
22164
|
-
|
|
22165
22185
|
function kindTest(kind) {
|
|
22166
22186
|
return (op) => op.kind === kind;
|
|
22167
22187
|
}
|
|
@@ -23164,7 +23184,17 @@ const PURE_FUNCTION_CONFIG = {
|
|
|
23164
23184
|
mapping: (n) => n,
|
|
23165
23185
|
};
|
|
23166
23186
|
function callVariadicInstructionExpr(config, baseArgs, interpolationArgs, extraArgs, sourceSpan) {
|
|
23187
|
+
// mapping need to be done before potentially dropping the last interpolation argument
|
|
23167
23188
|
const n = config.mapping(interpolationArgs.length);
|
|
23189
|
+
// In the case the interpolation instruction ends with a empty string we drop it
|
|
23190
|
+
// And the runtime will take care of it.
|
|
23191
|
+
const lastInterpolationArg = interpolationArgs.at(-1);
|
|
23192
|
+
if (extraArgs.length === 0 &&
|
|
23193
|
+
interpolationArgs.length > 1 &&
|
|
23194
|
+
lastInterpolationArg instanceof LiteralExpr &&
|
|
23195
|
+
lastInterpolationArg.value === '') {
|
|
23196
|
+
interpolationArgs.pop();
|
|
23197
|
+
}
|
|
23168
23198
|
if (n < config.constant.length) {
|
|
23169
23199
|
// Constant calling pattern.
|
|
23170
23200
|
return importExpr(config.constant[n])
|
|
@@ -23205,31 +23235,6 @@ function reify(job) {
|
|
|
23205
23235
|
reifyUpdateOperations(unit, unit.update);
|
|
23206
23236
|
}
|
|
23207
23237
|
}
|
|
23208
|
-
/**
|
|
23209
|
-
* This function can be used a sanity check -- it walks every expression in the const pool, and
|
|
23210
|
-
* every expression reachable from an op, and makes sure that there are no IR expressions
|
|
23211
|
-
* left. This is nice to use for debugging mysterious failures where an IR expression cannot be
|
|
23212
|
-
* output from the output AST code.
|
|
23213
|
-
*/
|
|
23214
|
-
function ensureNoIrForDebug(job) {
|
|
23215
|
-
for (const stmt of job.pool.statements) {
|
|
23216
|
-
transformExpressionsInStatement(stmt, (expr) => {
|
|
23217
|
-
if (isIrExpression(expr)) {
|
|
23218
|
-
throw new Error(`AssertionError: IR expression found during reify: ${ExpressionKind[expr.kind]}`);
|
|
23219
|
-
}
|
|
23220
|
-
return expr;
|
|
23221
|
-
}, VisitorContextFlag.None);
|
|
23222
|
-
}
|
|
23223
|
-
for (const unit of job.units) {
|
|
23224
|
-
for (const op of unit.ops()) {
|
|
23225
|
-
visitExpressionsInOp(op, (expr) => {
|
|
23226
|
-
if (isIrExpression(expr)) {
|
|
23227
|
-
throw new Error(`AssertionError: IR expression found during reify: ${ExpressionKind[expr.kind]}`);
|
|
23228
|
-
}
|
|
23229
|
-
});
|
|
23230
|
-
}
|
|
23231
|
-
}
|
|
23232
|
-
}
|
|
23233
23238
|
function reifyCreateOperations(unit, ops) {
|
|
23234
23239
|
for (const op of ops) {
|
|
23235
23240
|
transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
|
|
@@ -23705,6 +23710,33 @@ function removeI18nContexts(job) {
|
|
|
23705
23710
|
}
|
|
23706
23711
|
}
|
|
23707
23712
|
|
|
23713
|
+
/**
|
|
23714
|
+
* It's not allowed to access a `@let` declaration before it has been defined. This is enforced
|
|
23715
|
+
* already via template type checking, however it can trip some of the assertions in the pipeline.
|
|
23716
|
+
* E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
|
|
23717
|
+
* exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
|
|
23718
|
+
* confusing errors to users in the case where template type checking isn't running (e.g. in JIT
|
|
23719
|
+
* mode) this phase detects illegal forward references and replaces them with `undefined`.
|
|
23720
|
+
* Eventually users will see the proper error from the template type checker.
|
|
23721
|
+
*/
|
|
23722
|
+
function removeIllegalLetReferences(job) {
|
|
23723
|
+
for (const unit of job.units) {
|
|
23724
|
+
for (const op of unit.update) {
|
|
23725
|
+
if (op.kind !== OpKind.Variable ||
|
|
23726
|
+
op.variable.kind !== SemanticVariableKind.Identifier ||
|
|
23727
|
+
!(op.initializer instanceof StoreLetExpr)) {
|
|
23728
|
+
continue;
|
|
23729
|
+
}
|
|
23730
|
+
const name = op.variable.identifier;
|
|
23731
|
+
let current = op;
|
|
23732
|
+
while (current && current.kind !== OpKind.ListEnd) {
|
|
23733
|
+
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
|
|
23734
|
+
current = current.prev;
|
|
23735
|
+
}
|
|
23736
|
+
}
|
|
23737
|
+
}
|
|
23738
|
+
}
|
|
23739
|
+
|
|
23708
23740
|
/**
|
|
23709
23741
|
* i18nAttributes ops will be generated for each i18n attribute. However, not all i18n attribues
|
|
23710
23742
|
* will contain dynamic content, and so some of these i18nAttributes ops may be unnecessary.
|
|
@@ -23786,6 +23818,29 @@ function processLexicalScope$1(view, ops) {
|
|
|
23786
23818
|
}
|
|
23787
23819
|
}
|
|
23788
23820
|
|
|
23821
|
+
/**
|
|
23822
|
+
* Resolve the dependency function of a deferred block.
|
|
23823
|
+
*/
|
|
23824
|
+
function resolveDeferDepsFns(job) {
|
|
23825
|
+
for (const unit of job.units) {
|
|
23826
|
+
for (const op of unit.create) {
|
|
23827
|
+
if (op.kind === OpKind.Defer) {
|
|
23828
|
+
if (op.resolverFn !== null) {
|
|
23829
|
+
continue;
|
|
23830
|
+
}
|
|
23831
|
+
if (op.ownResolverFn !== null) {
|
|
23832
|
+
if (op.handle.slot === null) {
|
|
23833
|
+
throw new Error('AssertionError: slot must be assigned before extracting defer deps functions');
|
|
23834
|
+
}
|
|
23835
|
+
const fullPathName = unit.fnName?.replace('_Template', '');
|
|
23836
|
+
op.resolverFn = job.pool.getSharedFunctionReference(op.ownResolverFn, `${fullPathName}_Defer_${op.handle.slot}_DepsFn`,
|
|
23837
|
+
/* Don't use unique names for TDB compatibility */ false);
|
|
23838
|
+
}
|
|
23839
|
+
}
|
|
23840
|
+
}
|
|
23841
|
+
}
|
|
23842
|
+
}
|
|
23843
|
+
|
|
23789
23844
|
/**
|
|
23790
23845
|
* Any variable inside a listener with the name `$event` will be transformed into a output lexical
|
|
23791
23846
|
* read immediately, and does not participate in any of the normal logic for handling variables.
|
|
@@ -24362,39 +24417,6 @@ function getOnlySecurityContext(securityContext) {
|
|
|
24362
24417
|
return securityContext;
|
|
24363
24418
|
}
|
|
24364
24419
|
|
|
24365
|
-
/**
|
|
24366
|
-
* Transforms a `TwoWayBindingSet` expression into an expression that either
|
|
24367
|
-
* sets a value through the `twoWayBindingSet` instruction or falls back to setting
|
|
24368
|
-
* the value directly. E.g. the expression `TwoWayBindingSet(target, value)` becomes:
|
|
24369
|
-
* `ng.twoWayBindingSet(target, value) || (target = value)`.
|
|
24370
|
-
*/
|
|
24371
|
-
function transformTwoWayBindingSet(job) {
|
|
24372
|
-
for (const unit of job.units) {
|
|
24373
|
-
for (const op of unit.create) {
|
|
24374
|
-
if (op.kind === OpKind.TwoWayListener) {
|
|
24375
|
-
transformExpressionsInOp(op, (expr) => {
|
|
24376
|
-
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
24377
|
-
return expr;
|
|
24378
|
-
}
|
|
24379
|
-
const { target, value } = expr;
|
|
24380
|
-
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
24381
|
-
return twoWayBindingSet(target, value).or(target.set(value));
|
|
24382
|
-
}
|
|
24383
|
-
// ASSUMPTION: here we're assuming that `ReadVariableExpr` will be a reference
|
|
24384
|
-
// to a local template variable. This appears to be the case at the time of writing.
|
|
24385
|
-
// If the expression is targeting a variable read, we only emit the `twoWayBindingSet`
|
|
24386
|
-
// since the fallback would be attempting to write into a constant. Invalid usages will be
|
|
24387
|
-
// flagged during template type checking.
|
|
24388
|
-
if (target instanceof ReadVariableExpr) {
|
|
24389
|
-
return twoWayBindingSet(target, value);
|
|
24390
|
-
}
|
|
24391
|
-
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
24392
|
-
}, VisitorContextFlag.InChildOperation);
|
|
24393
|
-
}
|
|
24394
|
-
}
|
|
24395
|
-
}
|
|
24396
|
-
}
|
|
24397
|
-
|
|
24398
24420
|
/**
|
|
24399
24421
|
* When inside of a listener, we may need access to one or more enclosing views. Therefore, each
|
|
24400
24422
|
* view should save the current view, and each listener must have the ability to restore the
|
|
@@ -24504,6 +24526,107 @@ function allocateSlots(job) {
|
|
|
24504
24526
|
}
|
|
24505
24527
|
}
|
|
24506
24528
|
|
|
24529
|
+
/*!
|
|
24530
|
+
* @license
|
|
24531
|
+
* Copyright Google LLC All Rights Reserved.
|
|
24532
|
+
*
|
|
24533
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
24534
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
24535
|
+
*/
|
|
24536
|
+
/**
|
|
24537
|
+
* Removes any `storeLet` calls that aren't referenced outside of the current view.
|
|
24538
|
+
*/
|
|
24539
|
+
function optimizeStoreLet(job) {
|
|
24540
|
+
const letUsedExternally = new Set();
|
|
24541
|
+
// Since `@let` declarations can be referenced in child views, both in
|
|
24542
|
+
// the creation block (via listeners) and in the update block, we have
|
|
24543
|
+
// to look through all the ops to find the references.
|
|
24544
|
+
for (const unit of job.units) {
|
|
24545
|
+
for (const op of unit.ops()) {
|
|
24546
|
+
visitExpressionsInOp(op, (expr) => {
|
|
24547
|
+
if (expr instanceof ContextLetReferenceExpr) {
|
|
24548
|
+
letUsedExternally.add(expr.target);
|
|
24549
|
+
}
|
|
24550
|
+
});
|
|
24551
|
+
}
|
|
24552
|
+
}
|
|
24553
|
+
// TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
|
|
24554
|
+
for (const unit of job.units) {
|
|
24555
|
+
for (const op of unit.update) {
|
|
24556
|
+
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
|
|
24557
|
+
? expression.value
|
|
24558
|
+
: expression, VisitorContextFlag.None);
|
|
24559
|
+
}
|
|
24560
|
+
}
|
|
24561
|
+
}
|
|
24562
|
+
|
|
24563
|
+
/**
|
|
24564
|
+
* In most cases we can drop user added parentheses from expressions. However, in some cases
|
|
24565
|
+
* parentheses are needed for the expression to be considered valid JavaScript or for Typescript to
|
|
24566
|
+
* generate the correct output. This phases strips all parentheses except in the following
|
|
24567
|
+
* siturations where they are required:
|
|
24568
|
+
*
|
|
24569
|
+
* 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
|
|
24570
|
+
* valid JavaScript, but `(-2) ** 3` is.
|
|
24571
|
+
* 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need
|
|
24572
|
+
* parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
|
|
24573
|
+
* 3. Ternary expression used as an operand for nullish coalescing. Typescript generates incorrect
|
|
24574
|
+
* code if the parentheses are missing. For example when `(a ? b : c) ?? d` is translated to
|
|
24575
|
+
* typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
|
|
24576
|
+
* incorrectly prints `a ? b : c ?? d`. This is different from how it handles the same situation
|
|
24577
|
+
* with `||` and `&&` where it prints the parentheses even if they are not present in the AST.
|
|
24578
|
+
*/
|
|
24579
|
+
function stripNonrequiredParentheses(job) {
|
|
24580
|
+
// Check which parentheses are required.
|
|
24581
|
+
const requiredParens = new Set();
|
|
24582
|
+
for (const unit of job.units) {
|
|
24583
|
+
for (const op of unit.ops()) {
|
|
24584
|
+
visitExpressionsInOp(op, (expr) => {
|
|
24585
|
+
if (expr instanceof BinaryOperatorExpr) {
|
|
24586
|
+
switch (expr.operator) {
|
|
24587
|
+
case BinaryOperator.Exponentiation:
|
|
24588
|
+
checkExponentiationParens(expr, requiredParens);
|
|
24589
|
+
break;
|
|
24590
|
+
case BinaryOperator.NullishCoalesce:
|
|
24591
|
+
checkNullishCoalescingParens(expr, requiredParens);
|
|
24592
|
+
break;
|
|
24593
|
+
}
|
|
24594
|
+
}
|
|
24595
|
+
});
|
|
24596
|
+
}
|
|
24597
|
+
}
|
|
24598
|
+
// Remove any non-required parentheses.
|
|
24599
|
+
for (const unit of job.units) {
|
|
24600
|
+
for (const op of unit.ops()) {
|
|
24601
|
+
transformExpressionsInOp(op, (expr) => {
|
|
24602
|
+
if (expr instanceof ParenthesizedExpr) {
|
|
24603
|
+
return requiredParens.has(expr) ? expr : expr.expr;
|
|
24604
|
+
}
|
|
24605
|
+
return expr;
|
|
24606
|
+
}, VisitorContextFlag.None);
|
|
24607
|
+
}
|
|
24608
|
+
}
|
|
24609
|
+
}
|
|
24610
|
+
function checkExponentiationParens(expr, requiredParens) {
|
|
24611
|
+
if (expr.lhs instanceof ParenthesizedExpr && expr.lhs.expr instanceof UnaryOperatorExpr) {
|
|
24612
|
+
requiredParens.add(expr.lhs);
|
|
24613
|
+
}
|
|
24614
|
+
}
|
|
24615
|
+
function checkNullishCoalescingParens(expr, requiredParens) {
|
|
24616
|
+
if (expr.lhs instanceof ParenthesizedExpr &&
|
|
24617
|
+
(isLogicalAndOr(expr.lhs.expr) || expr.lhs.expr instanceof ConditionalExpr)) {
|
|
24618
|
+
requiredParens.add(expr.lhs);
|
|
24619
|
+
}
|
|
24620
|
+
if (expr.rhs instanceof ParenthesizedExpr &&
|
|
24621
|
+
(isLogicalAndOr(expr.rhs.expr) || expr.rhs.expr instanceof ConditionalExpr)) {
|
|
24622
|
+
requiredParens.add(expr.rhs);
|
|
24623
|
+
}
|
|
24624
|
+
}
|
|
24625
|
+
function isLogicalAndOr(expr) {
|
|
24626
|
+
return (expr instanceof BinaryOperatorExpr &&
|
|
24627
|
+
(expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
|
|
24628
|
+
}
|
|
24629
|
+
|
|
24507
24630
|
/**
|
|
24508
24631
|
* Transforms special-case bindings with 'style' or 'class' in their names. Must run before the
|
|
24509
24632
|
* main binding specialization pass.
|
|
@@ -24731,6 +24854,39 @@ function generateTrackVariables(job) {
|
|
|
24731
24854
|
}
|
|
24732
24855
|
}
|
|
24733
24856
|
|
|
24857
|
+
/**
|
|
24858
|
+
* Transforms a `TwoWayBindingSet` expression into an expression that either
|
|
24859
|
+
* sets a value through the `twoWayBindingSet` instruction or falls back to setting
|
|
24860
|
+
* the value directly. E.g. the expression `TwoWayBindingSet(target, value)` becomes:
|
|
24861
|
+
* `ng.twoWayBindingSet(target, value) || (target = value)`.
|
|
24862
|
+
*/
|
|
24863
|
+
function transformTwoWayBindingSet(job) {
|
|
24864
|
+
for (const unit of job.units) {
|
|
24865
|
+
for (const op of unit.create) {
|
|
24866
|
+
if (op.kind === OpKind.TwoWayListener) {
|
|
24867
|
+
transformExpressionsInOp(op, (expr) => {
|
|
24868
|
+
if (!(expr instanceof TwoWayBindingSetExpr)) {
|
|
24869
|
+
return expr;
|
|
24870
|
+
}
|
|
24871
|
+
const { target, value } = expr;
|
|
24872
|
+
if (target instanceof ReadPropExpr || target instanceof ReadKeyExpr) {
|
|
24873
|
+
return twoWayBindingSet(target, value).or(target.set(value));
|
|
24874
|
+
}
|
|
24875
|
+
// ASSUMPTION: here we're assuming that `ReadVariableExpr` will be a reference
|
|
24876
|
+
// to a local template variable. This appears to be the case at the time of writing.
|
|
24877
|
+
// If the expression is targeting a variable read, we only emit the `twoWayBindingSet`
|
|
24878
|
+
// since the fallback would be attempting to write into a constant. Invalid usages will be
|
|
24879
|
+
// flagged during template type checking.
|
|
24880
|
+
if (target instanceof ReadVariableExpr) {
|
|
24881
|
+
return twoWayBindingSet(target, value);
|
|
24882
|
+
}
|
|
24883
|
+
throw new Error(`Unsupported expression in two-way action binding.`);
|
|
24884
|
+
}, VisitorContextFlag.InChildOperation);
|
|
24885
|
+
}
|
|
24886
|
+
}
|
|
24887
|
+
}
|
|
24888
|
+
}
|
|
24889
|
+
|
|
24734
24890
|
/**
|
|
24735
24891
|
* Counts the number of variable slots used within each view, and stores that on the view itself, as
|
|
24736
24892
|
* well as propagates it to the `ir.TemplateOp` for embedded views.
|
|
@@ -25330,115 +25486,6 @@ function wrapI18nIcus(job) {
|
|
|
25330
25486
|
}
|
|
25331
25487
|
}
|
|
25332
25488
|
|
|
25333
|
-
/*!
|
|
25334
|
-
* @license
|
|
25335
|
-
* Copyright Google LLC All Rights Reserved.
|
|
25336
|
-
*
|
|
25337
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
25338
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
25339
|
-
*/
|
|
25340
|
-
/**
|
|
25341
|
-
* Removes any `storeLet` calls that aren't referenced outside of the current view.
|
|
25342
|
-
*/
|
|
25343
|
-
function optimizeStoreLet(job) {
|
|
25344
|
-
const letUsedExternally = new Set();
|
|
25345
|
-
// Since `@let` declarations can be referenced in child views, both in
|
|
25346
|
-
// the creation block (via listeners) and in the update block, we have
|
|
25347
|
-
// to look through all the ops to find the references.
|
|
25348
|
-
for (const unit of job.units) {
|
|
25349
|
-
for (const op of unit.ops()) {
|
|
25350
|
-
visitExpressionsInOp(op, (expr) => {
|
|
25351
|
-
if (expr instanceof ContextLetReferenceExpr) {
|
|
25352
|
-
letUsedExternally.add(expr.target);
|
|
25353
|
-
}
|
|
25354
|
-
});
|
|
25355
|
-
}
|
|
25356
|
-
}
|
|
25357
|
-
// TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
|
|
25358
|
-
for (const unit of job.units) {
|
|
25359
|
-
for (const op of unit.update) {
|
|
25360
|
-
transformExpressionsInOp(op, (expression) => expression instanceof StoreLetExpr && !letUsedExternally.has(expression.target)
|
|
25361
|
-
? expression.value
|
|
25362
|
-
: expression, VisitorContextFlag.None);
|
|
25363
|
-
}
|
|
25364
|
-
}
|
|
25365
|
-
}
|
|
25366
|
-
|
|
25367
|
-
/**
|
|
25368
|
-
* It's not allowed to access a `@let` declaration before it has been defined. This is enforced
|
|
25369
|
-
* already via template type checking, however it can trip some of the assertions in the pipeline.
|
|
25370
|
-
* E.g. the naming phase can fail because we resolved the variable here, but the variable doesn't
|
|
25371
|
-
* exist anymore because the optimization phase removed it since it's invalid. To avoid surfacing
|
|
25372
|
-
* confusing errors to users in the case where template type checking isn't running (e.g. in JIT
|
|
25373
|
-
* mode) this phase detects illegal forward references and replaces them with `undefined`.
|
|
25374
|
-
* Eventually users will see the proper error from the template type checker.
|
|
25375
|
-
*/
|
|
25376
|
-
function removeIllegalLetReferences(job) {
|
|
25377
|
-
for (const unit of job.units) {
|
|
25378
|
-
for (const op of unit.update) {
|
|
25379
|
-
if (op.kind !== OpKind.Variable ||
|
|
25380
|
-
op.variable.kind !== SemanticVariableKind.Identifier ||
|
|
25381
|
-
!(op.initializer instanceof StoreLetExpr)) {
|
|
25382
|
-
continue;
|
|
25383
|
-
}
|
|
25384
|
-
const name = op.variable.identifier;
|
|
25385
|
-
let current = op;
|
|
25386
|
-
while (current && current.kind !== OpKind.ListEnd) {
|
|
25387
|
-
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
|
|
25388
|
-
current = current.prev;
|
|
25389
|
-
}
|
|
25390
|
-
}
|
|
25391
|
-
}
|
|
25392
|
-
}
|
|
25393
|
-
|
|
25394
|
-
/**
|
|
25395
|
-
* Replaces the `storeLet` ops with variables that can be
|
|
25396
|
-
* used to reference the value within the same view.
|
|
25397
|
-
*/
|
|
25398
|
-
function generateLocalLetReferences(job) {
|
|
25399
|
-
for (const unit of job.units) {
|
|
25400
|
-
for (const op of unit.update) {
|
|
25401
|
-
if (op.kind !== OpKind.StoreLet) {
|
|
25402
|
-
continue;
|
|
25403
|
-
}
|
|
25404
|
-
const variable = {
|
|
25405
|
-
kind: SemanticVariableKind.Identifier,
|
|
25406
|
-
name: null,
|
|
25407
|
-
identifier: op.declaredName,
|
|
25408
|
-
local: true,
|
|
25409
|
-
};
|
|
25410
|
-
OpList.replace(op, createVariableOp(job.allocateXrefId(), variable, new StoreLetExpr(op.target, op.value, op.sourceSpan), VariableFlags.None));
|
|
25411
|
-
}
|
|
25412
|
-
}
|
|
25413
|
-
}
|
|
25414
|
-
|
|
25415
|
-
/**
|
|
25416
|
-
* Locates all of the elements defined in a creation block and outputs an op
|
|
25417
|
-
* that will expose their definition location in the DOM.
|
|
25418
|
-
*/
|
|
25419
|
-
function attachSourceLocations(job) {
|
|
25420
|
-
if (!job.enableDebugLocations || job.relativeTemplatePath === null) {
|
|
25421
|
-
return;
|
|
25422
|
-
}
|
|
25423
|
-
for (const unit of job.units) {
|
|
25424
|
-
const locations = [];
|
|
25425
|
-
for (const op of unit.create) {
|
|
25426
|
-
if (op.kind === OpKind.ElementStart || op.kind === OpKind.Element) {
|
|
25427
|
-
const start = op.startSourceSpan.start;
|
|
25428
|
-
locations.push({
|
|
25429
|
-
targetSlot: op.handle,
|
|
25430
|
-
offset: start.offset,
|
|
25431
|
-
line: start.line,
|
|
25432
|
-
column: start.col,
|
|
25433
|
-
});
|
|
25434
|
-
}
|
|
25435
|
-
}
|
|
25436
|
-
if (locations.length > 0) {
|
|
25437
|
-
unit.create.push(createSourceLocationOp(job.relativeTemplatePath, locations));
|
|
25438
|
-
}
|
|
25439
|
-
}
|
|
25440
|
-
}
|
|
25441
|
-
|
|
25442
25489
|
/**
|
|
25443
25490
|
*
|
|
25444
25491
|
* @license
|
|
@@ -25487,8 +25534,8 @@ const phases = [
|
|
|
25487
25534
|
{ kind: CompilationJobKind.Both, fn: resolveContexts },
|
|
25488
25535
|
{ kind: CompilationJobKind.Both, fn: resolveSanitizers },
|
|
25489
25536
|
{ kind: CompilationJobKind.Tmpl, fn: liftLocalRefs },
|
|
25490
|
-
{ kind: CompilationJobKind.Both, fn: generateNullishCoalesceExpressions },
|
|
25491
25537
|
{ kind: CompilationJobKind.Both, fn: expandSafeReads },
|
|
25538
|
+
{ kind: CompilationJobKind.Both, fn: stripNonrequiredParentheses },
|
|
25492
25539
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
25493
25540
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
25494
25541
|
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
@@ -26282,21 +26329,30 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
26282
26329
|
return new VoidExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26283
26330
|
}
|
|
26284
26331
|
else if (ast instanceof TemplateLiteral) {
|
|
26285
|
-
return
|
|
26286
|
-
|
|
26287
|
-
|
|
26332
|
+
return convertTemplateLiteral(ast, job, baseSourceSpan);
|
|
26333
|
+
}
|
|
26334
|
+
else if (ast instanceof TaggedTemplateLiteral) {
|
|
26335
|
+
return new TaggedTemplateLiteralExpr(convertAst(ast.tag, job, baseSourceSpan), convertTemplateLiteral(ast.template, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26336
|
+
}
|
|
26337
|
+
else if (ast instanceof ParenthesizedExpression) {
|
|
26338
|
+
return new ParenthesizedExpr(convertAst(ast.expression, job, baseSourceSpan), undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26288
26339
|
}
|
|
26289
26340
|
else {
|
|
26290
26341
|
throw new Error(`Unhandled expression type "${ast.constructor.name}" in file "${baseSourceSpan?.start.file.url}"`);
|
|
26291
26342
|
}
|
|
26292
26343
|
}
|
|
26344
|
+
function convertTemplateLiteral(ast, job, baseSourceSpan) {
|
|
26345
|
+
return new TemplateLiteralExpr(ast.elements.map((el) => {
|
|
26346
|
+
return new TemplateLiteralElementExpr(el.text, convertSourceSpan(el.span, baseSourceSpan));
|
|
26347
|
+
}), ast.expressions.map((expr) => convertAst(expr, job, baseSourceSpan)), convertSourceSpan(ast.span, baseSourceSpan));
|
|
26348
|
+
}
|
|
26293
26349
|
function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
26294
26350
|
let expression;
|
|
26295
26351
|
if (value instanceof Interpolation$1) {
|
|
26296
|
-
expression = new Interpolation(value.strings, value.expressions.map((e) => convertAst(e, job,
|
|
26352
|
+
expression = new Interpolation(value.strings, value.expressions.map((e) => convertAst(e, job, null)), Object.keys(asMessage(i18nMeta)?.placeholders ?? {}));
|
|
26297
26353
|
}
|
|
26298
26354
|
else if (value instanceof AST) {
|
|
26299
|
-
expression = convertAst(value, job,
|
|
26355
|
+
expression = convertAst(value, job, null);
|
|
26300
26356
|
}
|
|
26301
26357
|
else {
|
|
26302
26358
|
expression = literal(value);
|
|
@@ -26674,12 +26730,6 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
26674
26730
|
* internal tooling as well.
|
|
26675
26731
|
*/
|
|
26676
26732
|
let ENABLE_TEMPLATE_SOURCE_LOCATIONS = false;
|
|
26677
|
-
/**
|
|
26678
|
-
* Utility function to enable source locations. Intended to be used **only** inside unit tests.
|
|
26679
|
-
*/
|
|
26680
|
-
function setEnableTemplateSourceLocations(value) {
|
|
26681
|
-
ENABLE_TEMPLATE_SOURCE_LOCATIONS = value;
|
|
26682
|
-
}
|
|
26683
26733
|
/** Gets whether template source locations are enabled. */
|
|
26684
26734
|
function getTemplateSourceLocationsEnabled() {
|
|
26685
26735
|
return ENABLE_TEMPLATE_SOURCE_LOCATIONS;
|
|
@@ -26687,7 +26737,7 @@ function getTemplateSourceLocationsEnabled() {
|
|
|
26687
26737
|
|
|
26688
26738
|
// if (rf & flags) { .. }
|
|
26689
26739
|
function renderFlagCheckIfStmt(flags, statements) {
|
|
26690
|
-
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null
|
|
26740
|
+
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null), statements);
|
|
26691
26741
|
}
|
|
26692
26742
|
/**
|
|
26693
26743
|
* Translates query flags into `TQueryFlags` type in
|
|
@@ -27276,15 +27326,6 @@ class BindingParser {
|
|
|
27276
27326
|
return false;
|
|
27277
27327
|
}
|
|
27278
27328
|
}
|
|
27279
|
-
class PipeCollector extends RecursiveAstVisitor {
|
|
27280
|
-
pipes = new Map();
|
|
27281
|
-
visitPipe(ast, context) {
|
|
27282
|
-
this.pipes.set(ast.name, ast);
|
|
27283
|
-
ast.exp.visit(this);
|
|
27284
|
-
this.visitAll(ast.args, context);
|
|
27285
|
-
return null;
|
|
27286
|
-
}
|
|
27287
|
-
}
|
|
27288
27329
|
function isAnimationLabel(name) {
|
|
27289
27330
|
return name[0] == '@';
|
|
27290
27331
|
}
|
|
@@ -29621,23 +29662,35 @@ class R3TargetBinder {
|
|
|
29621
29662
|
*/
|
|
29622
29663
|
bind(target) {
|
|
29623
29664
|
if (!target.template) {
|
|
29624
|
-
|
|
29625
|
-
|
|
29626
|
-
|
|
29627
|
-
|
|
29628
|
-
|
|
29629
|
-
const
|
|
29630
|
-
|
|
29631
|
-
const
|
|
29632
|
-
|
|
29633
|
-
|
|
29634
|
-
|
|
29635
|
-
|
|
29636
|
-
|
|
29637
|
-
|
|
29638
|
-
|
|
29639
|
-
|
|
29640
|
-
|
|
29665
|
+
throw new Error('Empty bound targets are not supported');
|
|
29666
|
+
}
|
|
29667
|
+
const directives = new Map();
|
|
29668
|
+
const eagerDirectives = [];
|
|
29669
|
+
const bindings = new Map();
|
|
29670
|
+
const references = new Map();
|
|
29671
|
+
const scopedNodeEntities = new Map();
|
|
29672
|
+
const expressions = new Map();
|
|
29673
|
+
const symbols = new Map();
|
|
29674
|
+
const nestingLevel = new Map();
|
|
29675
|
+
const usedPipes = new Set();
|
|
29676
|
+
const eagerPipes = new Set();
|
|
29677
|
+
const deferBlocks = [];
|
|
29678
|
+
if (target.template) {
|
|
29679
|
+
// First, parse the template into a `Scope` structure. This operation captures the syntactic
|
|
29680
|
+
// scopes in the template and makes them available for later use.
|
|
29681
|
+
const scope = Scope.apply(target.template);
|
|
29682
|
+
// Use the `Scope` to extract the entities present at every level of the template.
|
|
29683
|
+
extractScopedNodeEntities(scope, scopedNodeEntities);
|
|
29684
|
+
// Next, perform directive matching on the template using the `DirectiveBinder`. This returns:
|
|
29685
|
+
// - directives: Map of nodes (elements & ng-templates) to the directives on them.
|
|
29686
|
+
// - bindings: Map of inputs, outputs, and attributes to the directive/element that claims
|
|
29687
|
+
// them. TODO(alxhub): handle multiple directives claiming an input/output/etc.
|
|
29688
|
+
// - references: Map of #references to their targets.
|
|
29689
|
+
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, bindings, references);
|
|
29690
|
+
// Finally, run the TemplateBinder to bind references, variables, and other entities within the
|
|
29691
|
+
// template. This extracts all the metadata that doesn't depend on directive matching.
|
|
29692
|
+
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
29693
|
+
}
|
|
29641
29694
|
return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
29642
29695
|
}
|
|
29643
29696
|
}
|
|
@@ -29864,14 +29917,9 @@ class DirectiveBinder {
|
|
|
29864
29917
|
* map which resolves #references (`Reference`s) within the template to the named directive or
|
|
29865
29918
|
* template node.
|
|
29866
29919
|
*/
|
|
29867
|
-
static apply(template, selectorMatcher) {
|
|
29868
|
-
const directives = new Map();
|
|
29869
|
-
const bindings = new Map();
|
|
29870
|
-
const references = new Map();
|
|
29871
|
-
const eagerDirectives = [];
|
|
29920
|
+
static apply(template, selectorMatcher, directives, eagerDirectives, bindings, references) {
|
|
29872
29921
|
const matcher = new DirectiveBinder(selectorMatcher, directives, eagerDirectives, bindings, references);
|
|
29873
29922
|
matcher.ingest(template);
|
|
29874
|
-
return { directives, eagerDirectives, bindings, references };
|
|
29875
29923
|
}
|
|
29876
29924
|
ingest(template) {
|
|
29877
29925
|
template.forEach((node) => node.visit(this));
|
|
@@ -30056,18 +30104,11 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30056
30104
|
* nesting level (how many levels deep within the template structure the `Template` is), starting
|
|
30057
30105
|
* at 1.
|
|
30058
30106
|
*/
|
|
30059
|
-
static applyWithScope(nodes, scope) {
|
|
30060
|
-
const expressions = new Map();
|
|
30061
|
-
const symbols = new Map();
|
|
30062
|
-
const nestingLevel = new Map();
|
|
30063
|
-
const usedPipes = new Set();
|
|
30064
|
-
const eagerPipes = new Set();
|
|
30107
|
+
static applyWithScope(nodes, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks) {
|
|
30065
30108
|
const template = nodes instanceof Template ? nodes : null;
|
|
30066
|
-
const deferBlocks = [];
|
|
30067
30109
|
// The top-level template has nesting level 0.
|
|
30068
30110
|
const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template, 0);
|
|
30069
30111
|
binder.ingest(nodes);
|
|
30070
|
-
return { expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks };
|
|
30071
30112
|
}
|
|
30072
30113
|
ingest(nodeOrNodes) {
|
|
30073
30114
|
if (nodeOrNodes instanceof Template) {
|
|
@@ -30417,7 +30458,7 @@ class R3BoundTarget {
|
|
|
30417
30458
|
return this.referenceTargetToElement(target.node);
|
|
30418
30459
|
}
|
|
30419
30460
|
}
|
|
30420
|
-
function extractScopedNodeEntities(rootScope) {
|
|
30461
|
+
function extractScopedNodeEntities(rootScope, templateEntities) {
|
|
30421
30462
|
const entityMap = new Map();
|
|
30422
30463
|
function extractScopeEntities(scope) {
|
|
30423
30464
|
if (entityMap.has(scope.rootNode)) {
|
|
@@ -30442,11 +30483,9 @@ function extractScopedNodeEntities(rootScope) {
|
|
|
30442
30483
|
}
|
|
30443
30484
|
extractScopeEntities(scope);
|
|
30444
30485
|
}
|
|
30445
|
-
const templateEntities = new Map();
|
|
30446
30486
|
for (const [template, entities] of entityMap) {
|
|
30447
30487
|
templateEntities.set(template, new Set(entities.values()));
|
|
30448
30488
|
}
|
|
30449
|
-
return templateEntities;
|
|
30450
30489
|
}
|
|
30451
30490
|
|
|
30452
30491
|
/**
|
|
@@ -30469,10 +30508,8 @@ class CompilerFacadeImpl {
|
|
|
30469
30508
|
}
|
|
30470
30509
|
compilePipe(angularCoreEnv, sourceMapUrl, facade) {
|
|
30471
30510
|
const metadata = {
|
|
30472
|
-
name: facade.name,
|
|
30473
30511
|
type: wrapReference(facade.type),
|
|
30474
30512
|
typeArgumentCount: 0,
|
|
30475
|
-
deps: null,
|
|
30476
30513
|
pipeName: facade.pipeName,
|
|
30477
30514
|
pure: facade.pure,
|
|
30478
30515
|
isStandalone: facade.isStandalone,
|
|
@@ -30517,7 +30554,6 @@ class CompilerFacadeImpl {
|
|
|
30517
30554
|
}
|
|
30518
30555
|
compileInjector(angularCoreEnv, sourceMapUrl, facade) {
|
|
30519
30556
|
const meta = {
|
|
30520
|
-
name: facade.name,
|
|
30521
30557
|
type: wrapReference(facade.type),
|
|
30522
30558
|
providers: facade.providers && facade.providers.length > 0
|
|
30523
30559
|
? new WrappedNodeExpr(facade.providers)
|
|
@@ -31716,7 +31752,7 @@ class Xliff extends Serializer {
|
|
|
31716
31752
|
return digest$1(message);
|
|
31717
31753
|
}
|
|
31718
31754
|
}
|
|
31719
|
-
|
|
31755
|
+
let _WriteVisitor$1 = class _WriteVisitor {
|
|
31720
31756
|
visitText(text, context) {
|
|
31721
31757
|
return [new Text$1(text.value)];
|
|
31722
31758
|
}
|
|
@@ -31775,7 +31811,7 @@ class _WriteVisitor$1 {
|
|
|
31775
31811
|
serialize(nodes) {
|
|
31776
31812
|
return [].concat(...nodes.map((node) => node.visit(this)));
|
|
31777
31813
|
}
|
|
31778
|
-
}
|
|
31814
|
+
};
|
|
31779
31815
|
// TODO(vicb): add error management (structure)
|
|
31780
31816
|
// Extract messages as xml nodes from the xliff file
|
|
31781
31817
|
class XliffParser {
|
|
@@ -31858,7 +31894,7 @@ class XliffParser {
|
|
|
31858
31894
|
}
|
|
31859
31895
|
}
|
|
31860
31896
|
// Convert ml nodes (xliff syntax) to i18n nodes
|
|
31861
|
-
|
|
31897
|
+
let XmlToI18n$2 = class XmlToI18n {
|
|
31862
31898
|
// using non-null assertion because it's re(set) by convert()
|
|
31863
31899
|
_errors;
|
|
31864
31900
|
convert(message, url) {
|
|
@@ -31911,7 +31947,7 @@ class XmlToI18n$2 {
|
|
|
31911
31947
|
_addError(node, message) {
|
|
31912
31948
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
31913
31949
|
}
|
|
31914
|
-
}
|
|
31950
|
+
};
|
|
31915
31951
|
function getCtypeForTag(tag) {
|
|
31916
31952
|
switch (tag.toLowerCase()) {
|
|
31917
31953
|
case 'br':
|
|
@@ -32173,7 +32209,7 @@ class Xliff2Parser {
|
|
|
32173
32209
|
}
|
|
32174
32210
|
}
|
|
32175
32211
|
// Convert ml nodes (xliff syntax) to i18n nodes
|
|
32176
|
-
|
|
32212
|
+
let XmlToI18n$1 = class XmlToI18n {
|
|
32177
32213
|
// using non-null assertion because re(set) by convert()
|
|
32178
32214
|
_errors;
|
|
32179
32215
|
convert(message, url) {
|
|
@@ -32243,7 +32279,7 @@ class XmlToI18n$1 {
|
|
|
32243
32279
|
_addError(node, message) {
|
|
32244
32280
|
this._errors.push(new I18nError(node.sourceSpan, message));
|
|
32245
32281
|
}
|
|
32246
|
-
}
|
|
32282
|
+
};
|
|
32247
32283
|
function getTypeForTag(tag) {
|
|
32248
32284
|
switch (tag.toLowerCase()) {
|
|
32249
32285
|
case 'br':
|
|
@@ -32845,7 +32881,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32845
32881
|
function compileDeclareClassMetadata(metadata) {
|
|
32846
32882
|
const definitionMap = new DefinitionMap();
|
|
32847
32883
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32848
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32884
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
32849
32885
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32850
32886
|
definitionMap.set('type', metadata.type);
|
|
32851
32887
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32863,7 +32899,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32863
32899
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32864
32900
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32865
32901
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32866
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32902
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
32867
32903
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32868
32904
|
definitionMap.set('type', metadata.type);
|
|
32869
32905
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -32958,7 +32994,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32958
32994
|
const definitionMap = new DefinitionMap();
|
|
32959
32995
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
32960
32996
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32961
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32997
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
32962
32998
|
// e.g. `type: MyDirective`
|
|
32963
32999
|
definitionMap.set('type', meta.type.value);
|
|
32964
33000
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33059,9 +33095,6 @@ function compileQuery(query) {
|
|
|
33059
33095
|
// Therefore we explicitly emit the field, and explicitly place it only when it's `false`.
|
|
33060
33096
|
meta.set('emitDistinctChangesOnly', literal(false));
|
|
33061
33097
|
}
|
|
33062
|
-
else {
|
|
33063
|
-
// The linker will assume that an absent `emitDistinctChangesOnly` flag is by default `true`.
|
|
33064
|
-
}
|
|
33065
33098
|
if (query.descendants) {
|
|
33066
33099
|
meta.set('descendants', literal(true));
|
|
33067
33100
|
}
|
|
@@ -33377,7 +33410,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33377
33410
|
function compileDeclareFactoryFunction(meta) {
|
|
33378
33411
|
const definitionMap = new DefinitionMap();
|
|
33379
33412
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33380
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33413
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33381
33414
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33382
33415
|
definitionMap.set('type', meta.type.value);
|
|
33383
33416
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33412,7 +33445,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33412
33445
|
function createInjectableDefinitionMap(meta) {
|
|
33413
33446
|
const definitionMap = new DefinitionMap();
|
|
33414
33447
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33415
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33448
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33416
33449
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33417
33450
|
definitionMap.set('type', meta.type.value);
|
|
33418
33451
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33463,7 +33496,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33463
33496
|
function createInjectorDefinitionMap(meta) {
|
|
33464
33497
|
const definitionMap = new DefinitionMap();
|
|
33465
33498
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33466
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33499
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33467
33500
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33468
33501
|
definitionMap.set('type', meta.type.value);
|
|
33469
33502
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33496,7 +33529,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33496
33529
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33497
33530
|
}
|
|
33498
33531
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33499
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33532
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33500
33533
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33501
33534
|
definitionMap.set('type', meta.type.value);
|
|
33502
33535
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33547,7 +33580,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33547
33580
|
function createPipeDefinitionMap(meta) {
|
|
33548
33581
|
const definitionMap = new DefinitionMap();
|
|
33549
33582
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33550
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33583
|
+
definitionMap.set('version', literal('20.0.0-next.2'));
|
|
33551
33584
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33552
33585
|
// e.g. `type: MyPipe`
|
|
33553
33586
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33705,24 +33738,31 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
33705
33738
|
* @description
|
|
33706
33739
|
* Entry point for all public APIs of the compiler package.
|
|
33707
33740
|
*/
|
|
33708
|
-
const VERSION = new Version('20.0.0-next.
|
|
33741
|
+
const VERSION = new Version('20.0.0-next.2');
|
|
33709
33742
|
|
|
33710
33743
|
//////////////////////////////////////
|
|
33711
|
-
//
|
|
33712
|
-
//
|
|
33713
|
-
|
|
33714
|
-
publishFacade(_global);
|
|
33715
|
-
|
|
33744
|
+
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
33745
|
+
// (see bottom of file) //
|
|
33746
|
+
//////////////////////////////////////
|
|
33716
33747
|
/**
|
|
33717
33748
|
* @module
|
|
33718
33749
|
* @description
|
|
33719
|
-
* Entry point for all
|
|
33750
|
+
* Entry point for all APIs of the compiler package.
|
|
33751
|
+
*
|
|
33752
|
+
* <div class="callout is-critical">
|
|
33753
|
+
* <header>Unstable APIs</header>
|
|
33754
|
+
* <p>
|
|
33755
|
+
* All compiler apis are currently considered experimental and private!
|
|
33756
|
+
* </p>
|
|
33757
|
+
* <p>
|
|
33758
|
+
* We expect the APIs in this package to keep on changing. Do not rely on them.
|
|
33759
|
+
* </p>
|
|
33760
|
+
* </div>
|
|
33720
33761
|
*/
|
|
33721
33762
|
// This file only reexports content of the `src` folder. Keep it that way.
|
|
33763
|
+
// This function call has a global side effects and publishes the compiler into global namespace for
|
|
33764
|
+
// the late binding of the Compiler to the @angular/core for jit compilation.
|
|
33765
|
+
publishFacade(_global);
|
|
33722
33766
|
|
|
33723
|
-
|
|
33724
|
-
|
|
33725
|
-
// This file is not used to build this module. It is only used during editing
|
|
33726
|
-
|
|
33727
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, 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, VoidExpr, VoidExpression, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, 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, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33767
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, 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, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, 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, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, 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, VoidExpr, VoidExpression, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, 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, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33728
33768
|
//# sourceMappingURL=compiler.mjs.map
|