@angular/core 20.1.0-rc.0 → 20.1.1
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/api.d.d.ts +1 -1
- package/chrome_dev_tools_performance.d.d.ts +1 -1
- package/discovery.d.d.ts +1 -1
- package/event_dispatcher.d.d.ts +1 -1
- package/fesm2022/attribute.mjs +1 -1
- package/fesm2022/core.mjs +48 -28
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node.mjs +56 -14
- package/fesm2022/debug_node.mjs.map +1 -1
- package/fesm2022/not_found.mjs +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/resource.mjs +1 -1
- package/fesm2022/root_effect_scheduler.mjs +112 -53
- package/fesm2022/root_effect_scheduler.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +2 -2
- package/fesm2022/signal.mjs +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/fesm2022/untracked.mjs +1 -1
- package/fesm2022/weak_ref.mjs +1 -1
- package/graph.d.d.ts +1 -1
- package/index.d.ts +16 -3
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/{apply_import_manager-DEMoyu96.cjs → apply_import_manager-DnZuC0qd.cjs} +3 -3
- package/schematics/bundles/{checker-CwuJOWZI.cjs → checker-CwUJ2eKt.cjs} +470 -1127
- package/schematics/bundles/cleanup-unused-imports.cjs +6 -5
- package/schematics/bundles/{compiler_host-B1N_OYoF.cjs → compiler_host-CH53_d32.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +3 -3
- package/schematics/bundles/document-core.cjs +6 -5
- package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
- package/schematics/bundles/{index-DPxKO2pR.cjs → index-BEVODdVo.cjs} +5 -4
- package/schematics/bundles/{index-CmuNlSML.cjs → index-C5Zc9zTo.cjs} +930 -54
- package/schematics/bundles/inject-flags.cjs +6 -5
- package/schematics/bundles/inject-migration.cjs +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Da3yLjVM.cjs → migrate_ts_type_references-i9f_TsT7.cjs} +6 -441
- package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +7 -6
- package/schematics/bundles/{project_paths-86Qe1BQQ.cjs → project_paths-BrdiLiLU.cjs} +39 -3
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/self-closing-tags-migration.cjs +5 -4
- package/schematics/bundles/signal-input-migration.cjs +9 -8
- package/schematics/bundles/signal-queries-migration.cjs +8 -7
- package/schematics/bundles/signals.cjs +8 -7
- package/schematics/bundles/standalone-migration.cjs +4 -4
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/bundles/test-bed-get.cjs +5 -4
- package/signal.d.d.ts +1 -1
- package/testing/index.d.ts +1 -1
- package/weak_ref.d.d.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.1.
|
|
3
|
+
* @license Angular v20.1.1
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -32,6 +32,7 @@ function _interopNamespaceDefault(e) {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
var p__namespace = /*#__PURE__*/_interopNamespaceDefault(p);
|
|
35
|
+
var url__namespace = /*#__PURE__*/_interopNamespaceDefault(url);
|
|
35
36
|
|
|
36
37
|
const _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + // 1: ":not("
|
|
37
38
|
'(([\\.\\#]?)[-\\w]+)|' + // 2: "tag"; 3: "."/"#";
|
|
@@ -2166,7 +2167,7 @@ function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments)
|
|
|
2166
2167
|
function taggedTemplate(tag, template, type, sourceSpan) {
|
|
2167
2168
|
return new TaggedTemplateLiteralExpr(tag, template, type, sourceSpan);
|
|
2168
2169
|
}
|
|
2169
|
-
function literal
|
|
2170
|
+
function literal(value, type, sourceSpan) {
|
|
2170
2171
|
return new LiteralExpr(value, type, sourceSpan);
|
|
2171
2172
|
}
|
|
2172
2173
|
function localizedString(metaBlock, messageParts, placeholderNames, expressions, sourceSpan) {
|
|
@@ -2867,6 +2868,7 @@ class Identifiers {
|
|
|
2867
2868
|
static InputSignalBrandWriteType = { name: 'ɵINPUT_SIGNAL_BRAND_WRITE_TYPE', moduleName: CORE };
|
|
2868
2869
|
static UnwrapDirectiveSignalInputs = { name: 'ɵUnwrapDirectiveSignalInputs', moduleName: CORE };
|
|
2869
2870
|
static unwrapWritableSignal = { name: 'ɵunwrapWritableSignal', moduleName: CORE };
|
|
2871
|
+
static assertType = { name: 'ɵassertType', moduleName: CORE };
|
|
2870
2872
|
}
|
|
2871
2873
|
|
|
2872
2874
|
const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
|
|
@@ -3122,7 +3124,7 @@ class _EmittedLine {
|
|
|
3122
3124
|
this.indent = indent;
|
|
3123
3125
|
}
|
|
3124
3126
|
}
|
|
3125
|
-
const BINARY_OPERATORS$
|
|
3127
|
+
const BINARY_OPERATORS$2 = new Map([
|
|
3126
3128
|
[BinaryOperator.And, '&&'],
|
|
3127
3129
|
[BinaryOperator.Bigger, '>'],
|
|
3128
3130
|
[BinaryOperator.BiggerEquals, '>='],
|
|
@@ -3476,7 +3478,7 @@ class AbstractEmitterVisitor {
|
|
|
3476
3478
|
return null;
|
|
3477
3479
|
}
|
|
3478
3480
|
visitBinaryOperatorExpr(ast, ctx) {
|
|
3479
|
-
const operator = BINARY_OPERATORS$
|
|
3481
|
+
const operator = BINARY_OPERATORS$2.get(ast.operator);
|
|
3480
3482
|
if (!operator) {
|
|
3481
3483
|
throw new Error(`Unknown operator ${ast.operator}`);
|
|
3482
3484
|
}
|
|
@@ -3613,7 +3615,7 @@ function devOnlyGuardedExpression(expr) {
|
|
|
3613
3615
|
}
|
|
3614
3616
|
function guardedExpression(guard, expr) {
|
|
3615
3617
|
const guardExpr = new ExternalExpr({ name: guard, moduleName: null });
|
|
3616
|
-
const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal
|
|
3618
|
+
const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal('undefined'));
|
|
3617
3619
|
const guardUndefinedOrTrue = new BinaryOperatorExpr(BinaryOperator.Or, guardNotDefined, guardExpr,
|
|
3618
3620
|
/* type */ undefined,
|
|
3619
3621
|
/* sourceSpan */ undefined);
|
|
@@ -3759,7 +3761,7 @@ function injectDependencies(deps, target) {
|
|
|
3759
3761
|
function compileInjectDependency(dep, target, index) {
|
|
3760
3762
|
// Interpret the dependency according to its resolved type.
|
|
3761
3763
|
if (dep.token === null) {
|
|
3762
|
-
return importExpr(Identifiers.invalidFactoryDep).callFn([literal
|
|
3764
|
+
return importExpr(Identifiers.invalidFactoryDep).callFn([literal(index)]);
|
|
3763
3765
|
}
|
|
3764
3766
|
else if (dep.attributeNameType === null) {
|
|
3765
3767
|
// Build up the injection flags according to the metadata.
|
|
@@ -3772,7 +3774,7 @@ function compileInjectDependency(dep, target, index) {
|
|
|
3772
3774
|
// If this dependency is optional or otherwise has non-default flags, then additional
|
|
3773
3775
|
// parameters describing how to inject the dependency must be passed to the inject function
|
|
3774
3776
|
// that's being used.
|
|
3775
|
-
let flagsParam = flags !== 0 /* InjectFlags.Default */ || dep.optional ? literal
|
|
3777
|
+
let flagsParam = flags !== 0 /* InjectFlags.Default */ || dep.optional ? literal(flags) : null;
|
|
3776
3778
|
// Build up the arguments to the injectFn call.
|
|
3777
3779
|
const injectArgs = [dep.token];
|
|
3778
3780
|
if (flagsParam) {
|
|
@@ -3801,7 +3803,7 @@ function createCtorDepsType(deps) {
|
|
|
3801
3803
|
return type;
|
|
3802
3804
|
}
|
|
3803
3805
|
else {
|
|
3804
|
-
return literal
|
|
3806
|
+
return literal(null);
|
|
3805
3807
|
}
|
|
3806
3808
|
});
|
|
3807
3809
|
if (hasTypes) {
|
|
@@ -3817,16 +3819,16 @@ function createCtorDepType(dep) {
|
|
|
3817
3819
|
entries.push({ key: 'attribute', value: dep.attributeNameType, quoted: false });
|
|
3818
3820
|
}
|
|
3819
3821
|
if (dep.optional) {
|
|
3820
|
-
entries.push({ key: 'optional', value: literal
|
|
3822
|
+
entries.push({ key: 'optional', value: literal(true), quoted: false });
|
|
3821
3823
|
}
|
|
3822
3824
|
if (dep.host) {
|
|
3823
|
-
entries.push({ key: 'host', value: literal
|
|
3825
|
+
entries.push({ key: 'host', value: literal(true), quoted: false });
|
|
3824
3826
|
}
|
|
3825
3827
|
if (dep.self) {
|
|
3826
|
-
entries.push({ key: 'self', value: literal
|
|
3828
|
+
entries.push({ key: 'self', value: literal(true), quoted: false });
|
|
3827
3829
|
}
|
|
3828
3830
|
if (dep.skipSelf) {
|
|
3829
|
-
entries.push({ key: 'skipSelf', value: literal
|
|
3831
|
+
entries.push({ key: 'skipSelf', value: literal(true), quoted: false });
|
|
3830
3832
|
}
|
|
3831
3833
|
return entries.length > 0 ? literalMap(entries) : null;
|
|
3832
3834
|
}
|
|
@@ -4688,8 +4690,9 @@ let Element$1 = class Element {
|
|
|
4688
4690
|
sourceSpan;
|
|
4689
4691
|
startSourceSpan;
|
|
4690
4692
|
endSourceSpan;
|
|
4693
|
+
isVoid;
|
|
4691
4694
|
i18n;
|
|
4692
|
-
constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
|
|
4695
|
+
constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, isVoid, i18n) {
|
|
4693
4696
|
this.name = name;
|
|
4694
4697
|
this.attributes = attributes;
|
|
4695
4698
|
this.inputs = inputs;
|
|
@@ -4701,6 +4704,7 @@ let Element$1 = class Element {
|
|
|
4701
4704
|
this.sourceSpan = sourceSpan;
|
|
4702
4705
|
this.startSourceSpan = startSourceSpan;
|
|
4703
4706
|
this.endSourceSpan = endSourceSpan;
|
|
4707
|
+
this.isVoid = isVoid;
|
|
4704
4708
|
this.i18n = i18n;
|
|
4705
4709
|
}
|
|
4706
4710
|
visit(visitor) {
|
|
@@ -5971,7 +5975,7 @@ function asLiteral(value) {
|
|
|
5971
5975
|
if (Array.isArray(value)) {
|
|
5972
5976
|
return literalArr(value.map(asLiteral));
|
|
5973
5977
|
}
|
|
5974
|
-
return literal
|
|
5978
|
+
return literal(value, INFERRED_TYPE);
|
|
5975
5979
|
}
|
|
5976
5980
|
/**
|
|
5977
5981
|
* Serializes inputs and outputs for `defineDirective` and `defineComponent`.
|
|
@@ -6015,7 +6019,7 @@ function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
|
|
|
6015
6019
|
// decorator input transform functions, or store flag information if there is any.
|
|
6016
6020
|
if (forInputs &&
|
|
6017
6021
|
(differentDeclaringName || hasDecoratorInputTransform || flags !== InputFlags.None)) {
|
|
6018
|
-
const result = [literal
|
|
6022
|
+
const result = [literal(flags), asLiteral(publicName)];
|
|
6019
6023
|
if (differentDeclaringName || hasDecoratorInputTransform) {
|
|
6020
6024
|
result.push(asLiteral(declaredName));
|
|
6021
6025
|
if (hasDecoratorInputTransform) {
|
|
@@ -6498,7 +6502,7 @@ var ParseErrorLevel;
|
|
|
6498
6502
|
ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
|
|
6499
6503
|
ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
|
|
6500
6504
|
})(ParseErrorLevel || (ParseErrorLevel = {}));
|
|
6501
|
-
class ParseError {
|
|
6505
|
+
class ParseError extends Error {
|
|
6502
6506
|
span;
|
|
6503
6507
|
msg;
|
|
6504
6508
|
level;
|
|
@@ -6515,10 +6519,15 @@ class ParseError {
|
|
|
6515
6519
|
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
|
|
6516
6520
|
*/
|
|
6517
6521
|
relatedError) {
|
|
6522
|
+
super(msg);
|
|
6518
6523
|
this.span = span;
|
|
6519
6524
|
this.msg = msg;
|
|
6520
6525
|
this.level = level;
|
|
6521
6526
|
this.relatedError = relatedError;
|
|
6527
|
+
// Extending `Error` ends up breaking some internal tests. This appears to be a known issue
|
|
6528
|
+
// when extending errors in TS and the workaround is to explicitly set the prototype.
|
|
6529
|
+
// https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
6530
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
6522
6531
|
}
|
|
6523
6532
|
contextualMessage() {
|
|
6524
6533
|
const ctx = this.span.start.getContext(100, 3);
|
|
@@ -6821,7 +6830,7 @@ class JitEvaluator {
|
|
|
6821
6830
|
const ctx = EmitterVisitorContext.createRoot();
|
|
6822
6831
|
// Ensure generated code is in strict mode
|
|
6823
6832
|
if (statements.length > 0 && !isUseStrictStatement(statements[0])) {
|
|
6824
|
-
statements = [literal
|
|
6833
|
+
statements = [literal('use strict').toStmt(), ...statements];
|
|
6825
6834
|
}
|
|
6826
6835
|
converter.visitAllStatements(statements, ctx);
|
|
6827
6836
|
converter.createReturnStmt(ctx);
|
|
@@ -6927,7 +6936,7 @@ class JitEmitterVisitor extends AbstractJsEmitterVisitor {
|
|
|
6927
6936
|
}
|
|
6928
6937
|
}
|
|
6929
6938
|
function isUseStrictStatement(statement) {
|
|
6930
|
-
return statement.isEquivalent(literal
|
|
6939
|
+
return statement.isEquivalent(literal('use strict').toStmt());
|
|
6931
6940
|
}
|
|
6932
6941
|
|
|
6933
6942
|
function compileInjector(meta) {
|
|
@@ -7172,15 +7181,15 @@ function compilePipeFromMetadata(metadata) {
|
|
|
7172
7181
|
// e.g. `name: 'myPipe'`
|
|
7173
7182
|
definitionMapValues.push({
|
|
7174
7183
|
key: 'name',
|
|
7175
|
-
value: literal
|
|
7184
|
+
value: literal(metadata.pipeName ?? metadata.name),
|
|
7176
7185
|
quoted: false,
|
|
7177
7186
|
});
|
|
7178
7187
|
// e.g. `type: MyPipe`
|
|
7179
7188
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
7180
7189
|
// e.g. `pure: true`
|
|
7181
|
-
definitionMapValues.push({ key: 'pure', value: literal
|
|
7190
|
+
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
7182
7191
|
if (metadata.isStandalone === false) {
|
|
7183
|
-
definitionMapValues.push({ key: 'standalone', value: literal
|
|
7192
|
+
definitionMapValues.push({ key: 'standalone', value: literal(false), quoted: false });
|
|
7184
7193
|
}
|
|
7185
7194
|
const expression = importExpr(Identifiers.definePipe)
|
|
7186
7195
|
.callFn([literalMap(definitionMapValues)], undefined, true);
|
|
@@ -10444,7 +10453,7 @@ class OpList {
|
|
|
10444
10453
|
oldOp.next = null;
|
|
10445
10454
|
let prev = oldPrev;
|
|
10446
10455
|
for (const newOp of newOps) {
|
|
10447
|
-
|
|
10456
|
+
OpList.assertIsUnowned(newOp);
|
|
10448
10457
|
newOp.debugListId = listId;
|
|
10449
10458
|
prev.next = newOp;
|
|
10450
10459
|
newOp.prev = prev;
|
|
@@ -10485,7 +10494,7 @@ class OpList {
|
|
|
10485
10494
|
static insertBefore(op, target) {
|
|
10486
10495
|
if (Array.isArray(op)) {
|
|
10487
10496
|
for (const o of op) {
|
|
10488
|
-
|
|
10497
|
+
OpList.insertBefore(o, target);
|
|
10489
10498
|
}
|
|
10490
10499
|
return;
|
|
10491
10500
|
}
|
|
@@ -11781,7 +11790,7 @@ function generateConditionalExpressions(job) {
|
|
|
11781
11790
|
}
|
|
11782
11791
|
else {
|
|
11783
11792
|
// By default, a switch evaluates to `-1`, causing no template to be displayed.
|
|
11784
|
-
test = literal
|
|
11793
|
+
test = literal(-1);
|
|
11785
11794
|
}
|
|
11786
11795
|
// Switch expressions assign their main test to a temporary, to avoid re-executing it.
|
|
11787
11796
|
let tmp = op.test == null ? null : new AssignTemporaryExpr(op.test, job.allocateXrefId());
|
|
@@ -11812,7 +11821,7 @@ function generateConditionalExpressions(job) {
|
|
|
11812
11821
|
}
|
|
11813
11822
|
}
|
|
11814
11823
|
|
|
11815
|
-
const BINARY_OPERATORS$
|
|
11824
|
+
const BINARY_OPERATORS$1 = new Map([
|
|
11816
11825
|
['&&', BinaryOperator.And],
|
|
11817
11826
|
['>', BinaryOperator.Bigger],
|
|
11818
11827
|
['>=', BinaryOperator.BiggerEquals],
|
|
@@ -11876,7 +11885,7 @@ function literalOrArrayLiteral(value) {
|
|
|
11876
11885
|
if (Array.isArray(value)) {
|
|
11877
11886
|
return literalArr(value.map(literalOrArrayLiteral));
|
|
11878
11887
|
}
|
|
11879
|
-
return literal
|
|
11888
|
+
return literal(value);
|
|
11880
11889
|
}
|
|
11881
11890
|
|
|
11882
11891
|
/**
|
|
@@ -12047,9 +12056,9 @@ class ElementAttributes {
|
|
|
12047
12056
|
* Gets an array of literal expressions representing the attribute's namespaced name.
|
|
12048
12057
|
*/
|
|
12049
12058
|
function getAttributeNameLiterals(namespace, name) {
|
|
12050
|
-
const nameLiteral = literal
|
|
12059
|
+
const nameLiteral = literal(name);
|
|
12051
12060
|
if (namespace) {
|
|
12052
|
-
return [literal
|
|
12061
|
+
return [literal(0 /* core.AttributeMarker.NamespaceURI */), literal(namespace), nameLiteral];
|
|
12053
12062
|
}
|
|
12054
12063
|
return [nameLiteral];
|
|
12055
12064
|
}
|
|
@@ -12062,22 +12071,22 @@ function serializeAttributes({ attributes, bindings, classes, i18n, projectAs, s
|
|
|
12062
12071
|
// Parse the attribute value into a CssSelectorList. Note that we only take the
|
|
12063
12072
|
// first selector, because we don't support multiple selectors in ngProjectAs.
|
|
12064
12073
|
const parsedR3Selector = parseSelectorToR3Selector(projectAs)[0];
|
|
12065
|
-
attrArray.push(literal
|
|
12074
|
+
attrArray.push(literal(5 /* core.AttributeMarker.ProjectAs */), literalOrArrayLiteral(parsedR3Selector));
|
|
12066
12075
|
}
|
|
12067
12076
|
if (classes.length > 0) {
|
|
12068
|
-
attrArray.push(literal
|
|
12077
|
+
attrArray.push(literal(1 /* core.AttributeMarker.Classes */), ...classes);
|
|
12069
12078
|
}
|
|
12070
12079
|
if (styles.length > 0) {
|
|
12071
|
-
attrArray.push(literal
|
|
12080
|
+
attrArray.push(literal(2 /* core.AttributeMarker.Styles */), ...styles);
|
|
12072
12081
|
}
|
|
12073
12082
|
if (bindings.length > 0) {
|
|
12074
|
-
attrArray.push(literal
|
|
12083
|
+
attrArray.push(literal(3 /* core.AttributeMarker.Bindings */), ...bindings);
|
|
12075
12084
|
}
|
|
12076
12085
|
if (template.length > 0) {
|
|
12077
|
-
attrArray.push(literal
|
|
12086
|
+
attrArray.push(literal(4 /* core.AttributeMarker.Template */), ...template);
|
|
12078
12087
|
}
|
|
12079
12088
|
if (i18n.length > 0) {
|
|
12080
|
-
attrArray.push(literal
|
|
12089
|
+
attrArray.push(literal(6 /* core.AttributeMarker.I18n */), ...i18n);
|
|
12081
12090
|
}
|
|
12082
12091
|
return literalArr(attrArray);
|
|
12083
12092
|
}
|
|
@@ -12699,7 +12708,7 @@ function extractI18nMessages(job) {
|
|
|
12699
12708
|
throw Error('AssertionError: Unexpected ICU placeholder outside of i18n context');
|
|
12700
12709
|
}
|
|
12701
12710
|
const msg = i18nMessagesByContext.get(currentIcu.context);
|
|
12702
|
-
msg.postprocessingParams.set(op.name, literal
|
|
12711
|
+
msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
|
|
12703
12712
|
OpList.remove(op);
|
|
12704
12713
|
break;
|
|
12705
12714
|
}
|
|
@@ -12733,7 +12742,7 @@ function formatParams(params) {
|
|
|
12733
12742
|
for (const [placeholder, placeholderValues] of params) {
|
|
12734
12743
|
const serializedValues = formatParamValues(placeholderValues);
|
|
12735
12744
|
if (serializedValues !== null) {
|
|
12736
|
-
formattedParams.set(placeholder, literal
|
|
12745
|
+
formattedParams.set(placeholder, literal(serializedValues));
|
|
12737
12746
|
}
|
|
12738
12747
|
}
|
|
12739
12748
|
return formattedParams;
|
|
@@ -13110,7 +13119,7 @@ function collectConstExpressions(job) {
|
|
|
13110
13119
|
if (!(expr instanceof ConstCollectedExpr)) {
|
|
13111
13120
|
return expr;
|
|
13112
13121
|
}
|
|
13113
|
-
return literal
|
|
13122
|
+
return literal(job.addConst(expr.expr));
|
|
13114
13123
|
}, VisitorContextFlag.None);
|
|
13115
13124
|
}
|
|
13116
13125
|
}
|
|
@@ -13315,7 +13324,8 @@ class Element extends NodeWithI18n {
|
|
|
13315
13324
|
isSelfClosing;
|
|
13316
13325
|
startSourceSpan;
|
|
13317
13326
|
endSourceSpan;
|
|
13318
|
-
|
|
13327
|
+
isVoid;
|
|
13328
|
+
constructor(name, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, isVoid, i18n) {
|
|
13319
13329
|
super(sourceSpan, i18n);
|
|
13320
13330
|
this.name = name;
|
|
13321
13331
|
this.attrs = attrs;
|
|
@@ -13324,6 +13334,7 @@ class Element extends NodeWithI18n {
|
|
|
13324
13334
|
this.isSelfClosing = isSelfClosing;
|
|
13325
13335
|
this.startSourceSpan = startSourceSpan;
|
|
13326
13336
|
this.endSourceSpan = endSourceSpan;
|
|
13337
|
+
this.isVoid = isVoid;
|
|
13327
13338
|
}
|
|
13328
13339
|
visit(visitor, context) {
|
|
13329
13340
|
return visitor.visitElement(this, context);
|
|
@@ -15661,6 +15672,19 @@ var CharacterReferenceType;
|
|
|
15661
15672
|
CharacterReferenceType["HEX"] = "hexadecimal";
|
|
15662
15673
|
CharacterReferenceType["DEC"] = "decimal";
|
|
15663
15674
|
})(CharacterReferenceType || (CharacterReferenceType = {}));
|
|
15675
|
+
const SUPPORTED_BLOCKS = [
|
|
15676
|
+
'@if',
|
|
15677
|
+
'@else', // Covers `@else if` as well
|
|
15678
|
+
'@for',
|
|
15679
|
+
'@switch',
|
|
15680
|
+
'@case',
|
|
15681
|
+
'@default',
|
|
15682
|
+
'@empty',
|
|
15683
|
+
'@defer',
|
|
15684
|
+
'@placeholder',
|
|
15685
|
+
'@loading',
|
|
15686
|
+
'@error',
|
|
15687
|
+
];
|
|
15664
15688
|
// See https://www.w3.org/TR/html51/syntax.html#writing-html-documents
|
|
15665
15689
|
class _Tokenizer {
|
|
15666
15690
|
_getTagDefinition;
|
|
@@ -15751,10 +15775,10 @@ class _Tokenizer {
|
|
|
15751
15775
|
// don't want to advance in case it's not `@let`.
|
|
15752
15776
|
this._cursor.peek() === $AT &&
|
|
15753
15777
|
!this._inInterpolation &&
|
|
15754
|
-
this.
|
|
15778
|
+
this._isLetStart()) {
|
|
15755
15779
|
this._consumeLetDeclaration(start);
|
|
15756
15780
|
}
|
|
15757
|
-
else if (this._tokenizeBlocks && this.
|
|
15781
|
+
else if (this._tokenizeBlocks && this._isBlockStart()) {
|
|
15758
15782
|
this._consumeBlockStart(start);
|
|
15759
15783
|
}
|
|
15760
15784
|
else if (this._tokenizeBlocks &&
|
|
@@ -15794,6 +15818,7 @@ class _Tokenizer {
|
|
|
15794
15818
|
return this._cursor.getChars(nameCursor).trim();
|
|
15795
15819
|
}
|
|
15796
15820
|
_consumeBlockStart(start) {
|
|
15821
|
+
this._requireCharCode($AT);
|
|
15797
15822
|
this._beginToken(24 /* TokenType.BLOCK_OPEN_START */, start);
|
|
15798
15823
|
const startToken = this._endToken([this._getBlockName()]);
|
|
15799
15824
|
if (this._cursor.peek() === $LPAREN) {
|
|
@@ -15866,6 +15891,7 @@ class _Tokenizer {
|
|
|
15866
15891
|
}
|
|
15867
15892
|
}
|
|
15868
15893
|
_consumeLetDeclaration(start) {
|
|
15894
|
+
this._requireStr('@let');
|
|
15869
15895
|
this._beginToken(29 /* TokenType.LET_START */, start);
|
|
15870
15896
|
// Require at least one white space after the `@let`.
|
|
15871
15897
|
if (isWhitespace(this._cursor.peek())) {
|
|
@@ -16079,6 +16105,27 @@ class _Tokenizer {
|
|
|
16079
16105
|
this._cursor.advance();
|
|
16080
16106
|
return char;
|
|
16081
16107
|
}
|
|
16108
|
+
_peekStr(chars) {
|
|
16109
|
+
const len = chars.length;
|
|
16110
|
+
if (this._cursor.charsLeft() < len) {
|
|
16111
|
+
return false;
|
|
16112
|
+
}
|
|
16113
|
+
const cursor = this._cursor.clone();
|
|
16114
|
+
for (let i = 0; i < len; i++) {
|
|
16115
|
+
if (cursor.peek() !== chars.charCodeAt(i)) {
|
|
16116
|
+
return false;
|
|
16117
|
+
}
|
|
16118
|
+
cursor.advance();
|
|
16119
|
+
}
|
|
16120
|
+
return true;
|
|
16121
|
+
}
|
|
16122
|
+
_isBlockStart() {
|
|
16123
|
+
return (this._cursor.peek() === $AT &&
|
|
16124
|
+
SUPPORTED_BLOCKS.some((blockName) => this._peekStr(blockName)));
|
|
16125
|
+
}
|
|
16126
|
+
_isLetStart() {
|
|
16127
|
+
return this._cursor.peek() === $AT && this._peekStr('@let');
|
|
16128
|
+
}
|
|
16082
16129
|
_consumeEntity(textTokenType) {
|
|
16083
16130
|
this._beginToken(9 /* TokenType.ENCODED_ENTITY */);
|
|
16084
16131
|
const start = this._cursor.clone();
|
|
@@ -16625,7 +16672,7 @@ class _Tokenizer {
|
|
|
16625
16672
|
if (this._tokenizeBlocks &&
|
|
16626
16673
|
!this._inInterpolation &&
|
|
16627
16674
|
!this._isInExpansion() &&
|
|
16628
|
-
(this.
|
|
16675
|
+
(this._isBlockStart() || this._isLetStart() || this._cursor.peek() === $RBRACE)) {
|
|
16629
16676
|
return true;
|
|
16630
16677
|
}
|
|
16631
16678
|
return false;
|
|
@@ -16984,12 +17031,16 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
16984
17031
|
}
|
|
16985
17032
|
}
|
|
16986
17033
|
}
|
|
16987
|
-
class CursorError {
|
|
17034
|
+
class CursorError extends Error {
|
|
16988
17035
|
msg;
|
|
16989
17036
|
cursor;
|
|
16990
17037
|
constructor(msg, cursor) {
|
|
17038
|
+
super(msg);
|
|
16991
17039
|
this.msg = msg;
|
|
16992
17040
|
this.cursor = cursor;
|
|
17041
|
+
// Extending `Error` does not always work when code is transpiled. See:
|
|
17042
|
+
// https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
17043
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
16993
17044
|
}
|
|
16994
17045
|
}
|
|
16995
17046
|
|
|
@@ -17258,13 +17309,13 @@ class _TreeBuilder {
|
|
|
17258
17309
|
const directives = [];
|
|
17259
17310
|
this._consumeAttributesAndDirectives(attrs, directives);
|
|
17260
17311
|
const fullName = this._getElementFullName(startTagToken, this._getClosestElementLikeParent());
|
|
17312
|
+
const tagDef = this._getTagDefinition(fullName);
|
|
17261
17313
|
let selfClosing = false;
|
|
17262
17314
|
// Note: There could have been a tokenizer error
|
|
17263
17315
|
// so that we don't get a token for the end tag...
|
|
17264
17316
|
if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {
|
|
17265
17317
|
this._advance();
|
|
17266
17318
|
selfClosing = true;
|
|
17267
|
-
const tagDef = this._getTagDefinition(fullName);
|
|
17268
17319
|
if (!(tagDef?.canSelfClose || getNsPrefix(fullName) !== null || tagDef?.isVoid)) {
|
|
17269
17320
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
17270
17321
|
}
|
|
@@ -17277,7 +17328,7 @@ class _TreeBuilder {
|
|
|
17277
17328
|
const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
17278
17329
|
// Create a separate `startSpan` because `span` will be modified when there is an `end` span.
|
|
17279
17330
|
const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
|
|
17280
|
-
const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined);
|
|
17331
|
+
const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined, tagDef?.isVoid ?? false);
|
|
17281
17332
|
const parent = this._getContainer();
|
|
17282
17333
|
const isClosedByChild = parent !== null && !!this._getTagDefinition(parent)?.isClosedByChild(el.name);
|
|
17283
17334
|
this._pushContainer(el, isClosedByChild);
|
|
@@ -17720,11 +17771,11 @@ class WhitespaceVisitor {
|
|
|
17720
17771
|
if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
|
|
17721
17772
|
// don't descent into elements where we need to preserve whitespaces
|
|
17722
17773
|
// but still visit all attributes to eliminate one used as a market to preserve WS
|
|
17723
|
-
const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
17774
|
+
const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
17724
17775
|
this.originalNodeMap?.set(newElement, element);
|
|
17725
17776
|
return newElement;
|
|
17726
17777
|
}
|
|
17727
|
-
const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
17778
|
+
const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
17728
17779
|
this.originalNodeMap?.set(newElement, element);
|
|
17729
17780
|
return newElement;
|
|
17730
17781
|
}
|
|
@@ -17976,9 +18027,11 @@ class Token {
|
|
|
17976
18027
|
return this.type === TokenType.Number ? this.numValue : -1;
|
|
17977
18028
|
}
|
|
17978
18029
|
isTemplateLiteralPart() {
|
|
18030
|
+
// Note: Explicit type is needed for Closure.
|
|
17979
18031
|
return this.isString() && this.kind === StringTokenKind.TemplateLiteralPart;
|
|
17980
18032
|
}
|
|
17981
18033
|
isTemplateLiteralEnd() {
|
|
18034
|
+
// Note: Explicit type is needed for Closure.
|
|
17982
18035
|
return this.isString() && this.kind === StringTokenKind.TemplateLiteralEnd;
|
|
17983
18036
|
}
|
|
17984
18037
|
isTemplateLiteralInterpolationStart() {
|
|
@@ -19369,12 +19422,13 @@ class _ParseAST {
|
|
|
19369
19422
|
else {
|
|
19370
19423
|
if (this.isAssignmentOperator(this.next)) {
|
|
19371
19424
|
const operation = this.next.strValue;
|
|
19372
|
-
this.advance();
|
|
19373
19425
|
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
19426
|
+
this.advance();
|
|
19374
19427
|
this.error('Bindings cannot contain assignments');
|
|
19375
19428
|
return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
|
|
19376
19429
|
}
|
|
19377
19430
|
const receiver = new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
|
|
19431
|
+
this.advance();
|
|
19378
19432
|
const value = this.parseConditional();
|
|
19379
19433
|
return new Binary(this.span(start), this.sourceSpan(start), operation, receiver, value);
|
|
19380
19434
|
}
|
|
@@ -19493,12 +19547,13 @@ class _ParseAST {
|
|
|
19493
19547
|
this.expectCharacter($RBRACKET);
|
|
19494
19548
|
if (this.isAssignmentOperator(this.next)) {
|
|
19495
19549
|
const operation = this.next.strValue;
|
|
19496
|
-
this.advance();
|
|
19497
19550
|
if (isSafe) {
|
|
19551
|
+
this.advance();
|
|
19498
19552
|
this.error("The '?.' operator cannot be used in the assignment");
|
|
19499
19553
|
}
|
|
19500
19554
|
else {
|
|
19501
19555
|
const binaryReceiver = new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
|
|
19556
|
+
this.advance();
|
|
19502
19557
|
const value = this.parseConditional();
|
|
19503
19558
|
return new Binary(this.span(start), this.sourceSpan(start), operation, binaryReceiver, value);
|
|
19504
19559
|
}
|
|
@@ -21428,7 +21483,7 @@ const GOOG_GET_MSG = 'goog.getMsg';
|
|
|
21428
21483
|
*/
|
|
21429
21484
|
function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
|
|
21430
21485
|
const messageString = serializeI18nMessageForGetMsg(message);
|
|
21431
|
-
const args = [literal
|
|
21486
|
+
const args = [literal(messageString)];
|
|
21432
21487
|
if (Object.keys(placeholderValues).length) {
|
|
21433
21488
|
// Message template parameters containing the magic strings replaced by the Angular runtime with
|
|
21434
21489
|
// real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
|
|
@@ -21442,9 +21497,9 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, placehold
|
|
|
21442
21497
|
quoted: true,
|
|
21443
21498
|
value: message.placeholders[param]
|
|
21444
21499
|
? // Get source span for typical placeholder if it exists.
|
|
21445
|
-
literal
|
|
21500
|
+
literal(message.placeholders[param].sourceSpan.toString())
|
|
21446
21501
|
: // Otherwise must be an ICU expression, get it's source span.
|
|
21447
|
-
literal
|
|
21502
|
+
literal(message.placeholderToMessage[param].nodes
|
|
21448
21503
|
.map((node) => node.sourceSpan.toString())
|
|
21449
21504
|
.join('')),
|
|
21450
21505
|
}))),
|
|
@@ -21759,7 +21814,7 @@ function collectI18nConsts(job) {
|
|
|
21759
21814
|
if (i18nExprValue === undefined) {
|
|
21760
21815
|
throw new Error("AssertionError: Could not find i18n expression's value");
|
|
21761
21816
|
}
|
|
21762
|
-
return [literal
|
|
21817
|
+
return [literal(i18nExpr.name), i18nExprValue];
|
|
21763
21818
|
});
|
|
21764
21819
|
i18nAttributes.i18nAttributesConfig = job.addConst(new LiteralArrayExpr(i18nAttributeConfig));
|
|
21765
21820
|
}
|
|
@@ -21837,7 +21892,7 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
|
|
|
21837
21892
|
messageOp.params.set(placeholder, subMessages[0]);
|
|
21838
21893
|
}
|
|
21839
21894
|
else {
|
|
21840
|
-
messageOp.params.set(placeholder, literal
|
|
21895
|
+
messageOp.params.set(placeholder, literal(`${ESCAPE}${I18N_ICU_MAPPING_PREFIX}${placeholder}${ESCAPE}`));
|
|
21841
21896
|
messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
|
|
21842
21897
|
}
|
|
21843
21898
|
}
|
|
@@ -21890,7 +21945,7 @@ function getTranslationDeclStmts(message, variable, closureVar, params, transfor
|
|
|
21890
21945
|
*/
|
|
21891
21946
|
function createClosureModeGuard() {
|
|
21892
21947
|
return typeofExpr(variable(NG_I18N_CLOSURE_MODE))
|
|
21893
|
-
.notIdentical(literal
|
|
21948
|
+
.notIdentical(literal('undefined', STRING_TYPE))
|
|
21894
21949
|
.and(variable(NG_I18N_CLOSURE_MODE));
|
|
21895
21950
|
}
|
|
21896
21951
|
/**
|
|
@@ -22031,7 +22086,7 @@ function liftLocalRefs(job) {
|
|
|
22031
22086
|
function serializeLocalRefs(refs) {
|
|
22032
22087
|
const constRefs = [];
|
|
22033
22088
|
for (const ref of refs) {
|
|
22034
|
-
constRefs.push(literal
|
|
22089
|
+
constRefs.push(literal(ref.name), literal(ref.target));
|
|
22035
22090
|
}
|
|
22036
22091
|
return literalArr(constRefs);
|
|
22037
22092
|
}
|
|
@@ -22167,7 +22222,7 @@ function parseExtractedStyles(job) {
|
|
|
22167
22222
|
if (op.name === 'style') {
|
|
22168
22223
|
const parsedStyles = parse(op.expression.value);
|
|
22169
22224
|
for (let i = 0; i < parsedStyles.length - 1; i += 2) {
|
|
22170
|
-
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal
|
|
22225
|
+
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
|
|
22171
22226
|
}
|
|
22172
22227
|
OpList.remove(op);
|
|
22173
22228
|
}
|
|
@@ -22910,30 +22965,30 @@ function elementStart(slot, tag, constIndex, localRefIndex, sourceSpan) {
|
|
|
22910
22965
|
return elementOrContainerBase(Identifiers.elementStart, slot, tag, constIndex, localRefIndex, sourceSpan);
|
|
22911
22966
|
}
|
|
22912
22967
|
function elementOrContainerBase(instruction, slot, tag, constIndex, localRefIndex, sourceSpan) {
|
|
22913
|
-
const args = [literal
|
|
22968
|
+
const args = [literal(slot)];
|
|
22914
22969
|
if (tag !== null) {
|
|
22915
|
-
args.push(literal
|
|
22970
|
+
args.push(literal(tag));
|
|
22916
22971
|
}
|
|
22917
22972
|
if (localRefIndex !== null) {
|
|
22918
|
-
args.push(literal
|
|
22919
|
-
literal
|
|
22973
|
+
args.push(literal(constIndex), // might be null, but that's okay.
|
|
22974
|
+
literal(localRefIndex));
|
|
22920
22975
|
}
|
|
22921
22976
|
else if (constIndex !== null) {
|
|
22922
|
-
args.push(literal
|
|
22977
|
+
args.push(literal(constIndex));
|
|
22923
22978
|
}
|
|
22924
22979
|
return call(instruction, args, sourceSpan);
|
|
22925
22980
|
}
|
|
22926
22981
|
function templateBase(instruction, slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
22927
22982
|
const args = [
|
|
22928
|
-
literal
|
|
22983
|
+
literal(slot),
|
|
22929
22984
|
templateFnRef,
|
|
22930
|
-
literal
|
|
22931
|
-
literal
|
|
22932
|
-
literal
|
|
22933
|
-
literal
|
|
22985
|
+
literal(decls),
|
|
22986
|
+
literal(vars),
|
|
22987
|
+
literal(tag),
|
|
22988
|
+
literal(constIndex),
|
|
22934
22989
|
];
|
|
22935
22990
|
if (localRefs !== null) {
|
|
22936
|
-
args.push(literal
|
|
22991
|
+
args.push(literal(localRefs));
|
|
22937
22992
|
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
22938
22993
|
}
|
|
22939
22994
|
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
@@ -22942,7 +22997,7 @@ function templateBase(instruction, slot, templateFnRef, decls, vars, tag, constI
|
|
|
22942
22997
|
return call(instruction, args, sourceSpan);
|
|
22943
22998
|
}
|
|
22944
22999
|
function propertyBase(instruction, name, expression, sanitizer, sourceSpan) {
|
|
22945
|
-
const args = [literal
|
|
23000
|
+
const args = [literal(name)];
|
|
22946
23001
|
if (expression instanceof Interpolation) {
|
|
22947
23002
|
args.push(interpolationToExpression(expression, sourceSpan));
|
|
22948
23003
|
}
|
|
@@ -22978,7 +23033,7 @@ function enableBindings() {
|
|
|
22978
23033
|
return call(Identifiers.enableBindings, [], null);
|
|
22979
23034
|
}
|
|
22980
23035
|
function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
|
|
22981
|
-
const args = [literal
|
|
23036
|
+
const args = [literal(name), handlerFn];
|
|
22982
23037
|
if (eventTargetResolver !== null) {
|
|
22983
23038
|
args.push(importExpr(eventTargetResolver));
|
|
22984
23039
|
}
|
|
@@ -22988,10 +23043,10 @@ function twoWayBindingSet(target, value) {
|
|
|
22988
23043
|
return importExpr(Identifiers.twoWayBindingSet).callFn([target, value]);
|
|
22989
23044
|
}
|
|
22990
23045
|
function twoWayListener(name, handlerFn, sourceSpan) {
|
|
22991
|
-
return call(Identifiers.twoWayListener, [literal
|
|
23046
|
+
return call(Identifiers.twoWayListener, [literal(name), handlerFn], sourceSpan);
|
|
22992
23047
|
}
|
|
22993
23048
|
function pipe(slot, name) {
|
|
22994
|
-
return call(Identifiers.pipe, [literal
|
|
23049
|
+
return call(Identifiers.pipe, [literal(slot), literal(name)], null);
|
|
22995
23050
|
}
|
|
22996
23051
|
function namespaceHTML() {
|
|
22997
23052
|
return call(Identifiers.namespaceHTML, [], null);
|
|
@@ -23003,13 +23058,13 @@ function namespaceMath() {
|
|
|
23003
23058
|
return call(Identifiers.namespaceMathML, [], null);
|
|
23004
23059
|
}
|
|
23005
23060
|
function advance(delta, sourceSpan) {
|
|
23006
|
-
return call(Identifiers.advance, delta > 1 ? [literal
|
|
23061
|
+
return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
|
|
23007
23062
|
}
|
|
23008
23063
|
function reference(slot) {
|
|
23009
|
-
return importExpr(Identifiers.reference).callFn([literal
|
|
23064
|
+
return importExpr(Identifiers.reference).callFn([literal(slot)]);
|
|
23010
23065
|
}
|
|
23011
23066
|
function nextContext(steps) {
|
|
23012
|
-
return importExpr(Identifiers.nextContext).callFn(steps === 1 ? [] : [literal
|
|
23067
|
+
return importExpr(Identifiers.nextContext).callFn(steps === 1 ? [] : [literal(steps)]);
|
|
23013
23068
|
}
|
|
23014
23069
|
function getCurrentView() {
|
|
23015
23070
|
return importExpr(Identifiers.getCurrentView).callFn([]);
|
|
@@ -23021,24 +23076,24 @@ function resetView(returnValue) {
|
|
|
23021
23076
|
return importExpr(Identifiers.resetView).callFn([returnValue]);
|
|
23022
23077
|
}
|
|
23023
23078
|
function text(slot, initialValue, sourceSpan) {
|
|
23024
|
-
const args = [literal
|
|
23079
|
+
const args = [literal(slot, null)];
|
|
23025
23080
|
if (initialValue !== '') {
|
|
23026
|
-
args.push(literal
|
|
23081
|
+
args.push(literal(initialValue));
|
|
23027
23082
|
}
|
|
23028
23083
|
return call(Identifiers.text, args, sourceSpan);
|
|
23029
23084
|
}
|
|
23030
23085
|
function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan, flags) {
|
|
23031
23086
|
const args = [
|
|
23032
|
-
literal
|
|
23033
|
-
literal
|
|
23034
|
-
dependencyResolverFn ?? literal
|
|
23035
|
-
literal
|
|
23036
|
-
literal
|
|
23037
|
-
literal
|
|
23038
|
-
loadingConfig ?? literal
|
|
23039
|
-
placeholderConfig ?? literal
|
|
23040
|
-
enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal
|
|
23041
|
-
literal
|
|
23087
|
+
literal(selfSlot),
|
|
23088
|
+
literal(primarySlot),
|
|
23089
|
+
dependencyResolverFn ?? literal(null),
|
|
23090
|
+
literal(loadingSlot),
|
|
23091
|
+
literal(placeholderSlot),
|
|
23092
|
+
literal(errorSlot),
|
|
23093
|
+
loadingConfig ?? literal(null),
|
|
23094
|
+
placeholderConfig ?? literal(null),
|
|
23095
|
+
enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal(null),
|
|
23096
|
+
literal(flags),
|
|
23042
23097
|
];
|
|
23043
23098
|
let expr;
|
|
23044
23099
|
while ((expr = args[args.length - 1]) !== null &&
|
|
@@ -23111,45 +23166,45 @@ function deferOn(trigger, args, modifier, sourceSpan) {
|
|
|
23111
23166
|
if (instructionToCall === undefined) {
|
|
23112
23167
|
throw new Error(`Unable to determine instruction for trigger ${trigger}`);
|
|
23113
23168
|
}
|
|
23114
|
-
return call(instructionToCall, args.map((a) => literal
|
|
23169
|
+
return call(instructionToCall, args.map((a) => literal(a)), sourceSpan);
|
|
23115
23170
|
}
|
|
23116
23171
|
function projectionDef(def) {
|
|
23117
23172
|
return call(Identifiers.projectionDef, def ? [def] : [], null);
|
|
23118
23173
|
}
|
|
23119
23174
|
function projection(slot, projectionSlotIndex, attributes, fallbackFnName, fallbackDecls, fallbackVars, sourceSpan) {
|
|
23120
|
-
const args = [literal
|
|
23175
|
+
const args = [literal(slot)];
|
|
23121
23176
|
if (projectionSlotIndex !== 0 || attributes !== null || fallbackFnName !== null) {
|
|
23122
|
-
args.push(literal
|
|
23177
|
+
args.push(literal(projectionSlotIndex));
|
|
23123
23178
|
if (attributes !== null) {
|
|
23124
23179
|
args.push(attributes);
|
|
23125
23180
|
}
|
|
23126
23181
|
if (fallbackFnName !== null) {
|
|
23127
23182
|
if (attributes === null) {
|
|
23128
|
-
args.push(literal
|
|
23183
|
+
args.push(literal(null));
|
|
23129
23184
|
}
|
|
23130
|
-
args.push(variable(fallbackFnName), literal
|
|
23185
|
+
args.push(variable(fallbackFnName), literal(fallbackDecls), literal(fallbackVars));
|
|
23131
23186
|
}
|
|
23132
23187
|
}
|
|
23133
23188
|
return call(Identifiers.projection, args, sourceSpan);
|
|
23134
23189
|
}
|
|
23135
23190
|
function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
23136
|
-
const args = [literal
|
|
23191
|
+
const args = [literal(slot), literal(constIndex)];
|
|
23137
23192
|
if (subTemplateIndex !== null) {
|
|
23138
|
-
args.push(literal
|
|
23193
|
+
args.push(literal(subTemplateIndex));
|
|
23139
23194
|
}
|
|
23140
23195
|
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
23141
23196
|
}
|
|
23142
23197
|
function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
23143
23198
|
const args = [
|
|
23144
|
-
literal
|
|
23199
|
+
literal(slot),
|
|
23145
23200
|
templateFnRef,
|
|
23146
|
-
literal
|
|
23147
|
-
literal
|
|
23148
|
-
literal
|
|
23149
|
-
literal
|
|
23201
|
+
literal(decls),
|
|
23202
|
+
literal(vars),
|
|
23203
|
+
literal(tag),
|
|
23204
|
+
literal(constIndex),
|
|
23150
23205
|
];
|
|
23151
23206
|
if (localRefs !== null) {
|
|
23152
|
-
args.push(literal
|
|
23207
|
+
args.push(literal(localRefs));
|
|
23153
23208
|
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
23154
23209
|
}
|
|
23155
23210
|
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
@@ -23159,15 +23214,15 @@ function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, lo
|
|
|
23159
23214
|
}
|
|
23160
23215
|
function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
23161
23216
|
const args = [
|
|
23162
|
-
literal
|
|
23217
|
+
literal(slot),
|
|
23163
23218
|
templateFnRef,
|
|
23164
|
-
literal
|
|
23165
|
-
literal
|
|
23166
|
-
literal
|
|
23167
|
-
literal
|
|
23219
|
+
literal(decls),
|
|
23220
|
+
literal(vars),
|
|
23221
|
+
literal(tag),
|
|
23222
|
+
literal(constIndex),
|
|
23168
23223
|
];
|
|
23169
23224
|
if (localRefs !== null) {
|
|
23170
|
-
args.push(literal
|
|
23225
|
+
args.push(literal(localRefs));
|
|
23171
23226
|
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
23172
23227
|
}
|
|
23173
23228
|
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
@@ -23177,23 +23232,23 @@ function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constInd
|
|
|
23177
23232
|
}
|
|
23178
23233
|
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
23179
23234
|
const args = [
|
|
23180
|
-
literal
|
|
23235
|
+
literal(slot),
|
|
23181
23236
|
variable(viewFnName),
|
|
23182
|
-
literal
|
|
23183
|
-
literal
|
|
23184
|
-
literal
|
|
23185
|
-
literal
|
|
23237
|
+
literal(decls),
|
|
23238
|
+
literal(vars),
|
|
23239
|
+
literal(tag),
|
|
23240
|
+
literal(constIndex),
|
|
23186
23241
|
trackByFn,
|
|
23187
23242
|
];
|
|
23188
23243
|
if (trackByUsesComponentInstance || emptyViewFnName !== null) {
|
|
23189
|
-
args.push(literal
|
|
23244
|
+
args.push(literal(trackByUsesComponentInstance));
|
|
23190
23245
|
if (emptyViewFnName !== null) {
|
|
23191
|
-
args.push(variable(emptyViewFnName), literal
|
|
23246
|
+
args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
|
|
23192
23247
|
if (emptyTag !== null || emptyConstIndex !== null) {
|
|
23193
|
-
args.push(literal
|
|
23248
|
+
args.push(literal(emptyTag));
|
|
23194
23249
|
}
|
|
23195
23250
|
if (emptyConstIndex !== null) {
|
|
23196
|
-
args.push(literal
|
|
23251
|
+
args.push(literal(emptyConstIndex));
|
|
23197
23252
|
}
|
|
23198
23253
|
}
|
|
23199
23254
|
}
|
|
@@ -23212,18 +23267,18 @@ function deferWhen(modifier, expr, sourceSpan) {
|
|
|
23212
23267
|
return call(Identifiers.deferWhen, [expr], sourceSpan);
|
|
23213
23268
|
}
|
|
23214
23269
|
function declareLet(slot, sourceSpan) {
|
|
23215
|
-
return call(Identifiers.declareLet, [literal
|
|
23270
|
+
return call(Identifiers.declareLet, [literal(slot)], sourceSpan);
|
|
23216
23271
|
}
|
|
23217
23272
|
function storeLet(value, sourceSpan) {
|
|
23218
23273
|
return importExpr(Identifiers.storeLet).callFn([value], sourceSpan);
|
|
23219
23274
|
}
|
|
23220
23275
|
function readContextLet(slot) {
|
|
23221
|
-
return importExpr(Identifiers.readContextLet).callFn([literal
|
|
23276
|
+
return importExpr(Identifiers.readContextLet).callFn([literal(slot)]);
|
|
23222
23277
|
}
|
|
23223
23278
|
function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
23224
|
-
const args = [literal
|
|
23279
|
+
const args = [literal(slot), literal(constIndex)];
|
|
23225
23280
|
if (subTemplateIndex) {
|
|
23226
|
-
args.push(literal
|
|
23281
|
+
args.push(literal(subTemplateIndex));
|
|
23227
23282
|
}
|
|
23228
23283
|
return call(Identifiers.i18n, args, sourceSpan);
|
|
23229
23284
|
}
|
|
@@ -23231,21 +23286,21 @@ function i18nEnd(endSourceSpan) {
|
|
|
23231
23286
|
return call(Identifiers.i18nEnd, [], endSourceSpan);
|
|
23232
23287
|
}
|
|
23233
23288
|
function i18nAttributes(slot, i18nAttributesConfig) {
|
|
23234
|
-
const args = [literal
|
|
23289
|
+
const args = [literal(slot), literal(i18nAttributesConfig)];
|
|
23235
23290
|
return call(Identifiers.i18nAttributes, args, null);
|
|
23236
23291
|
}
|
|
23237
23292
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
23238
23293
|
return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
|
|
23239
23294
|
}
|
|
23240
23295
|
function twoWayProperty(name, expression, sanitizer, sourceSpan) {
|
|
23241
|
-
const args = [literal
|
|
23296
|
+
const args = [literal(name), expression];
|
|
23242
23297
|
if (sanitizer !== null) {
|
|
23243
23298
|
args.push(sanitizer);
|
|
23244
23299
|
}
|
|
23245
23300
|
return call(Identifiers.twoWayProperty, args, sourceSpan);
|
|
23246
23301
|
}
|
|
23247
23302
|
function attribute(name, expression, sanitizer, namespace, sourceSpan) {
|
|
23248
|
-
const args = [literal
|
|
23303
|
+
const args = [literal(name)];
|
|
23249
23304
|
if (expression instanceof Interpolation) {
|
|
23250
23305
|
args.push(interpolationToExpression(expression, sourceSpan));
|
|
23251
23306
|
}
|
|
@@ -23253,15 +23308,15 @@ function attribute(name, expression, sanitizer, namespace, sourceSpan) {
|
|
|
23253
23308
|
args.push(expression);
|
|
23254
23309
|
}
|
|
23255
23310
|
if (sanitizer !== null || namespace !== null) {
|
|
23256
|
-
args.push(sanitizer ?? literal
|
|
23311
|
+
args.push(sanitizer ?? literal(null));
|
|
23257
23312
|
}
|
|
23258
23313
|
if (namespace !== null) {
|
|
23259
|
-
args.push(literal
|
|
23314
|
+
args.push(literal(namespace));
|
|
23260
23315
|
}
|
|
23261
23316
|
return call(Identifiers.attribute, args, null);
|
|
23262
23317
|
}
|
|
23263
23318
|
function styleProp(name, expression, unit, sourceSpan) {
|
|
23264
|
-
const args = [literal
|
|
23319
|
+
const args = [literal(name)];
|
|
23265
23320
|
if (expression instanceof Interpolation) {
|
|
23266
23321
|
args.push(interpolationToExpression(expression, sourceSpan));
|
|
23267
23322
|
}
|
|
@@ -23269,12 +23324,12 @@ function styleProp(name, expression, unit, sourceSpan) {
|
|
|
23269
23324
|
args.push(expression);
|
|
23270
23325
|
}
|
|
23271
23326
|
if (unit !== null) {
|
|
23272
|
-
args.push(literal
|
|
23327
|
+
args.push(literal(unit));
|
|
23273
23328
|
}
|
|
23274
23329
|
return call(Identifiers.styleProp, args, sourceSpan);
|
|
23275
23330
|
}
|
|
23276
23331
|
function classProp(name, expression, sourceSpan) {
|
|
23277
|
-
return call(Identifiers.classProp, [literal
|
|
23332
|
+
return call(Identifiers.classProp, [literal(name), expression], sourceSpan);
|
|
23278
23333
|
}
|
|
23279
23334
|
function styleMap(expression, sourceSpan) {
|
|
23280
23335
|
const value = expression instanceof Interpolation
|
|
@@ -23309,7 +23364,7 @@ function domElementContainerEnd() {
|
|
|
23309
23364
|
return call(Identifiers.domElementContainerEnd, [], null);
|
|
23310
23365
|
}
|
|
23311
23366
|
function domListener(name, handlerFn, eventTargetResolver, sourceSpan) {
|
|
23312
|
-
const args = [literal
|
|
23367
|
+
const args = [literal(name), handlerFn];
|
|
23313
23368
|
if (eventTargetResolver !== null) {
|
|
23314
23369
|
args.push(importExpr(eventTargetResolver));
|
|
23315
23370
|
}
|
|
@@ -23329,10 +23384,10 @@ function pipeBind(slot, varOffset, args) {
|
|
|
23329
23384
|
throw new Error(`pipeBind() argument count out of bounds`);
|
|
23330
23385
|
}
|
|
23331
23386
|
const instruction = PIPE_BINDINGS[args.length - 1];
|
|
23332
|
-
return importExpr(instruction).callFn([literal
|
|
23387
|
+
return importExpr(instruction).callFn([literal(slot), literal(varOffset), ...args]);
|
|
23333
23388
|
}
|
|
23334
23389
|
function pipeBindV(slot, varOffset, args) {
|
|
23335
|
-
return importExpr(Identifiers.pipeBindV).callFn([literal
|
|
23390
|
+
return importExpr(Identifiers.pipeBindV).callFn([literal(slot), literal(varOffset), args]);
|
|
23336
23391
|
}
|
|
23337
23392
|
function textInterpolate(strings, expressions, sourceSpan) {
|
|
23338
23393
|
const interpolationArgs = collateInterpolationArgs(strings, expressions);
|
|
@@ -23342,19 +23397,19 @@ function i18nExp(expr, sourceSpan) {
|
|
|
23342
23397
|
return call(Identifiers.i18nExp, [expr], sourceSpan);
|
|
23343
23398
|
}
|
|
23344
23399
|
function i18nApply(slot, sourceSpan) {
|
|
23345
|
-
return call(Identifiers.i18nApply, [literal
|
|
23400
|
+
return call(Identifiers.i18nApply, [literal(slot)], sourceSpan);
|
|
23346
23401
|
}
|
|
23347
23402
|
function domProperty(name, expression, sanitizer, sourceSpan) {
|
|
23348
23403
|
return propertyBase(Identifiers.domProperty, name, expression, sanitizer, sourceSpan);
|
|
23349
23404
|
}
|
|
23350
23405
|
function syntheticHostProperty(name, expression, sourceSpan) {
|
|
23351
|
-
return call(Identifiers.syntheticHostProperty, [literal
|
|
23406
|
+
return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
|
|
23352
23407
|
}
|
|
23353
23408
|
function pureFunction(varOffset, fn, args) {
|
|
23354
|
-
return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal
|
|
23409
|
+
return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal(varOffset), fn], args, [], null);
|
|
23355
23410
|
}
|
|
23356
23411
|
function attachSourceLocation(templatePath, locations) {
|
|
23357
|
-
return call(Identifiers.attachSourceLocations, [literal
|
|
23412
|
+
return call(Identifiers.attachSourceLocations, [literal(templatePath), locations], null);
|
|
23358
23413
|
}
|
|
23359
23414
|
/**
|
|
23360
23415
|
* Collates the string an expression arguments for an interpolation instruction.
|
|
@@ -23370,10 +23425,10 @@ function collateInterpolationArgs(strings, expressions) {
|
|
|
23370
23425
|
else {
|
|
23371
23426
|
let idx;
|
|
23372
23427
|
for (idx = 0; idx < expressions.length; idx++) {
|
|
23373
|
-
interpolationArgs.push(literal
|
|
23428
|
+
interpolationArgs.push(literal(strings[idx]), expressions[idx]);
|
|
23374
23429
|
}
|
|
23375
23430
|
// idx points at the last string.
|
|
23376
|
-
interpolationArgs.push(literal
|
|
23431
|
+
interpolationArgs.push(literal(strings[idx]));
|
|
23377
23432
|
}
|
|
23378
23433
|
return interpolationArgs;
|
|
23379
23434
|
}
|
|
@@ -23488,6 +23543,18 @@ const GLOBAL_TARGET_RESOLVERS = new Map([
|
|
|
23488
23543
|
['document', Identifiers.resolveDocument],
|
|
23489
23544
|
['body', Identifiers.resolveBody],
|
|
23490
23545
|
]);
|
|
23546
|
+
/**
|
|
23547
|
+
* DOM properties that need to be remapped on the compiler side.
|
|
23548
|
+
* Note: this mapping has to be kept in sync with the equally named mapping in the runtime.
|
|
23549
|
+
*/
|
|
23550
|
+
const DOM_PROPERTY_REMAPPING = new Map([
|
|
23551
|
+
['class', 'className'],
|
|
23552
|
+
['for', 'htmlFor'],
|
|
23553
|
+
['formaction', 'formAction'],
|
|
23554
|
+
['innerHtml', 'innerHTML'],
|
|
23555
|
+
['readonly', 'readOnly'],
|
|
23556
|
+
['tabindex', 'tabIndex'],
|
|
23557
|
+
]);
|
|
23491
23558
|
/**
|
|
23492
23559
|
* Compiles semantic operations across all views and generates output `o.Statement`s with actual
|
|
23493
23560
|
* runtime calls in their place.
|
|
@@ -23735,10 +23802,10 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23735
23802
|
throw new Error('No slot was assigned for source location');
|
|
23736
23803
|
}
|
|
23737
23804
|
return literalArr([
|
|
23738
|
-
literal
|
|
23739
|
-
literal
|
|
23740
|
-
literal
|
|
23741
|
-
literal
|
|
23805
|
+
literal(targetSlot.slot),
|
|
23806
|
+
literal(offset),
|
|
23807
|
+
literal(line),
|
|
23808
|
+
literal(column),
|
|
23742
23809
|
]);
|
|
23743
23810
|
}));
|
|
23744
23811
|
OpList.replace(op, attachSourceLocation(op.templatePath, locationsLiteral));
|
|
@@ -23760,7 +23827,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23760
23827
|
break;
|
|
23761
23828
|
case OpKind.Property:
|
|
23762
23829
|
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.isLegacyAnimationTrigger
|
|
23763
|
-
? domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23830
|
+
? domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23764
23831
|
: property(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23765
23832
|
break;
|
|
23766
23833
|
case OpKind.TwoWayProperty:
|
|
@@ -23799,7 +23866,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23799
23866
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23800
23867
|
}
|
|
23801
23868
|
else {
|
|
23802
|
-
OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23869
|
+
OpList.replace(op, domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23803
23870
|
}
|
|
23804
23871
|
}
|
|
23805
23872
|
break;
|
|
@@ -23880,7 +23947,7 @@ function reifyIrExpression(expr) {
|
|
|
23880
23947
|
case ExpressionKind.PipeBindingVariadic:
|
|
23881
23948
|
return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
|
|
23882
23949
|
case ExpressionKind.SlotLiteralExpr:
|
|
23883
|
-
return literal
|
|
23950
|
+
return literal(expr.slot.slot);
|
|
23884
23951
|
case ExpressionKind.ContextLetReference:
|
|
23885
23952
|
return readContextLet(expr.targetSlot.slot);
|
|
23886
23953
|
case ExpressionKind.StoreLet:
|
|
@@ -24014,7 +24081,7 @@ function removeIllegalLetReferences(job) {
|
|
|
24014
24081
|
const name = op.variable.identifier;
|
|
24015
24082
|
let current = op;
|
|
24016
24083
|
while (current && current.kind !== OpKind.ListEnd) {
|
|
24017
|
-
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal
|
|
24084
|
+
transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
|
|
24018
24085
|
current = current.prev;
|
|
24019
24086
|
}
|
|
24020
24087
|
}
|
|
@@ -25952,7 +26019,7 @@ function maybeGenerateRfBlock(flag, statements) {
|
|
|
25952
26019
|
return [];
|
|
25953
26020
|
}
|
|
25954
26021
|
return [
|
|
25955
|
-
ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable('rf'), literal
|
|
26022
|
+
ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable('rf'), literal(flag)), statements),
|
|
25956
26023
|
];
|
|
25957
26024
|
}
|
|
25958
26025
|
function emitHostBindingFunction(job) {
|
|
@@ -26200,7 +26267,7 @@ function ingestContent(unit, content) {
|
|
|
26200
26267
|
const op = createProjectionOp(id, content.selector, content.i18n, fallbackView?.xref ?? null, content.sourceSpan);
|
|
26201
26268
|
for (const attr of content.attributes) {
|
|
26202
26269
|
const securityContext = domSchema.securityContext(content.name, attr.name, true);
|
|
26203
|
-
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal
|
|
26270
|
+
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
26204
26271
|
}
|
|
26205
26272
|
unit.create.push(op);
|
|
26206
26273
|
}
|
|
@@ -26526,13 +26593,13 @@ function getComputedForLoopVariableExpression(variable, indexName, countName) {
|
|
|
26526
26593
|
case '$count':
|
|
26527
26594
|
return new LexicalReadExpr(countName);
|
|
26528
26595
|
case '$first':
|
|
26529
|
-
return new LexicalReadExpr(indexName).identical(literal
|
|
26596
|
+
return new LexicalReadExpr(indexName).identical(literal(0));
|
|
26530
26597
|
case '$last':
|
|
26531
|
-
return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal
|
|
26598
|
+
return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)));
|
|
26532
26599
|
case '$even':
|
|
26533
|
-
return new LexicalReadExpr(indexName).modulo(literal
|
|
26600
|
+
return new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0));
|
|
26534
26601
|
case '$odd':
|
|
26535
|
-
return new LexicalReadExpr(indexName).modulo(literal
|
|
26602
|
+
return new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0));
|
|
26536
26603
|
default:
|
|
26537
26604
|
throw new Error(`AssertionError: unknown @for loop variable ${variable.value}`);
|
|
26538
26605
|
}
|
|
@@ -26568,7 +26635,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
26568
26635
|
}
|
|
26569
26636
|
}
|
|
26570
26637
|
else if (ast instanceof LiteralPrimitive) {
|
|
26571
|
-
return literal
|
|
26638
|
+
return literal(ast.value, undefined, convertSourceSpan(ast.span, baseSourceSpan));
|
|
26572
26639
|
}
|
|
26573
26640
|
else if (ast instanceof Unary) {
|
|
26574
26641
|
switch (ast.operator) {
|
|
@@ -26581,7 +26648,7 @@ function convertAst(ast, job, baseSourceSpan) {
|
|
|
26581
26648
|
}
|
|
26582
26649
|
}
|
|
26583
26650
|
else if (ast instanceof Binary) {
|
|
26584
|
-
const operator = BINARY_OPERATORS$
|
|
26651
|
+
const operator = BINARY_OPERATORS$1.get(ast.operation);
|
|
26585
26652
|
if (operator === undefined) {
|
|
26586
26653
|
throw new Error(`AssertionError: unknown binary operator ${ast.operation}`);
|
|
26587
26654
|
}
|
|
@@ -26674,7 +26741,7 @@ function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
|
|
|
26674
26741
|
expression = convertAst(value, job, null);
|
|
26675
26742
|
}
|
|
26676
26743
|
else {
|
|
26677
|
-
expression = literal
|
|
26744
|
+
expression = literal(value);
|
|
26678
26745
|
}
|
|
26679
26746
|
return expression;
|
|
26680
26747
|
}
|
|
@@ -27017,7 +27084,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
27017
27084
|
// Collect the static attributes for content projection purposes.
|
|
27018
27085
|
for (const attr of root.attributes) {
|
|
27019
27086
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
27020
|
-
unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal
|
|
27087
|
+
unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
27021
27088
|
}
|
|
27022
27089
|
// Also collect the inputs since they participate in content projection as well.
|
|
27023
27090
|
// Note that TDB used to collect the outputs as well, but it wasn't passing them into
|
|
@@ -27057,7 +27124,7 @@ function getTemplateSourceLocationsEnabled() {
|
|
|
27057
27124
|
|
|
27058
27125
|
// if (rf & flags) { .. }
|
|
27059
27126
|
function renderFlagCheckIfStmt(flags, statements) {
|
|
27060
|
-
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal
|
|
27127
|
+
return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null), statements);
|
|
27061
27128
|
}
|
|
27062
27129
|
/**
|
|
27063
27130
|
* Translates query flags into `TQueryFlags` type in
|
|
@@ -27076,7 +27143,7 @@ function getQueryPredicate(query, constantPool) {
|
|
|
27076
27143
|
// Each item in predicates array may contain strings with comma-separated refs
|
|
27077
27144
|
// (for ex. 'ref, ref1, ..., refN'), thus we extract individual refs and store them
|
|
27078
27145
|
// as separate array entities
|
|
27079
|
-
const selectors = selector.split(',').map((token) => literal
|
|
27146
|
+
const selectors = selector.split(',').map((token) => literal(token.trim()));
|
|
27080
27147
|
predicate.push(...selectors);
|
|
27081
27148
|
});
|
|
27082
27149
|
return constantPool.getConstLiteral(literalArr(predicate), true);
|
|
@@ -27100,7 +27167,7 @@ function createQueryCreateCall(query, constantPool, queryTypeFns, prependParams)
|
|
|
27100
27167
|
if (query.isSignal) {
|
|
27101
27168
|
parameters.push(new ReadPropExpr(variable(CONTEXT_NAME), query.propertyName));
|
|
27102
27169
|
}
|
|
27103
|
-
parameters.push(getQueryPredicate(query, constantPool), literal
|
|
27170
|
+
parameters.push(getQueryPredicate(query, constantPool), literal(toQueryFlags(query)));
|
|
27104
27171
|
if (query.read) {
|
|
27105
27172
|
parameters.push(query.read);
|
|
27106
27173
|
}
|
|
@@ -27137,7 +27204,7 @@ function collapseAdvanceStatements(statements) {
|
|
|
27137
27204
|
const flushAdvanceCount = () => {
|
|
27138
27205
|
if (advanceCollapseCount > 0) {
|
|
27139
27206
|
result.unshift(importExpr(Identifiers.queryAdvance)
|
|
27140
|
-
.callFn(advanceCollapseCount === 1 ? [] : [literal
|
|
27207
|
+
.callFn(advanceCollapseCount === 1 ? [] : [literal(advanceCollapseCount)])
|
|
27141
27208
|
.toStmt());
|
|
27142
27209
|
advanceCollapseCount = 0;
|
|
27143
27210
|
}
|
|
@@ -28841,7 +28908,7 @@ class HtmlAstToIvyAst {
|
|
|
28841
28908
|
}
|
|
28842
28909
|
else {
|
|
28843
28910
|
const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
|
|
28844
|
-
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
|
|
28911
|
+
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
28845
28912
|
}
|
|
28846
28913
|
if (elementHasInlineTemplate) {
|
|
28847
28914
|
// If this node is an inline-template (e.g. has *ngFor) then we need to create a template
|
|
@@ -29347,7 +29414,7 @@ class NonBindableVisitor {
|
|
|
29347
29414
|
/* inputs */ [],
|
|
29348
29415
|
/* outputs */ [],
|
|
29349
29416
|
/* directives */ [], children,
|
|
29350
|
-
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29417
|
+
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.isVoid);
|
|
29351
29418
|
}
|
|
29352
29419
|
visitComment(comment) {
|
|
29353
29420
|
return null;
|
|
@@ -29388,7 +29455,7 @@ class NonBindableVisitor {
|
|
|
29388
29455
|
/* inputs */ [],
|
|
29389
29456
|
/* outputs */ [],
|
|
29390
29457
|
/* directives */ [], children,
|
|
29391
|
-
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
|
|
29458
|
+
/* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, false);
|
|
29392
29459
|
}
|
|
29393
29460
|
visitDirective(directive, context) {
|
|
29394
29461
|
return null;
|
|
@@ -29558,13 +29625,13 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
29558
29625
|
// e.g 'outputs: {a: 'a'}`
|
|
29559
29626
|
definitionMap.set('outputs', conditionallyCreateDirectiveBindingLiteral(meta.outputs));
|
|
29560
29627
|
if (meta.exportAs !== null) {
|
|
29561
|
-
definitionMap.set('exportAs', literalArr(meta.exportAs.map((e) => literal
|
|
29628
|
+
definitionMap.set('exportAs', literalArr(meta.exportAs.map((e) => literal(e))));
|
|
29562
29629
|
}
|
|
29563
29630
|
if (meta.isStandalone === false) {
|
|
29564
|
-
definitionMap.set('standalone', literal
|
|
29631
|
+
definitionMap.set('standalone', literal(false));
|
|
29565
29632
|
}
|
|
29566
29633
|
if (meta.isSignal) {
|
|
29567
|
-
definitionMap.set('signals', literal
|
|
29634
|
+
definitionMap.set('signals', literal(true));
|
|
29568
29635
|
}
|
|
29569
29636
|
return definitionMap;
|
|
29570
29637
|
}
|
|
@@ -29599,7 +29666,7 @@ function addFeatures(definitionMap, meta) {
|
|
|
29599
29666
|
features.push(importExpr(Identifiers.NgOnChangesFeature));
|
|
29600
29667
|
}
|
|
29601
29668
|
if ('externalStyles' in meta && meta.externalStyles?.length) {
|
|
29602
|
-
const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal
|
|
29669
|
+
const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal(externalStyle));
|
|
29603
29670
|
features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
|
|
29604
29671
|
}
|
|
29605
29672
|
if (features.length) {
|
|
@@ -29630,7 +29697,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
29630
29697
|
if (firstSelector) {
|
|
29631
29698
|
const selectorAttributes = firstSelector.getAttrs();
|
|
29632
29699
|
if (selectorAttributes.length) {
|
|
29633
|
-
definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map((value) => value != null ? literal
|
|
29700
|
+
definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map((value) => value != null ? literal(value) : literal(undefined))),
|
|
29634
29701
|
/* forceShared */ true));
|
|
29635
29702
|
}
|
|
29636
29703
|
}
|
|
@@ -29655,8 +29722,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
29655
29722
|
if (tpl.contentSelectors !== null) {
|
|
29656
29723
|
definitionMap.set('ngContentSelectors', tpl.contentSelectors);
|
|
29657
29724
|
}
|
|
29658
|
-
definitionMap.set('decls', literal
|
|
29659
|
-
definitionMap.set('vars', literal
|
|
29725
|
+
definitionMap.set('decls', literal(tpl.root.decls));
|
|
29726
|
+
definitionMap.set('vars', literal(tpl.root.vars));
|
|
29660
29727
|
if (tpl.consts.length > 0) {
|
|
29661
29728
|
if (tpl.constsInitializers.length > 0) {
|
|
29662
29729
|
definitionMap.set('consts', arrowFn([], [...tpl.constsInitializers, new ReturnStatement(literalArr(tpl.consts))]));
|
|
@@ -29688,7 +29755,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
29688
29755
|
: meta.styles;
|
|
29689
29756
|
const styleNodes = styleValues.reduce((result, style) => {
|
|
29690
29757
|
if (style.trim().length > 0) {
|
|
29691
|
-
result.push(constantPool.getConstLiteral(literal
|
|
29758
|
+
result.push(constantPool.getConstLiteral(literal(style)));
|
|
29692
29759
|
}
|
|
29693
29760
|
return result;
|
|
29694
29761
|
}, []);
|
|
@@ -29703,7 +29770,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
29703
29770
|
}
|
|
29704
29771
|
// Only set view encapsulation if it's not the default value
|
|
29705
29772
|
if (meta.encapsulation !== exports.ViewEncapsulation.Emulated) {
|
|
29706
|
-
definitionMap.set('encapsulation', literal
|
|
29773
|
+
definitionMap.set('encapsulation', literal(meta.encapsulation));
|
|
29707
29774
|
}
|
|
29708
29775
|
// e.g. `animation: [trigger('123', [])]`
|
|
29709
29776
|
if (meta.animations !== null) {
|
|
@@ -29714,7 +29781,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
29714
29781
|
if (typeof meta.changeDetection === 'number' &&
|
|
29715
29782
|
meta.changeDetection !== exports.ChangeDetectionStrategy.Default) {
|
|
29716
29783
|
// changeDetection is resolved during analysis. Only set it if not the default.
|
|
29717
|
-
definitionMap.set('changeDetection', literal
|
|
29784
|
+
definitionMap.set('changeDetection', literal(meta.changeDetection));
|
|
29718
29785
|
}
|
|
29719
29786
|
else if (typeof meta.changeDetection === 'object') {
|
|
29720
29787
|
// changeDetection is not resolved during analysis (e.g., we are in local compilation mode).
|
|
@@ -29734,13 +29801,13 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
29734
29801
|
function createComponentType(meta) {
|
|
29735
29802
|
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
29736
29803
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
|
29737
|
-
typeParams.push(expressionType(literal
|
|
29804
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
29738
29805
|
typeParams.push(createHostDirectivesType(meta));
|
|
29739
29806
|
// TODO(signals): Always include this metadata starting with v17. Right
|
|
29740
29807
|
// now Angular v16.0.x does not support this field and library distributions
|
|
29741
29808
|
// would then be incompatible with v16.0.x framework users.
|
|
29742
29809
|
if (meta.isSignal) {
|
|
29743
|
-
typeParams.push(expressionType(literal
|
|
29810
|
+
typeParams.push(expressionType(literal(meta.isSignal)));
|
|
29744
29811
|
}
|
|
29745
29812
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
|
29746
29813
|
}
|
|
@@ -29765,14 +29832,14 @@ function compileDeclarationList(list, mode) {
|
|
|
29765
29832
|
}
|
|
29766
29833
|
}
|
|
29767
29834
|
function stringAsType(str) {
|
|
29768
|
-
return expressionType(literal
|
|
29835
|
+
return expressionType(literal(str));
|
|
29769
29836
|
}
|
|
29770
29837
|
function stringMapAsLiteralExpression(map) {
|
|
29771
29838
|
const mapValues = Object.keys(map).map((key) => {
|
|
29772
29839
|
const value = Array.isArray(map[key]) ? map[key][0] : map[key];
|
|
29773
29840
|
return {
|
|
29774
29841
|
key,
|
|
29775
|
-
value: literal
|
|
29842
|
+
value: literal(value),
|
|
29776
29843
|
quoted: true,
|
|
29777
29844
|
};
|
|
29778
29845
|
});
|
|
@@ -29780,7 +29847,7 @@ function stringMapAsLiteralExpression(map) {
|
|
|
29780
29847
|
}
|
|
29781
29848
|
function stringArrayAsType(arr) {
|
|
29782
29849
|
return arr.length > 0
|
|
29783
|
-
? expressionType(literalArr(arr.map((value) => literal
|
|
29850
|
+
? expressionType(literalArr(arr.map((value) => literal(value))))
|
|
29784
29851
|
: NONE_TYPE;
|
|
29785
29852
|
}
|
|
29786
29853
|
function createBaseDirectiveTypeParams(meta) {
|
|
@@ -29800,13 +29867,13 @@ function getInputsTypeExpression(meta) {
|
|
|
29800
29867
|
return literalMap(Object.keys(meta.inputs).map((key) => {
|
|
29801
29868
|
const value = meta.inputs[key];
|
|
29802
29869
|
const values = [
|
|
29803
|
-
{ key: 'alias', value: literal
|
|
29804
|
-
{ key: 'required', value: literal
|
|
29870
|
+
{ key: 'alias', value: literal(value.bindingPropertyName), quoted: true },
|
|
29871
|
+
{ key: 'required', value: literal(value.required), quoted: true },
|
|
29805
29872
|
];
|
|
29806
29873
|
// TODO(legacy-partial-output-inputs): Consider always emitting this information,
|
|
29807
29874
|
// or leaving it as is.
|
|
29808
29875
|
if (value.isSignal) {
|
|
29809
|
-
values.push({ key: 'isSignal', value: literal
|
|
29876
|
+
values.push({ key: 'isSignal', value: literal(value.isSignal), quoted: true });
|
|
29810
29877
|
}
|
|
29811
29878
|
return { key, value: literalMap(values), quoted: true };
|
|
29812
29879
|
}));
|
|
@@ -29820,13 +29887,13 @@ function createDirectiveType(meta) {
|
|
|
29820
29887
|
// Directives have no NgContentSelectors slot, but instead express a `never` type
|
|
29821
29888
|
// so that future fields align.
|
|
29822
29889
|
typeParams.push(NONE_TYPE);
|
|
29823
|
-
typeParams.push(expressionType(literal
|
|
29890
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
29824
29891
|
typeParams.push(createHostDirectivesType(meta));
|
|
29825
29892
|
// TODO(signals): Always include this metadata starting with v17. Right
|
|
29826
29893
|
// now Angular v16.0.x does not support this field and library distributions
|
|
29827
29894
|
// would then be incompatible with v16.0.x framework users.
|
|
29828
29895
|
if (meta.isSignal) {
|
|
29829
|
-
typeParams.push(expressionType(literal
|
|
29896
|
+
typeParams.push(expressionType(literal(meta.isSignal)));
|
|
29830
29897
|
}
|
|
29831
29898
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
|
29832
29899
|
}
|
|
@@ -29840,10 +29907,10 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29840
29907
|
// actually already handle these special attributes internally. Therefore, we just drop them
|
|
29841
29908
|
// into the attributes map.
|
|
29842
29909
|
if (hostBindingsMetadata.specialAttributes.styleAttr) {
|
|
29843
|
-
hostBindingsMetadata.attributes['style'] = literal
|
|
29910
|
+
hostBindingsMetadata.attributes['style'] = literal(hostBindingsMetadata.specialAttributes.styleAttr);
|
|
29844
29911
|
}
|
|
29845
29912
|
if (hostBindingsMetadata.specialAttributes.classAttr) {
|
|
29846
|
-
hostBindingsMetadata.attributes['class'] = literal
|
|
29913
|
+
hostBindingsMetadata.attributes['class'] = literal(hostBindingsMetadata.specialAttributes.classAttr);
|
|
29847
29914
|
}
|
|
29848
29915
|
const hostJob = ingestHostBinding({
|
|
29849
29916
|
componentName: name,
|
|
@@ -29856,7 +29923,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
29856
29923
|
definitionMap.set('hostAttrs', hostJob.root.attributes);
|
|
29857
29924
|
const varCount = hostJob.root.vars;
|
|
29858
29925
|
if (varCount !== null && varCount > 0) {
|
|
29859
|
-
definitionMap.set('hostVars', literal
|
|
29926
|
+
definitionMap.set('hostVars', literal(varCount));
|
|
29860
29927
|
}
|
|
29861
29928
|
return emitHostBindingFunction(hostJob);
|
|
29862
29929
|
}
|
|
@@ -29887,7 +29954,7 @@ function parseHostBindings(host) {
|
|
|
29887
29954
|
break;
|
|
29888
29955
|
default:
|
|
29889
29956
|
if (typeof value === 'string') {
|
|
29890
|
-
attributes[key] = literal
|
|
29957
|
+
attributes[key] = literal(value);
|
|
29891
29958
|
}
|
|
29892
29959
|
else {
|
|
29893
29960
|
attributes[key] = value;
|
|
@@ -30001,7 +30068,7 @@ function createHostDirectivesMappingArray(mapping) {
|
|
|
30001
30068
|
const elements = [];
|
|
30002
30069
|
for (const publicName in mapping) {
|
|
30003
30070
|
if (mapping.hasOwnProperty(publicName)) {
|
|
30004
|
-
elements.push(literal
|
|
30071
|
+
elements.push(literal(publicName), literal(mapping[publicName]));
|
|
30005
30072
|
}
|
|
30006
30073
|
}
|
|
30007
30074
|
return elements.length > 0 ? literalArr(elements) : null;
|
|
@@ -31554,7 +31621,7 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
|
|
|
31554
31621
|
// If the dep is an `@Attribute()` the `attributeNameType` ought to be the `unknown` type.
|
|
31555
31622
|
// But types are not available at runtime so we just use a literal `"<unknown>"` string as a dummy
|
|
31556
31623
|
// marker.
|
|
31557
|
-
const attributeNameType = isAttributeDep ? literal
|
|
31624
|
+
const attributeNameType = isAttributeDep ? literal('unknown') : null;
|
|
31558
31625
|
return { token, attributeNameType, host, optional, self, skipSelf };
|
|
31559
31626
|
}
|
|
31560
31627
|
function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
|
|
@@ -31795,7 +31862,7 @@ class _Visitor {
|
|
|
31795
31862
|
this._init(_VisitorMode.Merge, interpolationConfig);
|
|
31796
31863
|
this._translations = translations;
|
|
31797
31864
|
// Construct a single fake root element
|
|
31798
|
-
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined);
|
|
31865
|
+
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined, false);
|
|
31799
31866
|
const translatedNode = wrapper.visit(this, null);
|
|
31800
31867
|
if (this._inI18nBlock) {
|
|
31801
31868
|
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
|
|
@@ -31973,7 +32040,7 @@ class _Visitor {
|
|
|
31973
32040
|
this._inImplicitNode = wasInImplicitNode;
|
|
31974
32041
|
if (this._mode === _VisitorMode.Merge) {
|
|
31975
32042
|
if (node instanceof Element) {
|
|
31976
|
-
return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
32043
|
+
return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.isVoid);
|
|
31977
32044
|
}
|
|
31978
32045
|
else {
|
|
31979
32046
|
return new Component(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
|
|
@@ -32204,7 +32271,7 @@ function isAttrNode(ast) {
|
|
|
32204
32271
|
* @description
|
|
32205
32272
|
* Entry point for all public APIs of the compiler package.
|
|
32206
32273
|
*/
|
|
32207
|
-
new Version('20.1.
|
|
32274
|
+
new Version('20.1.1');
|
|
32208
32275
|
|
|
32209
32276
|
//////////////////////////////////////
|
|
32210
32277
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
@@ -33224,8 +33291,11 @@ class NodeJSPathManipulation {
|
|
|
33224
33291
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
33225
33292
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
33226
33293
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
33227
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-
|
|
33228
|
-
|
|
33294
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-CwUJ2eKt.cjs', document.baseURI).href));
|
|
33295
|
+
// Note, when this code loads in the browser, `url` may be an empty `{}` due to the Closure shims.
|
|
33296
|
+
const currentFileName = isCommonJS
|
|
33297
|
+
? __filename
|
|
33298
|
+
: (url__namespace.fileURLToPath?.(currentFileUrl) ?? null);
|
|
33229
33299
|
/**
|
|
33230
33300
|
* A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
|
|
33231
33301
|
*/
|
|
@@ -33235,7 +33305,10 @@ class NodeJSReadonlyFileSystem extends NodeJSPathManipulation {
|
|
|
33235
33305
|
if (this._caseSensitive === undefined) {
|
|
33236
33306
|
// Note the use of the real file-system is intentional:
|
|
33237
33307
|
// `this.exists()` relies upon `isCaseSensitive()` so that would cause an infinite recursion.
|
|
33238
|
-
this._caseSensitive =
|
|
33308
|
+
this._caseSensitive =
|
|
33309
|
+
currentFileName !== null
|
|
33310
|
+
? !fs$1.existsSync(this.normalize(toggleCase(currentFileName)))
|
|
33311
|
+
: true;
|
|
33239
33312
|
}
|
|
33240
33313
|
return this._caseSensitive;
|
|
33241
33314
|
}
|
|
@@ -36518,790 +36591,6 @@ function getContainerNode(node) {
|
|
|
36518
36591
|
return node.getSourceFile();
|
|
36519
36592
|
}
|
|
36520
36593
|
|
|
36521
|
-
class ArraySliceBuiltinFn extends KnownFn {
|
|
36522
|
-
lhs;
|
|
36523
|
-
constructor(lhs) {
|
|
36524
|
-
super();
|
|
36525
|
-
this.lhs = lhs;
|
|
36526
|
-
}
|
|
36527
|
-
evaluate(node, args) {
|
|
36528
|
-
if (args.length === 0) {
|
|
36529
|
-
return this.lhs;
|
|
36530
|
-
}
|
|
36531
|
-
else {
|
|
36532
|
-
return DynamicValue.fromUnknown(node);
|
|
36533
|
-
}
|
|
36534
|
-
}
|
|
36535
|
-
}
|
|
36536
|
-
class ArrayConcatBuiltinFn extends KnownFn {
|
|
36537
|
-
lhs;
|
|
36538
|
-
constructor(lhs) {
|
|
36539
|
-
super();
|
|
36540
|
-
this.lhs = lhs;
|
|
36541
|
-
}
|
|
36542
|
-
evaluate(node, args) {
|
|
36543
|
-
const result = [...this.lhs];
|
|
36544
|
-
for (const arg of args) {
|
|
36545
|
-
if (arg instanceof DynamicValue) {
|
|
36546
|
-
result.push(DynamicValue.fromDynamicInput(node, arg));
|
|
36547
|
-
}
|
|
36548
|
-
else if (Array.isArray(arg)) {
|
|
36549
|
-
result.push(...arg);
|
|
36550
|
-
}
|
|
36551
|
-
else {
|
|
36552
|
-
result.push(arg);
|
|
36553
|
-
}
|
|
36554
|
-
}
|
|
36555
|
-
return result;
|
|
36556
|
-
}
|
|
36557
|
-
}
|
|
36558
|
-
class StringConcatBuiltinFn extends KnownFn {
|
|
36559
|
-
lhs;
|
|
36560
|
-
constructor(lhs) {
|
|
36561
|
-
super();
|
|
36562
|
-
this.lhs = lhs;
|
|
36563
|
-
}
|
|
36564
|
-
evaluate(node, args) {
|
|
36565
|
-
let result = this.lhs;
|
|
36566
|
-
for (const arg of args) {
|
|
36567
|
-
const resolved = arg instanceof EnumValue ? arg.resolved : arg;
|
|
36568
|
-
if (typeof resolved === 'string' ||
|
|
36569
|
-
typeof resolved === 'number' ||
|
|
36570
|
-
typeof resolved === 'boolean' ||
|
|
36571
|
-
resolved == null) {
|
|
36572
|
-
// Cast to `any`, because `concat` will convert
|
|
36573
|
-
// anything to a string, but TS only allows strings.
|
|
36574
|
-
result = result.concat(resolved);
|
|
36575
|
-
}
|
|
36576
|
-
else {
|
|
36577
|
-
return DynamicValue.fromUnknown(node);
|
|
36578
|
-
}
|
|
36579
|
-
}
|
|
36580
|
-
return result;
|
|
36581
|
-
}
|
|
36582
|
-
}
|
|
36583
|
-
|
|
36584
|
-
/**
|
|
36585
|
-
* A value produced which originated in a `ForeignFunctionResolver` and doesn't come from the
|
|
36586
|
-
* template itself.
|
|
36587
|
-
*
|
|
36588
|
-
* Synthetic values cannot be further evaluated, and attempts to do so produce `DynamicValue`s
|
|
36589
|
-
* instead.
|
|
36590
|
-
*/
|
|
36591
|
-
class SyntheticValue {
|
|
36592
|
-
value;
|
|
36593
|
-
constructor(value) {
|
|
36594
|
-
this.value = value;
|
|
36595
|
-
}
|
|
36596
|
-
}
|
|
36597
|
-
|
|
36598
|
-
function literalBinaryOp(op) {
|
|
36599
|
-
return { op, literal: true };
|
|
36600
|
-
}
|
|
36601
|
-
function referenceBinaryOp(op) {
|
|
36602
|
-
return { op, literal: false };
|
|
36603
|
-
}
|
|
36604
|
-
const BINARY_OPERATORS$2 = new Map([
|
|
36605
|
-
[ts.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
|
|
36606
|
-
[ts.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
|
|
36607
|
-
[ts.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
|
|
36608
|
-
[ts.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
|
|
36609
|
-
[ts.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
|
|
36610
|
-
[ts.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
|
|
36611
|
-
[ts.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
|
|
36612
|
-
[ts.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
|
|
36613
|
-
[ts.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
|
|
36614
|
-
[ts.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
|
|
36615
|
-
[ts.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
|
|
36616
|
-
[ts.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
|
|
36617
|
-
[ts.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
|
|
36618
|
-
[ts.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
|
|
36619
|
-
[ts.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
|
|
36620
|
-
[ts.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
|
|
36621
|
-
[ts.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
|
|
36622
|
-
[ts.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
|
|
36623
|
-
[ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
|
|
36624
|
-
[ts.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
|
|
36625
|
-
[ts.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
|
|
36626
|
-
[ts.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)],
|
|
36627
|
-
]);
|
|
36628
|
-
const UNARY_OPERATORS$2 = new Map([
|
|
36629
|
-
[ts.SyntaxKind.TildeToken, (a) => ~a],
|
|
36630
|
-
[ts.SyntaxKind.MinusToken, (a) => -a],
|
|
36631
|
-
[ts.SyntaxKind.PlusToken, (a) => +a],
|
|
36632
|
-
[ts.SyntaxKind.ExclamationToken, (a) => !a],
|
|
36633
|
-
]);
|
|
36634
|
-
class StaticInterpreter {
|
|
36635
|
-
host;
|
|
36636
|
-
checker;
|
|
36637
|
-
dependencyTracker;
|
|
36638
|
-
constructor(host, checker, dependencyTracker) {
|
|
36639
|
-
this.host = host;
|
|
36640
|
-
this.checker = checker;
|
|
36641
|
-
this.dependencyTracker = dependencyTracker;
|
|
36642
|
-
}
|
|
36643
|
-
visit(node, context) {
|
|
36644
|
-
return this.visitExpression(node, context);
|
|
36645
|
-
}
|
|
36646
|
-
visitExpression(node, context) {
|
|
36647
|
-
let result;
|
|
36648
|
-
if (node.kind === ts.SyntaxKind.TrueKeyword) {
|
|
36649
|
-
return true;
|
|
36650
|
-
}
|
|
36651
|
-
else if (node.kind === ts.SyntaxKind.FalseKeyword) {
|
|
36652
|
-
return false;
|
|
36653
|
-
}
|
|
36654
|
-
else if (node.kind === ts.SyntaxKind.NullKeyword) {
|
|
36655
|
-
return null;
|
|
36656
|
-
}
|
|
36657
|
-
else if (ts.isStringLiteral(node)) {
|
|
36658
|
-
return node.text;
|
|
36659
|
-
}
|
|
36660
|
-
else if (ts.isNoSubstitutionTemplateLiteral(node)) {
|
|
36661
|
-
return node.text;
|
|
36662
|
-
}
|
|
36663
|
-
else if (ts.isTemplateExpression(node)) {
|
|
36664
|
-
result = this.visitTemplateExpression(node, context);
|
|
36665
|
-
}
|
|
36666
|
-
else if (ts.isNumericLiteral(node)) {
|
|
36667
|
-
return parseFloat(node.text);
|
|
36668
|
-
}
|
|
36669
|
-
else if (ts.isObjectLiteralExpression(node)) {
|
|
36670
|
-
result = this.visitObjectLiteralExpression(node, context);
|
|
36671
|
-
}
|
|
36672
|
-
else if (ts.isIdentifier(node)) {
|
|
36673
|
-
result = this.visitIdentifier(node, context);
|
|
36674
|
-
}
|
|
36675
|
-
else if (ts.isPropertyAccessExpression(node)) {
|
|
36676
|
-
result = this.visitPropertyAccessExpression(node, context);
|
|
36677
|
-
}
|
|
36678
|
-
else if (ts.isCallExpression(node)) {
|
|
36679
|
-
result = this.visitCallExpression(node, context);
|
|
36680
|
-
}
|
|
36681
|
-
else if (ts.isConditionalExpression(node)) {
|
|
36682
|
-
result = this.visitConditionalExpression(node, context);
|
|
36683
|
-
}
|
|
36684
|
-
else if (ts.isPrefixUnaryExpression(node)) {
|
|
36685
|
-
result = this.visitPrefixUnaryExpression(node, context);
|
|
36686
|
-
}
|
|
36687
|
-
else if (ts.isBinaryExpression(node)) {
|
|
36688
|
-
result = this.visitBinaryExpression(node, context);
|
|
36689
|
-
}
|
|
36690
|
-
else if (ts.isArrayLiteralExpression(node)) {
|
|
36691
|
-
result = this.visitArrayLiteralExpression(node, context);
|
|
36692
|
-
}
|
|
36693
|
-
else if (ts.isParenthesizedExpression(node)) {
|
|
36694
|
-
result = this.visitParenthesizedExpression(node, context);
|
|
36695
|
-
}
|
|
36696
|
-
else if (ts.isElementAccessExpression(node)) {
|
|
36697
|
-
result = this.visitElementAccessExpression(node, context);
|
|
36698
|
-
}
|
|
36699
|
-
else if (ts.isAsExpression(node)) {
|
|
36700
|
-
result = this.visitExpression(node.expression, context);
|
|
36701
|
-
}
|
|
36702
|
-
else if (ts.isNonNullExpression(node)) {
|
|
36703
|
-
result = this.visitExpression(node.expression, context);
|
|
36704
|
-
}
|
|
36705
|
-
else if (this.host.isClass(node)) {
|
|
36706
|
-
result = this.visitDeclaration(node, context);
|
|
36707
|
-
}
|
|
36708
|
-
else {
|
|
36709
|
-
return DynamicValue.fromUnsupportedSyntax(node);
|
|
36710
|
-
}
|
|
36711
|
-
if (result instanceof DynamicValue && result.node !== node) {
|
|
36712
|
-
return DynamicValue.fromDynamicInput(node, result);
|
|
36713
|
-
}
|
|
36714
|
-
return result;
|
|
36715
|
-
}
|
|
36716
|
-
visitArrayLiteralExpression(node, context) {
|
|
36717
|
-
const array = [];
|
|
36718
|
-
for (let i = 0; i < node.elements.length; i++) {
|
|
36719
|
-
const element = node.elements[i];
|
|
36720
|
-
if (ts.isSpreadElement(element)) {
|
|
36721
|
-
array.push(...this.visitSpreadElement(element, context));
|
|
36722
|
-
}
|
|
36723
|
-
else {
|
|
36724
|
-
array.push(this.visitExpression(element, context));
|
|
36725
|
-
}
|
|
36726
|
-
}
|
|
36727
|
-
return array;
|
|
36728
|
-
}
|
|
36729
|
-
visitObjectLiteralExpression(node, context) {
|
|
36730
|
-
const map = new Map();
|
|
36731
|
-
for (let i = 0; i < node.properties.length; i++) {
|
|
36732
|
-
const property = node.properties[i];
|
|
36733
|
-
if (ts.isPropertyAssignment(property)) {
|
|
36734
|
-
const name = this.stringNameFromPropertyName(property.name, context);
|
|
36735
|
-
// Check whether the name can be determined statically.
|
|
36736
|
-
if (name === undefined) {
|
|
36737
|
-
return DynamicValue.fromDynamicInput(node, DynamicValue.fromDynamicString(property.name));
|
|
36738
|
-
}
|
|
36739
|
-
map.set(name, this.visitExpression(property.initializer, context));
|
|
36740
|
-
}
|
|
36741
|
-
else if (ts.isShorthandPropertyAssignment(property)) {
|
|
36742
|
-
const symbol = this.checker.getShorthandAssignmentValueSymbol(property);
|
|
36743
|
-
if (symbol === undefined || symbol.valueDeclaration === undefined) {
|
|
36744
|
-
map.set(property.name.text, DynamicValue.fromUnknown(property));
|
|
36745
|
-
}
|
|
36746
|
-
else {
|
|
36747
|
-
map.set(property.name.text, this.visitDeclaration(symbol.valueDeclaration, context));
|
|
36748
|
-
}
|
|
36749
|
-
}
|
|
36750
|
-
else if (ts.isSpreadAssignment(property)) {
|
|
36751
|
-
const spread = this.visitExpression(property.expression, context);
|
|
36752
|
-
if (spread instanceof DynamicValue) {
|
|
36753
|
-
return DynamicValue.fromDynamicInput(node, spread);
|
|
36754
|
-
}
|
|
36755
|
-
else if (spread instanceof Map) {
|
|
36756
|
-
spread.forEach((value, key) => map.set(key, value));
|
|
36757
|
-
}
|
|
36758
|
-
else if (spread instanceof ResolvedModule) {
|
|
36759
|
-
spread.getExports().forEach((value, key) => map.set(key, value));
|
|
36760
|
-
}
|
|
36761
|
-
else {
|
|
36762
|
-
return DynamicValue.fromDynamicInput(node, DynamicValue.fromInvalidExpressionType(property, spread));
|
|
36763
|
-
}
|
|
36764
|
-
}
|
|
36765
|
-
else {
|
|
36766
|
-
return DynamicValue.fromUnknown(node);
|
|
36767
|
-
}
|
|
36768
|
-
}
|
|
36769
|
-
return map;
|
|
36770
|
-
}
|
|
36771
|
-
visitTemplateExpression(node, context) {
|
|
36772
|
-
const pieces = [node.head.text];
|
|
36773
|
-
for (let i = 0; i < node.templateSpans.length; i++) {
|
|
36774
|
-
const span = node.templateSpans[i];
|
|
36775
|
-
const value = literal(this.visit(span.expression, context), () => DynamicValue.fromDynamicString(span.expression));
|
|
36776
|
-
if (value instanceof DynamicValue) {
|
|
36777
|
-
return DynamicValue.fromDynamicInput(node, value);
|
|
36778
|
-
}
|
|
36779
|
-
pieces.push(`${value}`, span.literal.text);
|
|
36780
|
-
}
|
|
36781
|
-
return pieces.join('');
|
|
36782
|
-
}
|
|
36783
|
-
visitIdentifier(node, context) {
|
|
36784
|
-
const decl = this.host.getDeclarationOfIdentifier(node);
|
|
36785
|
-
if (decl === null) {
|
|
36786
|
-
if (ts.identifierToKeywordKind(node) === ts.SyntaxKind.UndefinedKeyword) {
|
|
36787
|
-
return undefined;
|
|
36788
|
-
}
|
|
36789
|
-
else {
|
|
36790
|
-
// Check if the symbol here is imported.
|
|
36791
|
-
if (this.dependencyTracker !== null && this.host.getImportOfIdentifier(node) !== null) {
|
|
36792
|
-
// It was, but no declaration for the node could be found. This means that the dependency
|
|
36793
|
-
// graph for the current file cannot be properly updated to account for this (broken)
|
|
36794
|
-
// import. Instead, the originating file is reported as failing dependency analysis,
|
|
36795
|
-
// ensuring that future compilations will always attempt to re-resolve the previously
|
|
36796
|
-
// broken identifier.
|
|
36797
|
-
this.dependencyTracker.recordDependencyAnalysisFailure(context.originatingFile);
|
|
36798
|
-
}
|
|
36799
|
-
return DynamicValue.fromUnknownIdentifier(node);
|
|
36800
|
-
}
|
|
36801
|
-
}
|
|
36802
|
-
const declContext = { ...context, ...joinModuleContext(context, node, decl) };
|
|
36803
|
-
const result = this.visitDeclaration(decl.node, declContext);
|
|
36804
|
-
if (result instanceof Reference) {
|
|
36805
|
-
// Only record identifiers to non-synthetic references. Synthetic references may not have the
|
|
36806
|
-
// same value at runtime as they do at compile time, so it's not legal to refer to them by the
|
|
36807
|
-
// identifier here.
|
|
36808
|
-
if (!result.synthetic) {
|
|
36809
|
-
result.addIdentifier(node);
|
|
36810
|
-
}
|
|
36811
|
-
}
|
|
36812
|
-
else if (result instanceof DynamicValue) {
|
|
36813
|
-
return DynamicValue.fromDynamicInput(node, result);
|
|
36814
|
-
}
|
|
36815
|
-
return result;
|
|
36816
|
-
}
|
|
36817
|
-
visitDeclaration(node, context) {
|
|
36818
|
-
if (this.dependencyTracker !== null) {
|
|
36819
|
-
this.dependencyTracker.addDependency(context.originatingFile, node.getSourceFile());
|
|
36820
|
-
}
|
|
36821
|
-
if (this.host.isClass(node)) {
|
|
36822
|
-
return this.getReference(node, context);
|
|
36823
|
-
}
|
|
36824
|
-
else if (ts.isVariableDeclaration(node)) {
|
|
36825
|
-
return this.visitVariableDeclaration(node, context);
|
|
36826
|
-
}
|
|
36827
|
-
else if (ts.isParameter(node) && context.scope.has(node)) {
|
|
36828
|
-
return context.scope.get(node);
|
|
36829
|
-
}
|
|
36830
|
-
else if (ts.isExportAssignment(node)) {
|
|
36831
|
-
return this.visitExpression(node.expression, context);
|
|
36832
|
-
}
|
|
36833
|
-
else if (ts.isEnumDeclaration(node)) {
|
|
36834
|
-
return this.visitEnumDeclaration(node, context);
|
|
36835
|
-
}
|
|
36836
|
-
else if (ts.isSourceFile(node)) {
|
|
36837
|
-
return this.visitSourceFile(node, context);
|
|
36838
|
-
}
|
|
36839
|
-
else if (ts.isBindingElement(node)) {
|
|
36840
|
-
return this.visitBindingElement(node, context);
|
|
36841
|
-
}
|
|
36842
|
-
else {
|
|
36843
|
-
return this.getReference(node, context);
|
|
36844
|
-
}
|
|
36845
|
-
}
|
|
36846
|
-
visitVariableDeclaration(node, context) {
|
|
36847
|
-
const value = this.host.getVariableValue(node);
|
|
36848
|
-
if (value !== null) {
|
|
36849
|
-
return this.visitExpression(value, context);
|
|
36850
|
-
}
|
|
36851
|
-
else if (isVariableDeclarationDeclared(node)) {
|
|
36852
|
-
// If the declaration has a literal type that can be statically reduced to a value, resolve to
|
|
36853
|
-
// that value. If not, the historical behavior for variable declarations is to return a
|
|
36854
|
-
// `Reference` to the variable, as the consumer could use it in a context where knowing its
|
|
36855
|
-
// static value is not necessary.
|
|
36856
|
-
//
|
|
36857
|
-
// Arguably, since the value cannot be statically determined, we should return a
|
|
36858
|
-
// `DynamicValue`. This returns a `Reference` because it's the same behavior as before
|
|
36859
|
-
// `visitType` was introduced.
|
|
36860
|
-
//
|
|
36861
|
-
// TODO(zarend): investigate switching to a `DynamicValue` and verify this won't break any
|
|
36862
|
-
// use cases, especially in ngcc
|
|
36863
|
-
if (node.type !== undefined) {
|
|
36864
|
-
const evaluatedType = this.visitType(node.type, context);
|
|
36865
|
-
if (!(evaluatedType instanceof DynamicValue)) {
|
|
36866
|
-
return evaluatedType;
|
|
36867
|
-
}
|
|
36868
|
-
}
|
|
36869
|
-
return this.getReference(node, context);
|
|
36870
|
-
}
|
|
36871
|
-
else {
|
|
36872
|
-
return undefined;
|
|
36873
|
-
}
|
|
36874
|
-
}
|
|
36875
|
-
visitEnumDeclaration(node, context) {
|
|
36876
|
-
const enumRef = this.getReference(node, context);
|
|
36877
|
-
const map = new Map();
|
|
36878
|
-
node.members.forEach((member, index) => {
|
|
36879
|
-
const name = this.stringNameFromPropertyName(member.name, context);
|
|
36880
|
-
if (name !== undefined) {
|
|
36881
|
-
const resolved = member.initializer ? this.visit(member.initializer, context) : index;
|
|
36882
|
-
map.set(name, new EnumValue(enumRef, name, resolved));
|
|
36883
|
-
}
|
|
36884
|
-
});
|
|
36885
|
-
return map;
|
|
36886
|
-
}
|
|
36887
|
-
visitElementAccessExpression(node, context) {
|
|
36888
|
-
const lhs = this.visitExpression(node.expression, context);
|
|
36889
|
-
if (lhs instanceof DynamicValue) {
|
|
36890
|
-
return DynamicValue.fromDynamicInput(node, lhs);
|
|
36891
|
-
}
|
|
36892
|
-
const rhs = this.visitExpression(node.argumentExpression, context);
|
|
36893
|
-
if (rhs instanceof DynamicValue) {
|
|
36894
|
-
return DynamicValue.fromDynamicInput(node, rhs);
|
|
36895
|
-
}
|
|
36896
|
-
if (typeof rhs !== 'string' && typeof rhs !== 'number') {
|
|
36897
|
-
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
36898
|
-
}
|
|
36899
|
-
return this.accessHelper(node, lhs, rhs, context);
|
|
36900
|
-
}
|
|
36901
|
-
visitPropertyAccessExpression(node, context) {
|
|
36902
|
-
const lhs = this.visitExpression(node.expression, context);
|
|
36903
|
-
const rhs = node.name.text;
|
|
36904
|
-
// TODO: handle reference to class declaration.
|
|
36905
|
-
if (lhs instanceof DynamicValue) {
|
|
36906
|
-
return DynamicValue.fromDynamicInput(node, lhs);
|
|
36907
|
-
}
|
|
36908
|
-
return this.accessHelper(node, lhs, rhs, context);
|
|
36909
|
-
}
|
|
36910
|
-
visitSourceFile(node, context) {
|
|
36911
|
-
const declarations = this.host.getExportsOfModule(node);
|
|
36912
|
-
if (declarations === null) {
|
|
36913
|
-
return DynamicValue.fromUnknown(node);
|
|
36914
|
-
}
|
|
36915
|
-
return new ResolvedModule(declarations, (decl) => {
|
|
36916
|
-
const declContext = {
|
|
36917
|
-
...context,
|
|
36918
|
-
...joinModuleContext(context, node, decl),
|
|
36919
|
-
};
|
|
36920
|
-
// Visit both concrete and inline declarations.
|
|
36921
|
-
return this.visitDeclaration(decl.node, declContext);
|
|
36922
|
-
});
|
|
36923
|
-
}
|
|
36924
|
-
accessHelper(node, lhs, rhs, context) {
|
|
36925
|
-
const strIndex = `${rhs}`;
|
|
36926
|
-
if (lhs instanceof Map) {
|
|
36927
|
-
if (lhs.has(strIndex)) {
|
|
36928
|
-
return lhs.get(strIndex);
|
|
36929
|
-
}
|
|
36930
|
-
else {
|
|
36931
|
-
return undefined;
|
|
36932
|
-
}
|
|
36933
|
-
}
|
|
36934
|
-
else if (lhs instanceof ResolvedModule) {
|
|
36935
|
-
return lhs.getExport(strIndex);
|
|
36936
|
-
}
|
|
36937
|
-
else if (Array.isArray(lhs)) {
|
|
36938
|
-
if (rhs === 'length') {
|
|
36939
|
-
return lhs.length;
|
|
36940
|
-
}
|
|
36941
|
-
else if (rhs === 'slice') {
|
|
36942
|
-
return new ArraySliceBuiltinFn(lhs);
|
|
36943
|
-
}
|
|
36944
|
-
else if (rhs === 'concat') {
|
|
36945
|
-
return new ArrayConcatBuiltinFn(lhs);
|
|
36946
|
-
}
|
|
36947
|
-
if (typeof rhs !== 'number' || !Number.isInteger(rhs)) {
|
|
36948
|
-
return DynamicValue.fromInvalidExpressionType(node, rhs);
|
|
36949
|
-
}
|
|
36950
|
-
return lhs[rhs];
|
|
36951
|
-
}
|
|
36952
|
-
else if (typeof lhs === 'string' && rhs === 'concat') {
|
|
36953
|
-
return new StringConcatBuiltinFn(lhs);
|
|
36954
|
-
}
|
|
36955
|
-
else if (lhs instanceof Reference) {
|
|
36956
|
-
const ref = lhs.node;
|
|
36957
|
-
if (this.host.isClass(ref)) {
|
|
36958
|
-
const module = owningModule(context, lhs.bestGuessOwningModule);
|
|
36959
|
-
let value = undefined;
|
|
36960
|
-
const member = this.host
|
|
36961
|
-
.getMembersOfClass(ref)
|
|
36962
|
-
.find((member) => member.isStatic && member.name === strIndex);
|
|
36963
|
-
if (member !== undefined) {
|
|
36964
|
-
if (member.value !== null) {
|
|
36965
|
-
value = this.visitExpression(member.value, context);
|
|
36966
|
-
}
|
|
36967
|
-
else if (member.implementation !== null) {
|
|
36968
|
-
value = new Reference(member.implementation, module);
|
|
36969
|
-
}
|
|
36970
|
-
else if (member.node) {
|
|
36971
|
-
value = new Reference(member.node, module);
|
|
36972
|
-
}
|
|
36973
|
-
}
|
|
36974
|
-
return value;
|
|
36975
|
-
}
|
|
36976
|
-
else if (isDeclaration(ref)) {
|
|
36977
|
-
return DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(ref, lhs));
|
|
36978
|
-
}
|
|
36979
|
-
}
|
|
36980
|
-
else if (lhs instanceof DynamicValue) {
|
|
36981
|
-
return DynamicValue.fromDynamicInput(node, lhs);
|
|
36982
|
-
}
|
|
36983
|
-
else if (lhs instanceof SyntheticValue) {
|
|
36984
|
-
return DynamicValue.fromSyntheticInput(node, lhs);
|
|
36985
|
-
}
|
|
36986
|
-
return DynamicValue.fromUnknown(node);
|
|
36987
|
-
}
|
|
36988
|
-
visitCallExpression(node, context) {
|
|
36989
|
-
const lhs = this.visitExpression(node.expression, context);
|
|
36990
|
-
if (lhs instanceof DynamicValue) {
|
|
36991
|
-
return DynamicValue.fromDynamicInput(node, lhs);
|
|
36992
|
-
}
|
|
36993
|
-
// If the call refers to a builtin function, attempt to evaluate the function.
|
|
36994
|
-
if (lhs instanceof KnownFn) {
|
|
36995
|
-
return lhs.evaluate(node, this.evaluateFunctionArguments(node, context));
|
|
36996
|
-
}
|
|
36997
|
-
if (!(lhs instanceof Reference)) {
|
|
36998
|
-
return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
|
|
36999
|
-
}
|
|
37000
|
-
const fn = this.host.getDefinitionOfFunction(lhs.node);
|
|
37001
|
-
if (fn === null) {
|
|
37002
|
-
return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
|
|
37003
|
-
}
|
|
37004
|
-
if (!isFunctionOrMethodReference(lhs)) {
|
|
37005
|
-
return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
|
|
37006
|
-
}
|
|
37007
|
-
const resolveFfrExpr = (expr) => {
|
|
37008
|
-
let contextExtension = {};
|
|
37009
|
-
// TODO(alxhub): the condition `fn.body === null` here is vestigial - we probably _do_ want to
|
|
37010
|
-
// change the context like this even for non-null function bodies. But, this is being
|
|
37011
|
-
// redesigned as a refactoring with no behavior changes so that should be done as a follow-up.
|
|
37012
|
-
if (fn.body === null &&
|
|
37013
|
-
expr.getSourceFile() !== node.expression.getSourceFile() &&
|
|
37014
|
-
lhs.bestGuessOwningModule !== null) {
|
|
37015
|
-
contextExtension = {
|
|
37016
|
-
absoluteModuleName: lhs.bestGuessOwningModule.specifier,
|
|
37017
|
-
resolutionContext: lhs.bestGuessOwningModule.resolutionContext,
|
|
37018
|
-
};
|
|
37019
|
-
}
|
|
37020
|
-
return this.visitFfrExpression(expr, { ...context, ...contextExtension });
|
|
37021
|
-
};
|
|
37022
|
-
// If the function is foreign (declared through a d.ts file), attempt to resolve it with the
|
|
37023
|
-
// foreignFunctionResolver, if one is specified.
|
|
37024
|
-
if (fn.body === null && context.foreignFunctionResolver !== undefined) {
|
|
37025
|
-
const unresolvable = DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
|
|
37026
|
-
return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
|
|
37027
|
-
}
|
|
37028
|
-
const res = this.visitFunctionBody(node, fn, context);
|
|
37029
|
-
// If the result of attempting to resolve the function body was a DynamicValue, attempt to use
|
|
37030
|
-
// the foreignFunctionResolver if one is present. This could still potentially yield a usable
|
|
37031
|
-
// value.
|
|
37032
|
-
if (res instanceof DynamicValue && context.foreignFunctionResolver !== undefined) {
|
|
37033
|
-
const unresolvable = DynamicValue.fromComplexFunctionCall(node, fn);
|
|
37034
|
-
return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
|
|
37035
|
-
}
|
|
37036
|
-
return res;
|
|
37037
|
-
}
|
|
37038
|
-
/**
|
|
37039
|
-
* Visit an expression which was extracted from a foreign-function resolver.
|
|
37040
|
-
*
|
|
37041
|
-
* This will process the result and ensure it's correct for FFR-resolved values, including marking
|
|
37042
|
-
* `Reference`s as synthetic.
|
|
37043
|
-
*/
|
|
37044
|
-
visitFfrExpression(expr, context) {
|
|
37045
|
-
const res = this.visitExpression(expr, context);
|
|
37046
|
-
if (res instanceof Reference) {
|
|
37047
|
-
// This Reference was created synthetically, via a foreign function resolver. The real
|
|
37048
|
-
// runtime value of the function expression may be different than the foreign function
|
|
37049
|
-
// resolved value, so mark the Reference as synthetic to avoid it being misinterpreted.
|
|
37050
|
-
res.synthetic = true;
|
|
37051
|
-
}
|
|
37052
|
-
return res;
|
|
37053
|
-
}
|
|
37054
|
-
visitFunctionBody(node, fn, context) {
|
|
37055
|
-
if (fn.body === null) {
|
|
37056
|
-
return DynamicValue.fromUnknown(node);
|
|
37057
|
-
}
|
|
37058
|
-
else if (fn.body.length !== 1 || !ts.isReturnStatement(fn.body[0])) {
|
|
37059
|
-
return DynamicValue.fromComplexFunctionCall(node, fn);
|
|
37060
|
-
}
|
|
37061
|
-
const ret = fn.body[0];
|
|
37062
|
-
const args = this.evaluateFunctionArguments(node, context);
|
|
37063
|
-
const newScope = new Map();
|
|
37064
|
-
const calleeContext = { ...context, scope: newScope };
|
|
37065
|
-
fn.parameters.forEach((param, index) => {
|
|
37066
|
-
let arg = args[index];
|
|
37067
|
-
if (param.node.dotDotDotToken !== undefined) {
|
|
37068
|
-
arg = args.slice(index);
|
|
37069
|
-
}
|
|
37070
|
-
if (arg === undefined && param.initializer !== null) {
|
|
37071
|
-
arg = this.visitExpression(param.initializer, calleeContext);
|
|
37072
|
-
}
|
|
37073
|
-
newScope.set(param.node, arg);
|
|
37074
|
-
});
|
|
37075
|
-
return ret.expression !== undefined
|
|
37076
|
-
? this.visitExpression(ret.expression, calleeContext)
|
|
37077
|
-
: undefined;
|
|
37078
|
-
}
|
|
37079
|
-
visitConditionalExpression(node, context) {
|
|
37080
|
-
const condition = this.visitExpression(node.condition, context);
|
|
37081
|
-
if (condition instanceof DynamicValue) {
|
|
37082
|
-
return DynamicValue.fromDynamicInput(node, condition);
|
|
37083
|
-
}
|
|
37084
|
-
if (condition) {
|
|
37085
|
-
return this.visitExpression(node.whenTrue, context);
|
|
37086
|
-
}
|
|
37087
|
-
else {
|
|
37088
|
-
return this.visitExpression(node.whenFalse, context);
|
|
37089
|
-
}
|
|
37090
|
-
}
|
|
37091
|
-
visitPrefixUnaryExpression(node, context) {
|
|
37092
|
-
const operatorKind = node.operator;
|
|
37093
|
-
if (!UNARY_OPERATORS$2.has(operatorKind)) {
|
|
37094
|
-
return DynamicValue.fromUnsupportedSyntax(node);
|
|
37095
|
-
}
|
|
37096
|
-
const op = UNARY_OPERATORS$2.get(operatorKind);
|
|
37097
|
-
const value = this.visitExpression(node.operand, context);
|
|
37098
|
-
if (value instanceof DynamicValue) {
|
|
37099
|
-
return DynamicValue.fromDynamicInput(node, value);
|
|
37100
|
-
}
|
|
37101
|
-
else {
|
|
37102
|
-
return op(value);
|
|
37103
|
-
}
|
|
37104
|
-
}
|
|
37105
|
-
visitBinaryExpression(node, context) {
|
|
37106
|
-
const tokenKind = node.operatorToken.kind;
|
|
37107
|
-
if (!BINARY_OPERATORS$2.has(tokenKind)) {
|
|
37108
|
-
return DynamicValue.fromUnsupportedSyntax(node);
|
|
37109
|
-
}
|
|
37110
|
-
const opRecord = BINARY_OPERATORS$2.get(tokenKind);
|
|
37111
|
-
let lhs, rhs;
|
|
37112
|
-
if (opRecord.literal) {
|
|
37113
|
-
lhs = literal(this.visitExpression(node.left, context), (value) => DynamicValue.fromInvalidExpressionType(node.left, value));
|
|
37114
|
-
rhs = literal(this.visitExpression(node.right, context), (value) => DynamicValue.fromInvalidExpressionType(node.right, value));
|
|
37115
|
-
}
|
|
37116
|
-
else {
|
|
37117
|
-
lhs = this.visitExpression(node.left, context);
|
|
37118
|
-
rhs = this.visitExpression(node.right, context);
|
|
37119
|
-
}
|
|
37120
|
-
if (lhs instanceof DynamicValue) {
|
|
37121
|
-
return DynamicValue.fromDynamicInput(node, lhs);
|
|
37122
|
-
}
|
|
37123
|
-
else if (rhs instanceof DynamicValue) {
|
|
37124
|
-
return DynamicValue.fromDynamicInput(node, rhs);
|
|
37125
|
-
}
|
|
37126
|
-
else {
|
|
37127
|
-
return opRecord.op(lhs, rhs);
|
|
37128
|
-
}
|
|
37129
|
-
}
|
|
37130
|
-
visitParenthesizedExpression(node, context) {
|
|
37131
|
-
return this.visitExpression(node.expression, context);
|
|
37132
|
-
}
|
|
37133
|
-
evaluateFunctionArguments(node, context) {
|
|
37134
|
-
const args = [];
|
|
37135
|
-
for (const arg of node.arguments) {
|
|
37136
|
-
if (ts.isSpreadElement(arg)) {
|
|
37137
|
-
args.push(...this.visitSpreadElement(arg, context));
|
|
37138
|
-
}
|
|
37139
|
-
else {
|
|
37140
|
-
args.push(this.visitExpression(arg, context));
|
|
37141
|
-
}
|
|
37142
|
-
}
|
|
37143
|
-
return args;
|
|
37144
|
-
}
|
|
37145
|
-
visitSpreadElement(node, context) {
|
|
37146
|
-
const spread = this.visitExpression(node.expression, context);
|
|
37147
|
-
if (spread instanceof DynamicValue) {
|
|
37148
|
-
return [DynamicValue.fromDynamicInput(node, spread)];
|
|
37149
|
-
}
|
|
37150
|
-
else if (!Array.isArray(spread)) {
|
|
37151
|
-
return [DynamicValue.fromInvalidExpressionType(node, spread)];
|
|
37152
|
-
}
|
|
37153
|
-
else {
|
|
37154
|
-
return spread;
|
|
37155
|
-
}
|
|
37156
|
-
}
|
|
37157
|
-
visitBindingElement(node, context) {
|
|
37158
|
-
const path = [];
|
|
37159
|
-
let closestDeclaration = node;
|
|
37160
|
-
while (ts.isBindingElement(closestDeclaration) ||
|
|
37161
|
-
ts.isArrayBindingPattern(closestDeclaration) ||
|
|
37162
|
-
ts.isObjectBindingPattern(closestDeclaration)) {
|
|
37163
|
-
if (ts.isBindingElement(closestDeclaration)) {
|
|
37164
|
-
path.unshift(closestDeclaration);
|
|
37165
|
-
}
|
|
37166
|
-
closestDeclaration = closestDeclaration.parent;
|
|
37167
|
-
}
|
|
37168
|
-
if (!ts.isVariableDeclaration(closestDeclaration) ||
|
|
37169
|
-
closestDeclaration.initializer === undefined) {
|
|
37170
|
-
return DynamicValue.fromUnknown(node);
|
|
37171
|
-
}
|
|
37172
|
-
let value = this.visit(closestDeclaration.initializer, context);
|
|
37173
|
-
for (const element of path) {
|
|
37174
|
-
let key;
|
|
37175
|
-
if (ts.isArrayBindingPattern(element.parent)) {
|
|
37176
|
-
key = element.parent.elements.indexOf(element);
|
|
37177
|
-
}
|
|
37178
|
-
else {
|
|
37179
|
-
const name = element.propertyName || element.name;
|
|
37180
|
-
if (ts.isIdentifier(name)) {
|
|
37181
|
-
key = name.text;
|
|
37182
|
-
}
|
|
37183
|
-
else {
|
|
37184
|
-
return DynamicValue.fromUnknown(element);
|
|
37185
|
-
}
|
|
37186
|
-
}
|
|
37187
|
-
value = this.accessHelper(element, value, key, context);
|
|
37188
|
-
if (value instanceof DynamicValue) {
|
|
37189
|
-
return value;
|
|
37190
|
-
}
|
|
37191
|
-
}
|
|
37192
|
-
return value;
|
|
37193
|
-
}
|
|
37194
|
-
stringNameFromPropertyName(node, context) {
|
|
37195
|
-
if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {
|
|
37196
|
-
return node.text;
|
|
37197
|
-
}
|
|
37198
|
-
else if (ts.isComputedPropertyName(node)) {
|
|
37199
|
-
const literal = this.visitExpression(node.expression, context);
|
|
37200
|
-
return typeof literal === 'string' ? literal : undefined;
|
|
37201
|
-
}
|
|
37202
|
-
else {
|
|
37203
|
-
return undefined;
|
|
37204
|
-
}
|
|
37205
|
-
}
|
|
37206
|
-
getReference(node, context) {
|
|
37207
|
-
return new Reference(node, owningModule(context));
|
|
37208
|
-
}
|
|
37209
|
-
visitType(node, context) {
|
|
37210
|
-
if (ts.isLiteralTypeNode(node)) {
|
|
37211
|
-
return this.visitExpression(node.literal, context);
|
|
37212
|
-
}
|
|
37213
|
-
else if (ts.isTupleTypeNode(node)) {
|
|
37214
|
-
return this.visitTupleType(node, context);
|
|
37215
|
-
}
|
|
37216
|
-
else if (ts.isNamedTupleMember(node)) {
|
|
37217
|
-
return this.visitType(node.type, context);
|
|
37218
|
-
}
|
|
37219
|
-
else if (ts.isTypeOperatorNode(node) && node.operator === ts.SyntaxKind.ReadonlyKeyword) {
|
|
37220
|
-
return this.visitType(node.type, context);
|
|
37221
|
-
}
|
|
37222
|
-
else if (ts.isTypeQueryNode(node)) {
|
|
37223
|
-
return this.visitTypeQuery(node, context);
|
|
37224
|
-
}
|
|
37225
|
-
return DynamicValue.fromDynamicType(node);
|
|
37226
|
-
}
|
|
37227
|
-
visitTupleType(node, context) {
|
|
37228
|
-
const res = [];
|
|
37229
|
-
for (const elem of node.elements) {
|
|
37230
|
-
res.push(this.visitType(elem, context));
|
|
37231
|
-
}
|
|
37232
|
-
return res;
|
|
37233
|
-
}
|
|
37234
|
-
visitTypeQuery(node, context) {
|
|
37235
|
-
if (!ts.isIdentifier(node.exprName)) {
|
|
37236
|
-
return DynamicValue.fromUnknown(node);
|
|
37237
|
-
}
|
|
37238
|
-
const decl = this.host.getDeclarationOfIdentifier(node.exprName);
|
|
37239
|
-
if (decl === null) {
|
|
37240
|
-
return DynamicValue.fromUnknownIdentifier(node.exprName);
|
|
37241
|
-
}
|
|
37242
|
-
const declContext = { ...context, ...joinModuleContext(context, node, decl) };
|
|
37243
|
-
return this.visitDeclaration(decl.node, declContext);
|
|
37244
|
-
}
|
|
37245
|
-
}
|
|
37246
|
-
function isFunctionOrMethodReference(ref) {
|
|
37247
|
-
return (ts.isFunctionDeclaration(ref.node) ||
|
|
37248
|
-
ts.isMethodDeclaration(ref.node) ||
|
|
37249
|
-
ts.isFunctionExpression(ref.node));
|
|
37250
|
-
}
|
|
37251
|
-
function literal(value, reject) {
|
|
37252
|
-
if (value instanceof EnumValue) {
|
|
37253
|
-
value = value.resolved;
|
|
37254
|
-
}
|
|
37255
|
-
if (value instanceof DynamicValue ||
|
|
37256
|
-
value === null ||
|
|
37257
|
-
value === undefined ||
|
|
37258
|
-
typeof value === 'string' ||
|
|
37259
|
-
typeof value === 'number' ||
|
|
37260
|
-
typeof value === 'boolean') {
|
|
37261
|
-
return value;
|
|
37262
|
-
}
|
|
37263
|
-
return reject(value);
|
|
37264
|
-
}
|
|
37265
|
-
function isVariableDeclarationDeclared(node) {
|
|
37266
|
-
if (node.parent === undefined || !ts.isVariableDeclarationList(node.parent)) {
|
|
37267
|
-
return false;
|
|
37268
|
-
}
|
|
37269
|
-
const declList = node.parent;
|
|
37270
|
-
if (declList.parent === undefined || !ts.isVariableStatement(declList.parent)) {
|
|
37271
|
-
return false;
|
|
37272
|
-
}
|
|
37273
|
-
const varStmt = declList.parent;
|
|
37274
|
-
const modifiers = ts.getModifiers(varStmt);
|
|
37275
|
-
return (modifiers !== undefined && modifiers.some((mod) => mod.kind === ts.SyntaxKind.DeclareKeyword));
|
|
37276
|
-
}
|
|
37277
|
-
const EMPTY = {};
|
|
37278
|
-
function joinModuleContext(existing, node, decl) {
|
|
37279
|
-
if (typeof decl.viaModule === 'string' && decl.viaModule !== existing.absoluteModuleName) {
|
|
37280
|
-
return {
|
|
37281
|
-
absoluteModuleName: decl.viaModule,
|
|
37282
|
-
resolutionContext: node.getSourceFile().fileName,
|
|
37283
|
-
};
|
|
37284
|
-
}
|
|
37285
|
-
else {
|
|
37286
|
-
return EMPTY;
|
|
37287
|
-
}
|
|
37288
|
-
}
|
|
37289
|
-
function owningModule(context, override = null) {
|
|
37290
|
-
let specifier = context.absoluteModuleName;
|
|
37291
|
-
if (override !== null) {
|
|
37292
|
-
specifier = override.specifier;
|
|
37293
|
-
}
|
|
37294
|
-
if (specifier !== null) {
|
|
37295
|
-
return {
|
|
37296
|
-
specifier,
|
|
37297
|
-
resolutionContext: context.resolutionContext,
|
|
37298
|
-
};
|
|
37299
|
-
}
|
|
37300
|
-
else {
|
|
37301
|
-
return null;
|
|
37302
|
-
}
|
|
37303
|
-
}
|
|
37304
|
-
|
|
37305
36594
|
/**
|
|
37306
36595
|
* Specifies the compilation mode that is used for the compilation.
|
|
37307
36596
|
*/
|
|
@@ -37758,10 +37047,14 @@ function createGenerateUniqueIdentifierHelper() {
|
|
|
37758
37047
|
const markIdentifierAsGenerated = (sf, identifierName) => generatedIdentifiers.add(`${sf.fileName}@@${identifierName}`);
|
|
37759
37048
|
return (sourceFile, symbolName) => {
|
|
37760
37049
|
const sf = sourceFile;
|
|
37761
|
-
|
|
37050
|
+
// NOTE: Typically accesses to TS fields are not renamed because the 1P externs
|
|
37051
|
+
// produced from TypeScript are ensuring public fields are considered "external".
|
|
37052
|
+
// See: https://developers.google.com/closure/compiler/docs/externs-and-exports.
|
|
37053
|
+
// This property is internal, so not part of the externs— so we need be cautious
|
|
37054
|
+
if (sf['identifiers'] === undefined) {
|
|
37762
37055
|
throw new Error('Source file unexpectedly lacks map of parsed `identifiers`.');
|
|
37763
37056
|
}
|
|
37764
|
-
const isUniqueIdentifier = (name) => !sf
|
|
37057
|
+
const isUniqueIdentifier = (name) => !sf['identifiers'].has(name) && !isGeneratedIdentifier(sf, name);
|
|
37765
37058
|
if (isUniqueIdentifier(symbolName)) {
|
|
37766
37059
|
markIdentifierAsGenerated(sf, symbolName);
|
|
37767
37060
|
return null;
|
|
@@ -38297,11 +37590,11 @@ function createImportReference(asTypeReference, ref) {
|
|
|
38297
37590
|
}
|
|
38298
37591
|
}
|
|
38299
37592
|
|
|
38300
|
-
const UNARY_OPERATORS
|
|
37593
|
+
const UNARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
38301
37594
|
[UnaryOperator.Minus, '-'],
|
|
38302
37595
|
[UnaryOperator.Plus, '+'],
|
|
38303
37596
|
]);
|
|
38304
|
-
const BINARY_OPERATORS
|
|
37597
|
+
const BINARY_OPERATORS = /* @__PURE__ */ new Map([
|
|
38305
37598
|
[BinaryOperator.And, '&&'],
|
|
38306
37599
|
[BinaryOperator.Bigger, '>'],
|
|
38307
37600
|
[BinaryOperator.BiggerEquals, '>='],
|
|
@@ -38495,10 +37788,10 @@ class ExpressionTranslatorVisitor {
|
|
|
38495
37788
|
: ast.body.visitExpression(this, context));
|
|
38496
37789
|
}
|
|
38497
37790
|
visitBinaryOperatorExpr(ast, context) {
|
|
38498
|
-
if (!BINARY_OPERATORS
|
|
37791
|
+
if (!BINARY_OPERATORS.has(ast.operator)) {
|
|
38499
37792
|
throw new Error(`Unknown binary operator: ${BinaryOperator[ast.operator]}`);
|
|
38500
37793
|
}
|
|
38501
|
-
const operator = BINARY_OPERATORS
|
|
37794
|
+
const operator = BINARY_OPERATORS.get(ast.operator);
|
|
38502
37795
|
if (ast.isAssignment()) {
|
|
38503
37796
|
return this.factory.createAssignment(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
|
|
38504
37797
|
}
|
|
@@ -38540,10 +37833,10 @@ class ExpressionTranslatorVisitor {
|
|
|
38540
37833
|
return this.factory.createVoidExpression(ast.expr.visitExpression(this, context));
|
|
38541
37834
|
}
|
|
38542
37835
|
visitUnaryOperatorExpr(ast, context) {
|
|
38543
|
-
if (!UNARY_OPERATORS
|
|
37836
|
+
if (!UNARY_OPERATORS.has(ast.operator)) {
|
|
38544
37837
|
throw new Error(`Unknown unary operator: ${UnaryOperator[ast.operator]}`);
|
|
38545
37838
|
}
|
|
38546
|
-
return this.factory.createUnaryExpression(UNARY_OPERATORS
|
|
37839
|
+
return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
|
|
38547
37840
|
}
|
|
38548
37841
|
visitParenthesizedExpr(ast, context) {
|
|
38549
37842
|
const result = ast.expr.visitExpression(this, context);
|
|
@@ -39008,64 +38301,67 @@ var PureAnnotation;
|
|
|
39008
38301
|
PureAnnotation["CLOSURE"] = "* @pureOrBreakMyCode ";
|
|
39009
38302
|
PureAnnotation["TERSER"] = "@__PURE__";
|
|
39010
38303
|
})(PureAnnotation || (PureAnnotation = {}));
|
|
39011
|
-
const UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
39012
|
-
'+': ts.SyntaxKind.PlusToken,
|
|
39013
|
-
'-': ts.SyntaxKind.MinusToken,
|
|
39014
|
-
'!': ts.SyntaxKind.ExclamationToken,
|
|
39015
|
-
}))();
|
|
39016
|
-
const BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
39017
|
-
'&&': ts.SyntaxKind.AmpersandAmpersandToken,
|
|
39018
|
-
'>': ts.SyntaxKind.GreaterThanToken,
|
|
39019
|
-
'>=': ts.SyntaxKind.GreaterThanEqualsToken,
|
|
39020
|
-
'&': ts.SyntaxKind.AmpersandToken,
|
|
39021
|
-
'|': ts.SyntaxKind.BarToken,
|
|
39022
|
-
'/': ts.SyntaxKind.SlashToken,
|
|
39023
|
-
'==': ts.SyntaxKind.EqualsEqualsToken,
|
|
39024
|
-
'===': ts.SyntaxKind.EqualsEqualsEqualsToken,
|
|
39025
|
-
'<': ts.SyntaxKind.LessThanToken,
|
|
39026
|
-
'<=': ts.SyntaxKind.LessThanEqualsToken,
|
|
39027
|
-
'-': ts.SyntaxKind.MinusToken,
|
|
39028
|
-
'%': ts.SyntaxKind.PercentToken,
|
|
39029
|
-
'*': ts.SyntaxKind.AsteriskToken,
|
|
39030
|
-
'**': ts.SyntaxKind.AsteriskAsteriskToken,
|
|
39031
|
-
'!=': ts.SyntaxKind.ExclamationEqualsToken,
|
|
39032
|
-
'!==': ts.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
39033
|
-
'||': ts.SyntaxKind.BarBarToken,
|
|
39034
|
-
'+': ts.SyntaxKind.PlusToken,
|
|
39035
|
-
'??': ts.SyntaxKind.QuestionQuestionToken,
|
|
39036
|
-
'in': ts.SyntaxKind.InKeyword,
|
|
39037
|
-
'=': ts.SyntaxKind.EqualsToken,
|
|
39038
|
-
'+=': ts.SyntaxKind.PlusEqualsToken,
|
|
39039
|
-
'-=': ts.SyntaxKind.MinusEqualsToken,
|
|
39040
|
-
'*=': ts.SyntaxKind.AsteriskEqualsToken,
|
|
39041
|
-
'/=': ts.SyntaxKind.SlashEqualsToken,
|
|
39042
|
-
'%=': ts.SyntaxKind.PercentEqualsToken,
|
|
39043
|
-
'**=': ts.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
39044
|
-
'&&=': ts.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
39045
|
-
'||=': ts.SyntaxKind.BarBarEqualsToken,
|
|
39046
|
-
'??=': ts.SyntaxKind.QuestionQuestionEqualsToken,
|
|
39047
|
-
}))();
|
|
39048
|
-
const VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
39049
|
-
'const': ts.NodeFlags.Const,
|
|
39050
|
-
'let': ts.NodeFlags.Let,
|
|
39051
|
-
'var': ts.NodeFlags.None,
|
|
39052
|
-
}))();
|
|
39053
38304
|
/**
|
|
39054
38305
|
* A TypeScript flavoured implementation of the AstFactory.
|
|
39055
38306
|
*/
|
|
39056
38307
|
class TypeScriptAstFactory {
|
|
39057
38308
|
annotateForClosureCompiler;
|
|
39058
38309
|
externalSourceFiles = new Map();
|
|
38310
|
+
UNARY_OPERATORS =
|
|
38311
|
+
/* @__PURE__ */ (() => ({
|
|
38312
|
+
'+': ts.SyntaxKind.PlusToken,
|
|
38313
|
+
'-': ts.SyntaxKind.MinusToken,
|
|
38314
|
+
'!': ts.SyntaxKind.ExclamationToken,
|
|
38315
|
+
}))();
|
|
38316
|
+
BINARY_OPERATORS =
|
|
38317
|
+
/* @__PURE__ */ (() => ({
|
|
38318
|
+
'&&': ts.SyntaxKind.AmpersandAmpersandToken,
|
|
38319
|
+
'>': ts.SyntaxKind.GreaterThanToken,
|
|
38320
|
+
'>=': ts.SyntaxKind.GreaterThanEqualsToken,
|
|
38321
|
+
'&': ts.SyntaxKind.AmpersandToken,
|
|
38322
|
+
'|': ts.SyntaxKind.BarToken,
|
|
38323
|
+
'/': ts.SyntaxKind.SlashToken,
|
|
38324
|
+
'==': ts.SyntaxKind.EqualsEqualsToken,
|
|
38325
|
+
'===': ts.SyntaxKind.EqualsEqualsEqualsToken,
|
|
38326
|
+
'<': ts.SyntaxKind.LessThanToken,
|
|
38327
|
+
'<=': ts.SyntaxKind.LessThanEqualsToken,
|
|
38328
|
+
'-': ts.SyntaxKind.MinusToken,
|
|
38329
|
+
'%': ts.SyntaxKind.PercentToken,
|
|
38330
|
+
'*': ts.SyntaxKind.AsteriskToken,
|
|
38331
|
+
'**': ts.SyntaxKind.AsteriskAsteriskToken,
|
|
38332
|
+
'!=': ts.SyntaxKind.ExclamationEqualsToken,
|
|
38333
|
+
'!==': ts.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
38334
|
+
'||': ts.SyntaxKind.BarBarToken,
|
|
38335
|
+
'+': ts.SyntaxKind.PlusToken,
|
|
38336
|
+
'??': ts.SyntaxKind.QuestionQuestionToken,
|
|
38337
|
+
'in': ts.SyntaxKind.InKeyword,
|
|
38338
|
+
'=': ts.SyntaxKind.EqualsToken,
|
|
38339
|
+
'+=': ts.SyntaxKind.PlusEqualsToken,
|
|
38340
|
+
'-=': ts.SyntaxKind.MinusEqualsToken,
|
|
38341
|
+
'*=': ts.SyntaxKind.AsteriskEqualsToken,
|
|
38342
|
+
'/=': ts.SyntaxKind.SlashEqualsToken,
|
|
38343
|
+
'%=': ts.SyntaxKind.PercentEqualsToken,
|
|
38344
|
+
'**=': ts.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
38345
|
+
'&&=': ts.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
38346
|
+
'||=': ts.SyntaxKind.BarBarEqualsToken,
|
|
38347
|
+
'??=': ts.SyntaxKind.QuestionQuestionEqualsToken,
|
|
38348
|
+
}))();
|
|
38349
|
+
VAR_TYPES =
|
|
38350
|
+
/* @__PURE__ */ (() => ({
|
|
38351
|
+
'const': ts.NodeFlags.Const,
|
|
38352
|
+
'let': ts.NodeFlags.Let,
|
|
38353
|
+
'var': ts.NodeFlags.None,
|
|
38354
|
+
}))();
|
|
39059
38355
|
constructor(annotateForClosureCompiler) {
|
|
39060
38356
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
39061
38357
|
}
|
|
39062
38358
|
attachComments = attachComments;
|
|
39063
38359
|
createArrayLiteral = ts.factory.createArrayLiteralExpression;
|
|
39064
38360
|
createAssignment(target, operator, value) {
|
|
39065
|
-
return ts.factory.createBinaryExpression(target, BINARY_OPERATORS[operator], value);
|
|
38361
|
+
return ts.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
39066
38362
|
}
|
|
39067
38363
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
39068
|
-
return ts.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS[operator], rightOperand);
|
|
38364
|
+
return ts.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
39069
38365
|
}
|
|
39070
38366
|
createBlock(body) {
|
|
39071
38367
|
return ts.factory.createBlock(body);
|
|
@@ -39180,12 +38476,12 @@ class TypeScriptAstFactory {
|
|
|
39180
38476
|
createTypeOfExpression = ts.factory.createTypeOfExpression;
|
|
39181
38477
|
createVoidExpression = ts.factory.createVoidExpression;
|
|
39182
38478
|
createUnaryExpression(operator, operand) {
|
|
39183
|
-
return ts.factory.createPrefixUnaryExpression(UNARY_OPERATORS[operator], operand);
|
|
38479
|
+
return ts.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
39184
38480
|
}
|
|
39185
38481
|
createVariableDeclaration(variableName, initializer, type) {
|
|
39186
38482
|
return ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
|
|
39187
38483
|
ts.factory.createVariableDeclaration(variableName, undefined, undefined, initializer ?? undefined),
|
|
39188
|
-
], VAR_TYPES[type]));
|
|
38484
|
+
], this.VAR_TYPES[type]));
|
|
39189
38485
|
}
|
|
39190
38486
|
setSourceMapRange(node, sourceMapRange) {
|
|
39191
38487
|
if (sourceMapRange === null) {
|
|
@@ -41287,6 +40583,19 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
|
|
|
41287
40583
|
relatedInformation,
|
|
41288
40584
|
};
|
|
41289
40585
|
}
|
|
40586
|
+
let typeForMessage;
|
|
40587
|
+
if (category === ts.DiagnosticCategory.Warning) {
|
|
40588
|
+
typeForMessage = 'Warning';
|
|
40589
|
+
}
|
|
40590
|
+
else if (category === ts.DiagnosticCategory.Suggestion) {
|
|
40591
|
+
typeForMessage = 'Suggestion';
|
|
40592
|
+
}
|
|
40593
|
+
else if (category === ts.DiagnosticCategory.Message) {
|
|
40594
|
+
typeForMessage = 'Message';
|
|
40595
|
+
}
|
|
40596
|
+
else {
|
|
40597
|
+
typeForMessage = 'Error';
|
|
40598
|
+
}
|
|
41290
40599
|
relatedInformation.push({
|
|
41291
40600
|
category: ts.DiagnosticCategory.Message,
|
|
41292
40601
|
code: 0,
|
|
@@ -41295,7 +40604,7 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
|
|
|
41295
40604
|
// and getEnd() are used because they don't include surrounding whitespace.
|
|
41296
40605
|
start: mapping.node.getStart(),
|
|
41297
40606
|
length: mapping.node.getEnd() - mapping.node.getStart(),
|
|
41298
|
-
messageText:
|
|
40607
|
+
messageText: `${typeForMessage} occurs in the template of component ${componentName}.`,
|
|
41299
40608
|
});
|
|
41300
40609
|
return {
|
|
41301
40610
|
source: 'ngtsc',
|
|
@@ -43218,26 +42527,29 @@ class ReferenceEmitEnvironment {
|
|
|
43218
42527
|
* `ts.BinaryExpression`s need to be wrapped in parentheses before casting.
|
|
43219
42528
|
*/
|
|
43220
42529
|
//
|
|
43221
|
-
|
|
43222
|
-
// Expressions which are already parenthesized can be cast without further wrapping.
|
|
43223
|
-
ts.SyntaxKind.ParenthesizedExpression,
|
|
43224
|
-
// Expressions which form a single lexical unit leave no room for precedence issues with the cast.
|
|
43225
|
-
ts.SyntaxKind.Identifier,
|
|
43226
|
-
ts.SyntaxKind.CallExpression,
|
|
43227
|
-
ts.SyntaxKind.NonNullExpression,
|
|
43228
|
-
ts.SyntaxKind.ElementAccessExpression,
|
|
43229
|
-
ts.SyntaxKind.PropertyAccessExpression,
|
|
43230
|
-
ts.SyntaxKind.ArrayLiteralExpression,
|
|
43231
|
-
ts.SyntaxKind.ObjectLiteralExpression,
|
|
43232
|
-
// The same goes for various literals.
|
|
43233
|
-
ts.SyntaxKind.StringLiteral,
|
|
43234
|
-
ts.SyntaxKind.NumericLiteral,
|
|
43235
|
-
ts.SyntaxKind.TrueKeyword,
|
|
43236
|
-
ts.SyntaxKind.FalseKeyword,
|
|
43237
|
-
ts.SyntaxKind.NullKeyword,
|
|
43238
|
-
ts.SyntaxKind.UndefinedKeyword,
|
|
43239
|
-
]);
|
|
42530
|
+
let SAFE_TO_CAST_WITHOUT_PARENS = null;
|
|
43240
42531
|
function tsCastToAny(expr) {
|
|
42532
|
+
if (SAFE_TO_CAST_WITHOUT_PARENS === null) {
|
|
42533
|
+
SAFE_TO_CAST_WITHOUT_PARENS = new Set([
|
|
42534
|
+
// Expressions which are already parenthesized can be cast without further wrapping.
|
|
42535
|
+
ts.SyntaxKind.ParenthesizedExpression,
|
|
42536
|
+
// Expressions which form a single lexical unit leave no room for precedence issues with the cast.
|
|
42537
|
+
ts.SyntaxKind.Identifier,
|
|
42538
|
+
ts.SyntaxKind.CallExpression,
|
|
42539
|
+
ts.SyntaxKind.NonNullExpression,
|
|
42540
|
+
ts.SyntaxKind.ElementAccessExpression,
|
|
42541
|
+
ts.SyntaxKind.PropertyAccessExpression,
|
|
42542
|
+
ts.SyntaxKind.ArrayLiteralExpression,
|
|
42543
|
+
ts.SyntaxKind.ObjectLiteralExpression,
|
|
42544
|
+
// The same goes for various literals.
|
|
42545
|
+
ts.SyntaxKind.StringLiteral,
|
|
42546
|
+
ts.SyntaxKind.NumericLiteral,
|
|
42547
|
+
ts.SyntaxKind.TrueKeyword,
|
|
42548
|
+
ts.SyntaxKind.FalseKeyword,
|
|
42549
|
+
ts.SyntaxKind.NullKeyword,
|
|
42550
|
+
ts.SyntaxKind.UndefinedKeyword,
|
|
42551
|
+
]);
|
|
42552
|
+
}
|
|
43241
42553
|
// Wrap `expr` in parentheses if needed (see `SAFE_TO_CAST_WITHOUT_PARENS` above).
|
|
43242
42554
|
if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
|
|
43243
42555
|
expr = ts.factory.createParenthesizedExpression(expr);
|
|
@@ -44728,7 +44040,7 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
44728
44040
|
}
|
|
44729
44041
|
|
|
44730
44042
|
/**
|
|
44731
|
-
*
|
|
44043
|
+
* Gets an expression that is cast to any. Currently represented as `0 as any`.
|
|
44732
44044
|
*
|
|
44733
44045
|
* Historically this expression was using `null as any`, but a newly-added check in TypeScript 5.6
|
|
44734
44046
|
* (https://devblogs.microsoft.com/typescript/announcing-typescript-5-6-beta/#disallowed-nullish-and-truthy-checks)
|
|
@@ -44738,45 +44050,9 @@ function translateDiagnostic(diagnostic, resolver) {
|
|
|
44738
44050
|
* - Some flavor of function call, like `isNan(0) as any` - requires even more characters than the
|
|
44739
44051
|
* NaN option and has the same issue with `noLib`.
|
|
44740
44052
|
*/
|
|
44741
|
-
|
|
44742
|
-
|
|
44743
|
-
|
|
44744
|
-
['+', ts.SyntaxKind.PlusToken],
|
|
44745
|
-
['-', ts.SyntaxKind.MinusToken],
|
|
44746
|
-
]);
|
|
44747
|
-
const BINARY_OPS = new Map([
|
|
44748
|
-
['+', ts.SyntaxKind.PlusToken],
|
|
44749
|
-
['-', ts.SyntaxKind.MinusToken],
|
|
44750
|
-
['<', ts.SyntaxKind.LessThanToken],
|
|
44751
|
-
['>', ts.SyntaxKind.GreaterThanToken],
|
|
44752
|
-
['<=', ts.SyntaxKind.LessThanEqualsToken],
|
|
44753
|
-
['>=', ts.SyntaxKind.GreaterThanEqualsToken],
|
|
44754
|
-
['=', ts.SyntaxKind.EqualsToken],
|
|
44755
|
-
['==', ts.SyntaxKind.EqualsEqualsToken],
|
|
44756
|
-
['===', ts.SyntaxKind.EqualsEqualsEqualsToken],
|
|
44757
|
-
['*', ts.SyntaxKind.AsteriskToken],
|
|
44758
|
-
['**', ts.SyntaxKind.AsteriskAsteriskToken],
|
|
44759
|
-
['/', ts.SyntaxKind.SlashToken],
|
|
44760
|
-
['%', ts.SyntaxKind.PercentToken],
|
|
44761
|
-
['!=', ts.SyntaxKind.ExclamationEqualsToken],
|
|
44762
|
-
['!==', ts.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
44763
|
-
['||', ts.SyntaxKind.BarBarToken],
|
|
44764
|
-
['&&', ts.SyntaxKind.AmpersandAmpersandToken],
|
|
44765
|
-
['&', ts.SyntaxKind.AmpersandToken],
|
|
44766
|
-
['|', ts.SyntaxKind.BarToken],
|
|
44767
|
-
['??', ts.SyntaxKind.QuestionQuestionToken],
|
|
44768
|
-
['in', ts.SyntaxKind.InKeyword],
|
|
44769
|
-
['=', ts.SyntaxKind.EqualsToken],
|
|
44770
|
-
['+=', ts.SyntaxKind.PlusEqualsToken],
|
|
44771
|
-
['-=', ts.SyntaxKind.MinusEqualsToken],
|
|
44772
|
-
['*=', ts.SyntaxKind.AsteriskEqualsToken],
|
|
44773
|
-
['/=', ts.SyntaxKind.SlashEqualsToken],
|
|
44774
|
-
['%=', ts.SyntaxKind.PercentEqualsToken],
|
|
44775
|
-
['**=', ts.SyntaxKind.AsteriskAsteriskEqualsToken],
|
|
44776
|
-
['&&=', ts.SyntaxKind.AmpersandAmpersandEqualsToken],
|
|
44777
|
-
['||=', ts.SyntaxKind.BarBarEqualsToken],
|
|
44778
|
-
['??=', ts.SyntaxKind.QuestionQuestionEqualsToken],
|
|
44779
|
-
]);
|
|
44053
|
+
function getAnyExpression() {
|
|
44054
|
+
return ts.factory.createAsExpression(ts.factory.createNumericLiteral('0'), ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword));
|
|
44055
|
+
}
|
|
44780
44056
|
/**
|
|
44781
44057
|
* Convert an `AST` to TypeScript code directly, without going through an intermediate `Expression`
|
|
44782
44058
|
* AST.
|
|
@@ -44788,6 +44064,44 @@ function astToTypescript(ast, maybeResolve, config) {
|
|
|
44788
44064
|
class AstTranslator {
|
|
44789
44065
|
maybeResolve;
|
|
44790
44066
|
config;
|
|
44067
|
+
UNDEFINED = ts.factory.createIdentifier('undefined');
|
|
44068
|
+
UNARY_OPS = new Map([
|
|
44069
|
+
['+', ts.SyntaxKind.PlusToken],
|
|
44070
|
+
['-', ts.SyntaxKind.MinusToken],
|
|
44071
|
+
]);
|
|
44072
|
+
BINARY_OPS = new Map([
|
|
44073
|
+
['+', ts.SyntaxKind.PlusToken],
|
|
44074
|
+
['-', ts.SyntaxKind.MinusToken],
|
|
44075
|
+
['<', ts.SyntaxKind.LessThanToken],
|
|
44076
|
+
['>', ts.SyntaxKind.GreaterThanToken],
|
|
44077
|
+
['<=', ts.SyntaxKind.LessThanEqualsToken],
|
|
44078
|
+
['>=', ts.SyntaxKind.GreaterThanEqualsToken],
|
|
44079
|
+
['=', ts.SyntaxKind.EqualsToken],
|
|
44080
|
+
['==', ts.SyntaxKind.EqualsEqualsToken],
|
|
44081
|
+
['===', ts.SyntaxKind.EqualsEqualsEqualsToken],
|
|
44082
|
+
['*', ts.SyntaxKind.AsteriskToken],
|
|
44083
|
+
['**', ts.SyntaxKind.AsteriskAsteriskToken],
|
|
44084
|
+
['/', ts.SyntaxKind.SlashToken],
|
|
44085
|
+
['%', ts.SyntaxKind.PercentToken],
|
|
44086
|
+
['!=', ts.SyntaxKind.ExclamationEqualsToken],
|
|
44087
|
+
['!==', ts.SyntaxKind.ExclamationEqualsEqualsToken],
|
|
44088
|
+
['||', ts.SyntaxKind.BarBarToken],
|
|
44089
|
+
['&&', ts.SyntaxKind.AmpersandAmpersandToken],
|
|
44090
|
+
['&', ts.SyntaxKind.AmpersandToken],
|
|
44091
|
+
['|', ts.SyntaxKind.BarToken],
|
|
44092
|
+
['??', ts.SyntaxKind.QuestionQuestionToken],
|
|
44093
|
+
['in', ts.SyntaxKind.InKeyword],
|
|
44094
|
+
['=', ts.SyntaxKind.EqualsToken],
|
|
44095
|
+
['+=', ts.SyntaxKind.PlusEqualsToken],
|
|
44096
|
+
['-=', ts.SyntaxKind.MinusEqualsToken],
|
|
44097
|
+
['*=', ts.SyntaxKind.AsteriskEqualsToken],
|
|
44098
|
+
['/=', ts.SyntaxKind.SlashEqualsToken],
|
|
44099
|
+
['%=', ts.SyntaxKind.PercentEqualsToken],
|
|
44100
|
+
['**=', ts.SyntaxKind.AsteriskAsteriskEqualsToken],
|
|
44101
|
+
['&&=', ts.SyntaxKind.AmpersandAmpersandEqualsToken],
|
|
44102
|
+
['||=', ts.SyntaxKind.BarBarEqualsToken],
|
|
44103
|
+
['??=', ts.SyntaxKind.QuestionQuestionEqualsToken],
|
|
44104
|
+
]);
|
|
44791
44105
|
constructor(maybeResolve, config) {
|
|
44792
44106
|
this.maybeResolve = maybeResolve;
|
|
44793
44107
|
this.config = config;
|
|
@@ -44813,7 +44127,7 @@ class AstTranslator {
|
|
|
44813
44127
|
}
|
|
44814
44128
|
visitUnary(ast) {
|
|
44815
44129
|
const expr = this.translate(ast.expr);
|
|
44816
|
-
const op = UNARY_OPS.get(ast.operator);
|
|
44130
|
+
const op = this.UNARY_OPS.get(ast.operator);
|
|
44817
44131
|
if (op === undefined) {
|
|
44818
44132
|
throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
|
|
44819
44133
|
}
|
|
@@ -44824,7 +44138,7 @@ class AstTranslator {
|
|
|
44824
44138
|
visitBinary(ast) {
|
|
44825
44139
|
const lhs = wrapForDiagnostics(this.translate(ast.left));
|
|
44826
44140
|
const rhs = wrapForDiagnostics(this.translate(ast.right));
|
|
44827
|
-
const op = BINARY_OPS.get(ast.operation);
|
|
44141
|
+
const op = this.BINARY_OPS.get(ast.operation);
|
|
44828
44142
|
if (op === undefined) {
|
|
44829
44143
|
throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
|
|
44830
44144
|
}
|
|
@@ -44962,7 +44276,7 @@ class AstTranslator {
|
|
|
44962
44276
|
// The type of this expression is (typeof a!.b) | undefined, which is exactly as desired.
|
|
44963
44277
|
const expr = ts.factory.createPropertyAccessExpression(ts.factory.createNonNullExpression(receiver), ast.name);
|
|
44964
44278
|
addParseSpanInfo(expr, ast.nameSpan);
|
|
44965
|
-
node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(
|
|
44279
|
+
node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(getAnyExpression(), undefined, expr, undefined, this.UNDEFINED));
|
|
44966
44280
|
}
|
|
44967
44281
|
else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
44968
44282
|
// Emulate a View Engine bug where 'any' is inferred for the left-hand side of the safe
|
|
@@ -44992,7 +44306,7 @@ class AstTranslator {
|
|
|
44992
44306
|
// "a?.[...]" becomes (0 as any ? a![...] : undefined)
|
|
44993
44307
|
const expr = ts.factory.createElementAccessExpression(ts.factory.createNonNullExpression(receiver), key);
|
|
44994
44308
|
addParseSpanInfo(expr, ast.sourceSpan);
|
|
44995
|
-
node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(
|
|
44309
|
+
node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(getAnyExpression(), undefined, expr, undefined, this.UNDEFINED));
|
|
44996
44310
|
}
|
|
44997
44311
|
else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
44998
44312
|
// "a?.[...]" becomes (a as any)[...]
|
|
@@ -45081,7 +44395,7 @@ class AstTranslator {
|
|
|
45081
44395
|
if (this.config.strictSafeNavigationTypes) {
|
|
45082
44396
|
// "a?.method(...)" becomes (0 as any ? a!.method(...) : undefined)
|
|
45083
44397
|
const call = ts.factory.createCallExpression(ts.factory.createNonNullExpression(expr), undefined, args);
|
|
45084
|
-
return ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(
|
|
44398
|
+
return ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(getAnyExpression(), undefined, call, undefined, this.UNDEFINED));
|
|
45085
44399
|
}
|
|
45086
44400
|
if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
|
|
45087
44401
|
// "a?.method(...)" becomes (a as any).method(...)
|
|
@@ -45324,7 +44638,13 @@ class TcbOp {
|
|
|
45324
44638
|
* circular references.
|
|
45325
44639
|
*/
|
|
45326
44640
|
circularFallback() {
|
|
45327
|
-
|
|
44641
|
+
// Value used to break a circular reference between `TcbOp`s.
|
|
44642
|
+
//
|
|
44643
|
+
// This value is returned whenever `TcbOp`s have a circular dependency. The
|
|
44644
|
+
// expression is a non-null assertion of the null value (in TypeScript, the
|
|
44645
|
+
// expression `null!`). This construction will infer the least narrow type
|
|
44646
|
+
// for whatever it's assigned to.
|
|
44647
|
+
return ts.factory.createNonNullExpression(ts.factory.createNull());
|
|
45328
44648
|
}
|
|
45329
44649
|
}
|
|
45330
44650
|
/**
|
|
@@ -45777,7 +45097,7 @@ class TcbInvalidReferenceOp extends TcbOp {
|
|
|
45777
45097
|
optional = true;
|
|
45778
45098
|
execute() {
|
|
45779
45099
|
const id = this.tcb.allocateId();
|
|
45780
|
-
this.scope.addStatement(tsCreateVariable(id,
|
|
45100
|
+
this.scope.addStatement(tsCreateVariable(id, getAnyExpression()));
|
|
45781
45101
|
return id;
|
|
45782
45102
|
}
|
|
45783
45103
|
}
|
|
@@ -46447,8 +45767,8 @@ class TcbUnclaimedOutputsOp extends TcbOp {
|
|
|
46447
45767
|
// `HTMLElement.addEventListener` using `HTMLElementEventMap` to infer an accurate type for
|
|
46448
45768
|
// `$event` depending on the event name. For unknown event names, TypeScript resorts to the
|
|
46449
45769
|
// base `Event` type.
|
|
46450
|
-
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0 /* EventParamType.Infer */);
|
|
46451
45770
|
let target;
|
|
45771
|
+
let domEventAssertion;
|
|
46452
45772
|
// Only check for `window` and `document` since in theory any target can be passed.
|
|
46453
45773
|
if (output.target === 'window' || output.target === 'document') {
|
|
46454
45774
|
target = ts.factory.createIdentifier(output.target);
|
|
@@ -46459,8 +45779,32 @@ class TcbUnclaimedOutputsOp extends TcbOp {
|
|
|
46459
45779
|
else {
|
|
46460
45780
|
target = elId;
|
|
46461
45781
|
}
|
|
45782
|
+
// By default the target of an event is `EventTarget | null`, because of bubbling
|
|
45783
|
+
// and custom events. This can be inconvenient in some common cases like `input` elements
|
|
45784
|
+
// since we don't have the ability to type cast in templates. We can improve the type
|
|
45785
|
+
// checking for some of these cases by inferring the target based on the element it was
|
|
45786
|
+
// bound to. We can only do this safely if the element is a void element (e.g. `input` or
|
|
45787
|
+
// `img`), because we know that it couldn't have bubbled from a child. The event handler
|
|
45788
|
+
// with the assertion would look as follows:
|
|
45789
|
+
//
|
|
45790
|
+
// ```
|
|
45791
|
+
// const _t1 = document.createElement('input');
|
|
45792
|
+
//
|
|
45793
|
+
// _t1.addEventListener('input', ($event) => {
|
|
45794
|
+
// ɵassertType<typeof _t1>($event.target);
|
|
45795
|
+
// handler($event.target);
|
|
45796
|
+
// });
|
|
45797
|
+
// ```
|
|
45798
|
+
if (this.target instanceof Element$1 &&
|
|
45799
|
+
this.target.isVoid &&
|
|
45800
|
+
ts.isIdentifier(target)) {
|
|
45801
|
+
domEventAssertion = ts.factory.createCallExpression(this.tcb.env.referenceExternalSymbol('@angular/core', 'ɵassertType'), [ts.factory.createTypeQueryNode(target)], [
|
|
45802
|
+
ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(EVENT_PARAMETER), 'target'),
|
|
45803
|
+
]);
|
|
45804
|
+
}
|
|
46462
45805
|
const propertyAccess = ts.factory.createPropertyAccessExpression(target, 'addEventListener');
|
|
46463
45806
|
addParseSpanInfo(propertyAccess, output.keySpan);
|
|
45807
|
+
const handler = tcbCreateEventHandler(output, this.tcb, this.scope, 0 /* EventParamType.Infer */, domEventAssertion);
|
|
46464
45808
|
const call = ts.factory.createCallExpression(
|
|
46465
45809
|
/* expression */ propertyAccess,
|
|
46466
45810
|
/* typeArguments */ undefined,
|
|
@@ -46759,14 +46103,6 @@ class TcbForOfOp extends TcbOp {
|
|
|
46759
46103
|
return null;
|
|
46760
46104
|
}
|
|
46761
46105
|
}
|
|
46762
|
-
/**
|
|
46763
|
-
* Value used to break a circular reference between `TcbOp`s.
|
|
46764
|
-
*
|
|
46765
|
-
* This value is returned whenever `TcbOp`s have a circular dependency. The expression is a non-null
|
|
46766
|
-
* assertion of the null value (in TypeScript, the expression `null!`). This construction will infer
|
|
46767
|
-
* the least narrow type for whatever it's assigned to.
|
|
46768
|
-
*/
|
|
46769
|
-
const INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts.factory.createNonNullExpression(ts.factory.createNull());
|
|
46770
46106
|
/**
|
|
46771
46107
|
* Overall generation context for the type check block.
|
|
46772
46108
|
*
|
|
@@ -46888,16 +46224,18 @@ class Scope {
|
|
|
46888
46224
|
*/
|
|
46889
46225
|
statements = [];
|
|
46890
46226
|
/**
|
|
46891
|
-
*
|
|
46227
|
+
* Gets names of the for loop context variables and their types.
|
|
46892
46228
|
*/
|
|
46893
|
-
static
|
|
46894
|
-
[
|
|
46895
|
-
|
|
46896
|
-
|
|
46897
|
-
|
|
46898
|
-
|
|
46899
|
-
|
|
46900
|
-
|
|
46229
|
+
static getForLoopContextVariableTypes() {
|
|
46230
|
+
return new Map([
|
|
46231
|
+
['$first', ts.SyntaxKind.BooleanKeyword],
|
|
46232
|
+
['$last', ts.SyntaxKind.BooleanKeyword],
|
|
46233
|
+
['$even', ts.SyntaxKind.BooleanKeyword],
|
|
46234
|
+
['$odd', ts.SyntaxKind.BooleanKeyword],
|
|
46235
|
+
['$index', ts.SyntaxKind.NumberKeyword],
|
|
46236
|
+
['$count', ts.SyntaxKind.NumberKeyword],
|
|
46237
|
+
]);
|
|
46238
|
+
}
|
|
46901
46239
|
constructor(tcb, parent = null, guard = null) {
|
|
46902
46240
|
this.tcb = tcb;
|
|
46903
46241
|
this.parent = parent;
|
|
@@ -46934,13 +46272,13 @@ class Scope {
|
|
|
46934
46272
|
const firstDecl = varMap.get(v.name);
|
|
46935
46273
|
tcb.oobRecorder.duplicateTemplateVar(tcb.id, v, firstDecl);
|
|
46936
46274
|
}
|
|
46937
|
-
|
|
46275
|
+
Scope.registerVariable(scope, v, new TcbTemplateVariableOp(tcb, scope, scopedNode, v));
|
|
46938
46276
|
}
|
|
46939
46277
|
}
|
|
46940
46278
|
else if (scopedNode instanceof IfBlockBranch) {
|
|
46941
46279
|
const { expression, expressionAlias } = scopedNode;
|
|
46942
46280
|
if (expression !== null && expressionAlias !== null) {
|
|
46943
|
-
|
|
46281
|
+
Scope.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
|
|
46944
46282
|
}
|
|
46945
46283
|
}
|
|
46946
46284
|
else if (scopedNode instanceof ForLoopBlock) {
|
|
@@ -46949,12 +46287,13 @@ class Scope {
|
|
|
46949
46287
|
const loopInitializer = tcb.allocateId();
|
|
46950
46288
|
addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
|
|
46951
46289
|
scope.varMap.set(scopedNode.item, loopInitializer);
|
|
46290
|
+
const forLoopContextVariableTypes = Scope.getForLoopContextVariableTypes();
|
|
46952
46291
|
for (const variable of scopedNode.contextVariables) {
|
|
46953
|
-
if (!
|
|
46292
|
+
if (!forLoopContextVariableTypes.has(variable.value)) {
|
|
46954
46293
|
throw new Error(`Unrecognized for loop context variable ${variable.name}`);
|
|
46955
46294
|
}
|
|
46956
|
-
const type = ts.factory.createKeywordTypeNode(
|
|
46957
|
-
|
|
46295
|
+
const type = ts.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
|
|
46296
|
+
Scope.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
|
|
46958
46297
|
}
|
|
46959
46298
|
}
|
|
46960
46299
|
else if (scopedNode instanceof HostElement) {
|
|
@@ -47695,7 +47034,7 @@ class TcbExpressionTranslator {
|
|
|
47695
47034
|
// No pipe by that name exists in scope. Record this as an error.
|
|
47696
47035
|
this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
|
|
47697
47036
|
// Use an 'any' value to at least allow the rest of the expression to be checked.
|
|
47698
|
-
pipe =
|
|
47037
|
+
pipe = getAnyExpression();
|
|
47699
47038
|
}
|
|
47700
47039
|
else if (pipeMeta.isExplicitlyDeferred &&
|
|
47701
47040
|
this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
|
|
@@ -47703,7 +47042,7 @@ class TcbExpressionTranslator {
|
|
|
47703
47042
|
// but was used outside of a `@defer` block, which is the error.
|
|
47704
47043
|
this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
|
|
47705
47044
|
// Use an 'any' value to at least allow the rest of the expression to be checked.
|
|
47706
|
-
pipe =
|
|
47045
|
+
pipe = getAnyExpression();
|
|
47707
47046
|
}
|
|
47708
47047
|
else {
|
|
47709
47048
|
// Use a variable declared as the pipe's type.
|
|
@@ -47794,7 +47133,7 @@ function tcbCallTypeCtor(dir, tcb, inputs) {
|
|
|
47794
47133
|
else {
|
|
47795
47134
|
// A type constructor is required to be called with all input properties, so any unset
|
|
47796
47135
|
// inputs are simply assigned a value of type `any` to ignore them.
|
|
47797
|
-
return ts.factory.createPropertyAssignment(propertyName,
|
|
47136
|
+
return ts.factory.createPropertyAssignment(propertyName, getAnyExpression());
|
|
47798
47137
|
}
|
|
47799
47138
|
});
|
|
47800
47139
|
// Call the `ngTypeCtor` method on the directive class, with an object literal argument created
|
|
@@ -47896,9 +47235,12 @@ const EVENT_PARAMETER = '$event';
|
|
|
47896
47235
|
* parameter will have an explicit `any` type, effectively disabling strict type checking of event
|
|
47897
47236
|
* bindings. Alternatively, an explicit type can be passed for the `$event` parameter.
|
|
47898
47237
|
*/
|
|
47899
|
-
function tcbCreateEventHandler(event, tcb, scope, eventType) {
|
|
47238
|
+
function tcbCreateEventHandler(event, tcb, scope, eventType, assertionExpression) {
|
|
47900
47239
|
const handler = tcbEventHandlerExpression(event.handler, tcb, scope);
|
|
47901
47240
|
const statements = [];
|
|
47241
|
+
if (assertionExpression !== undefined) {
|
|
47242
|
+
statements.push(ts.factory.createExpressionStatement(assertionExpression));
|
|
47243
|
+
}
|
|
47902
47244
|
// TODO(crisbeto): remove the `checkTwoWayBoundEvents` check in v20.
|
|
47903
47245
|
if (event.type === exports.ParsedEventType.TwoWay && tcb.env.config.checkTwoWayBoundEvents) {
|
|
47904
47246
|
// If we're dealing with a two-way event, we create a variable initialized to the unwrapped
|
|
@@ -50521,6 +49863,7 @@ exports.ImportManager = ImportManager;
|
|
|
50521
49863
|
exports.Interpolation = Interpolation$1;
|
|
50522
49864
|
exports.InterpolationConfig = InterpolationConfig;
|
|
50523
49865
|
exports.InvokeFunctionExpr = InvokeFunctionExpr;
|
|
49866
|
+
exports.KnownFn = KnownFn;
|
|
50524
49867
|
exports.LetDeclaration = LetDeclaration$1;
|
|
50525
49868
|
exports.LiteralArrayExpr = LiteralArrayExpr;
|
|
50526
49869
|
exports.LiteralExpr = LiteralExpr;
|
|
@@ -50553,6 +49896,7 @@ exports.Reference = Reference;
|
|
|
50553
49896
|
exports.Reference$1 = Reference$1;
|
|
50554
49897
|
exports.ReferenceEmitter = ReferenceEmitter;
|
|
50555
49898
|
exports.RelativePathStrategy = RelativePathStrategy;
|
|
49899
|
+
exports.ResolvedModule = ResolvedModule;
|
|
50556
49900
|
exports.ReturnStatement = ReturnStatement;
|
|
50557
49901
|
exports.SafeCall = SafeCall;
|
|
50558
49902
|
exports.SafeKeyedRead = SafeKeyedRead;
|
|
@@ -50560,8 +49904,6 @@ exports.SafePropertyRead = SafePropertyRead;
|
|
|
50560
49904
|
exports.SelectorMatcher = SelectorMatcher;
|
|
50561
49905
|
exports.SelectorlessMatcher = SelectorlessMatcher;
|
|
50562
49906
|
exports.Serializer = Serializer;
|
|
50563
|
-
exports.StaticInterpreter = StaticInterpreter;
|
|
50564
|
-
exports.SyntheticValue = SyntheticValue;
|
|
50565
49907
|
exports.Tag = Tag;
|
|
50566
49908
|
exports.TagPlaceholder = TagPlaceholder;
|
|
50567
49909
|
exports.Template = Template;
|
|
@@ -50650,6 +49992,7 @@ exports.isAliasImportDeclaration = isAliasImportDeclaration;
|
|
|
50650
49992
|
exports.isAngularCore = isAngularCore;
|
|
50651
49993
|
exports.isAngularCoreReferenceWithPotentialAliasing = isAngularCoreReferenceWithPotentialAliasing;
|
|
50652
49994
|
exports.isAngularDecorator = isAngularDecorator;
|
|
49995
|
+
exports.isDeclaration = isDeclaration;
|
|
50653
49996
|
exports.isDtsPath = isDtsPath;
|
|
50654
49997
|
exports.isExpressionForwardReference = isExpressionForwardReference;
|
|
50655
49998
|
exports.isFatalDiagnosticError = isFatalDiagnosticError;
|
|
@@ -50660,7 +50003,7 @@ exports.isNamedClassDeclaration = isNamedClassDeclaration;
|
|
|
50660
50003
|
exports.isNonDeclarationTsPath = isNonDeclarationTsPath;
|
|
50661
50004
|
exports.isShim = isShim;
|
|
50662
50005
|
exports.join = join;
|
|
50663
|
-
exports.literal = literal
|
|
50006
|
+
exports.literal = literal;
|
|
50664
50007
|
exports.literalArr = literalArr;
|
|
50665
50008
|
exports.literalMap = literalMap;
|
|
50666
50009
|
exports.loadIsReferencedAliasDeclarationPatch = loadIsReferencedAliasDeclarationPatch;
|