@angular/core 16.0.0-rc.1 → 16.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2022/src/hydration/annotate.mjs +5 -2
- package/esm2022/src/hydration/api.mjs +2 -2
- package/esm2022/src/hydration/node_lookup_utils.mjs +13 -8
- package/esm2022/src/hydration/tokens.mjs +3 -4
- package/esm2022/src/render3/collect_native_nodes.mjs +18 -3
- package/esm2022/src/render3/i18n/i18n_parse.mjs +5 -6
- package/esm2022/src/render3/instructions/shared.mjs +52 -25
- package/esm2022/src/render3/instructions/styling.mjs +22 -2
- package/esm2022/src/render3/instructions/template.mjs +2 -2
- package/esm2022/src/render3/reactive_lview_consumer.mjs +4 -4
- package/esm2022/src/render3/reactivity/effect.mjs +8 -3
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/esm2022/testing/src/test_bed_compiler.mjs +3 -8
- package/esm2022/testing/src/testing_internal.mjs +1 -2
- package/fesm2022/core.mjs +121 -49
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/testing.mjs +118 -54
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/ng-generate/standalone-migration/bundle.js +618 -161
- package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
- package/testing/index.d.ts +1 -1
- package/esm2022/testing/src/ng_zone_mock.mjs +0 -34
|
@@ -2093,6 +2093,7 @@ var FixupExpression = class extends Expression {
|
|
|
2093
2093
|
constructor(resolved) {
|
|
2094
2094
|
super(resolved.type);
|
|
2095
2095
|
this.resolved = resolved;
|
|
2096
|
+
this.shared = false;
|
|
2096
2097
|
this.original = resolved;
|
|
2097
2098
|
}
|
|
2098
2099
|
visitExpression(visitor, context) {
|
|
@@ -3978,11 +3979,12 @@ var Container = class {
|
|
|
3978
3979
|
}
|
|
3979
3980
|
};
|
|
3980
3981
|
var Icu2 = class {
|
|
3981
|
-
constructor(expression, type, cases, sourceSpan) {
|
|
3982
|
+
constructor(expression, type, cases, sourceSpan, expressionPlaceholder) {
|
|
3982
3983
|
this.expression = expression;
|
|
3983
3984
|
this.type = type;
|
|
3984
3985
|
this.cases = cases;
|
|
3985
3986
|
this.sourceSpan = sourceSpan;
|
|
3987
|
+
this.expressionPlaceholder = expressionPlaceholder;
|
|
3986
3988
|
}
|
|
3987
3989
|
visit(visitor, context) {
|
|
3988
3990
|
return visitor.visitIcu(this, context);
|
|
@@ -4035,8 +4037,7 @@ var CloneVisitor = class {
|
|
|
4035
4037
|
visitIcu(icu, context) {
|
|
4036
4038
|
const cases = {};
|
|
4037
4039
|
Object.keys(icu.cases).forEach((key) => cases[key] = icu.cases[key].visit(this, context));
|
|
4038
|
-
const msg = new Icu2(icu.expression, icu.type, cases, icu.sourceSpan);
|
|
4039
|
-
msg.expressionPlaceholder = icu.expressionPlaceholder;
|
|
4040
|
+
const msg = new Icu2(icu.expression, icu.type, cases, icu.sourceSpan, icu.expressionPlaceholder);
|
|
4040
4041
|
return msg;
|
|
4041
4042
|
}
|
|
4042
4043
|
visitTagPlaceholder(ph, context) {
|
|
@@ -7377,6 +7378,10 @@ var TRAIT_CONSUMES_SLOT = {
|
|
|
7377
7378
|
slot: null,
|
|
7378
7379
|
numSlotsUsed: 1
|
|
7379
7380
|
};
|
|
7381
|
+
var TRAIT_USES_SLOT_INDEX = {
|
|
7382
|
+
[UsesSlotIndex]: true,
|
|
7383
|
+
slot: null
|
|
7384
|
+
};
|
|
7380
7385
|
var TRAIT_DEPENDS_ON_SLOT_CONTEXT = {
|
|
7381
7386
|
[DependsOnSlotContext]: true
|
|
7382
7387
|
};
|
|
@@ -7392,8 +7397,8 @@ function hasDependsOnSlotContextTrait(op) {
|
|
|
7392
7397
|
function hasConsumesVarsTrait(value) {
|
|
7393
7398
|
return value[ConsumesVarsTrait] === true;
|
|
7394
7399
|
}
|
|
7395
|
-
function hasUsesSlotIndexTrait(
|
|
7396
|
-
return
|
|
7400
|
+
function hasUsesSlotIndexTrait(value) {
|
|
7401
|
+
return value[UsesSlotIndex] === true;
|
|
7397
7402
|
}
|
|
7398
7403
|
|
|
7399
7404
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/expression.mjs
|
|
@@ -7465,11 +7470,12 @@ var NextContextExpr = class extends ExpressionBase {
|
|
|
7465
7470
|
constructor() {
|
|
7466
7471
|
super();
|
|
7467
7472
|
this.kind = ExpressionKind.NextContext;
|
|
7473
|
+
this.steps = 1;
|
|
7468
7474
|
}
|
|
7469
7475
|
visitExpression() {
|
|
7470
7476
|
}
|
|
7471
7477
|
isEquivalent(e) {
|
|
7472
|
-
return e instanceof NextContextExpr;
|
|
7478
|
+
return e instanceof NextContextExpr && e.steps === this.steps;
|
|
7473
7479
|
}
|
|
7474
7480
|
isConstant() {
|
|
7475
7481
|
return false;
|
|
@@ -7517,9 +7523,9 @@ var RestoreViewExpr = class extends ExpressionBase {
|
|
|
7517
7523
|
isConstant() {
|
|
7518
7524
|
return false;
|
|
7519
7525
|
}
|
|
7520
|
-
transformInternalExpressions(transform) {
|
|
7526
|
+
transformInternalExpressions(transform, flags) {
|
|
7521
7527
|
if (typeof this.view !== "number") {
|
|
7522
|
-
this.view = transformExpressionsInExpression(this.view, transform);
|
|
7528
|
+
this.view = transformExpressionsInExpression(this.view, transform, flags);
|
|
7523
7529
|
}
|
|
7524
7530
|
}
|
|
7525
7531
|
};
|
|
@@ -7538,8 +7544,8 @@ var ResetViewExpr = class extends ExpressionBase {
|
|
|
7538
7544
|
isConstant() {
|
|
7539
7545
|
return false;
|
|
7540
7546
|
}
|
|
7541
|
-
transformInternalExpressions(transform) {
|
|
7542
|
-
this.expr = transformExpressionsInExpression(this.expr, transform);
|
|
7547
|
+
transformInternalExpressions(transform, flags) {
|
|
7548
|
+
this.expr = transformExpressionsInExpression(this.expr, transform, flags);
|
|
7543
7549
|
}
|
|
7544
7550
|
};
|
|
7545
7551
|
var ReadVariableExpr = class extends ExpressionBase {
|
|
@@ -7561,30 +7567,35 @@ var ReadVariableExpr = class extends ExpressionBase {
|
|
|
7561
7567
|
}
|
|
7562
7568
|
};
|
|
7563
7569
|
function visitExpressionsInOp(op, visitor) {
|
|
7564
|
-
transformExpressionsInOp(op, (expr) => {
|
|
7565
|
-
visitor(expr);
|
|
7570
|
+
transformExpressionsInOp(op, (expr, flags) => {
|
|
7571
|
+
visitor(expr, flags);
|
|
7566
7572
|
return expr;
|
|
7567
|
-
});
|
|
7568
|
-
}
|
|
7569
|
-
|
|
7573
|
+
}, VisitorContextFlag.None);
|
|
7574
|
+
}
|
|
7575
|
+
var VisitorContextFlag;
|
|
7576
|
+
(function(VisitorContextFlag2) {
|
|
7577
|
+
VisitorContextFlag2[VisitorContextFlag2["None"] = 0] = "None";
|
|
7578
|
+
VisitorContextFlag2[VisitorContextFlag2["InChildOperation"] = 1] = "InChildOperation";
|
|
7579
|
+
})(VisitorContextFlag || (VisitorContextFlag = {}));
|
|
7580
|
+
function transformExpressionsInOp(op, transform, flags) {
|
|
7570
7581
|
switch (op.kind) {
|
|
7571
7582
|
case OpKind.Property:
|
|
7572
|
-
op.expression = transformExpressionsInExpression(op.expression, transform);
|
|
7583
|
+
op.expression = transformExpressionsInExpression(op.expression, transform, flags);
|
|
7573
7584
|
break;
|
|
7574
7585
|
case OpKind.Statement:
|
|
7575
|
-
transformExpressionsInStatement(op.statement, transform);
|
|
7586
|
+
transformExpressionsInStatement(op.statement, transform, flags);
|
|
7576
7587
|
break;
|
|
7577
7588
|
case OpKind.Variable:
|
|
7578
|
-
op.initializer = transformExpressionsInExpression(op.initializer, transform);
|
|
7589
|
+
op.initializer = transformExpressionsInExpression(op.initializer, transform, flags);
|
|
7579
7590
|
break;
|
|
7580
7591
|
case OpKind.InterpolateText:
|
|
7581
7592
|
for (let i = 0; i < op.expressions.length; i++) {
|
|
7582
|
-
op.expressions[i] = transformExpressionsInExpression(op.expressions[i], transform);
|
|
7593
|
+
op.expressions[i] = transformExpressionsInExpression(op.expressions[i], transform, flags);
|
|
7583
7594
|
}
|
|
7584
7595
|
break;
|
|
7585
7596
|
case OpKind.Listener:
|
|
7586
7597
|
for (const innerOp of op.handlerOps) {
|
|
7587
|
-
transformExpressionsInOp(innerOp, transform);
|
|
7598
|
+
transformExpressionsInOp(innerOp, transform, flags | VisitorContextFlag.InChildOperation);
|
|
7588
7599
|
}
|
|
7589
7600
|
break;
|
|
7590
7601
|
case OpKind.Element:
|
|
@@ -7592,24 +7603,25 @@ function transformExpressionsInOp(op, transform) {
|
|
|
7592
7603
|
case OpKind.ElementEnd:
|
|
7593
7604
|
case OpKind.Template:
|
|
7594
7605
|
case OpKind.Text:
|
|
7606
|
+
case OpKind.Advance:
|
|
7595
7607
|
break;
|
|
7596
7608
|
default:
|
|
7597
7609
|
throw new Error(`AssertionError: transformExpressionsInOp doesn't handle ${OpKind[op.kind]}`);
|
|
7598
7610
|
}
|
|
7599
7611
|
}
|
|
7600
|
-
function transformExpressionsInExpression(expr, transform) {
|
|
7612
|
+
function transformExpressionsInExpression(expr, transform, flags) {
|
|
7601
7613
|
if (expr instanceof ExpressionBase) {
|
|
7602
|
-
expr.transformInternalExpressions(transform);
|
|
7603
|
-
return transform(expr);
|
|
7614
|
+
expr.transformInternalExpressions(transform, flags);
|
|
7615
|
+
return transform(expr, flags);
|
|
7604
7616
|
} else if (expr instanceof BinaryOperatorExpr) {
|
|
7605
|
-
expr.lhs = transformExpressionsInExpression(expr.lhs, transform);
|
|
7606
|
-
expr.rhs = transformExpressionsInExpression(expr.rhs, transform);
|
|
7617
|
+
expr.lhs = transformExpressionsInExpression(expr.lhs, transform, flags);
|
|
7618
|
+
expr.rhs = transformExpressionsInExpression(expr.rhs, transform, flags);
|
|
7607
7619
|
} else if (expr instanceof ReadPropExpr) {
|
|
7608
|
-
expr.receiver = transformExpressionsInExpression(expr.receiver, transform);
|
|
7620
|
+
expr.receiver = transformExpressionsInExpression(expr.receiver, transform, flags);
|
|
7609
7621
|
} else if (expr instanceof InvokeFunctionExpr) {
|
|
7610
|
-
expr.fn = transformExpressionsInExpression(expr.fn, transform);
|
|
7622
|
+
expr.fn = transformExpressionsInExpression(expr.fn, transform, flags);
|
|
7611
7623
|
for (let i = 0; i < expr.args.length; i++) {
|
|
7612
|
-
expr.args[i] = transformExpressionsInExpression(expr.args[i], transform);
|
|
7624
|
+
expr.args[i] = transformExpressionsInExpression(expr.args[i], transform, flags);
|
|
7613
7625
|
}
|
|
7614
7626
|
} else if (expr instanceof ReadVarExpr || expr instanceof ExternalExpr || expr instanceof LiteralExpr) {
|
|
7615
7627
|
} else {
|
|
@@ -7617,11 +7629,11 @@ function transformExpressionsInExpression(expr, transform) {
|
|
|
7617
7629
|
}
|
|
7618
7630
|
return expr;
|
|
7619
7631
|
}
|
|
7620
|
-
function transformExpressionsInStatement(stmt, transform) {
|
|
7632
|
+
function transformExpressionsInStatement(stmt, transform, flags) {
|
|
7621
7633
|
if (stmt instanceof ExpressionStatement) {
|
|
7622
|
-
stmt.expr = transformExpressionsInExpression(stmt.expr, transform);
|
|
7634
|
+
stmt.expr = transformExpressionsInExpression(stmt.expr, transform, flags);
|
|
7623
7635
|
} else if (stmt instanceof ReturnStatement) {
|
|
7624
|
-
stmt.value = transformExpressionsInExpression(stmt.value, transform);
|
|
7636
|
+
stmt.value = transformExpressionsInExpression(stmt.value, transform, flags);
|
|
7625
7637
|
} else {
|
|
7626
7638
|
throw new Error(`Unhandled statement kind: ${stmt.constructor.name}`);
|
|
7627
7639
|
}
|
|
@@ -7678,12 +7690,21 @@ var _OpList = class {
|
|
|
7678
7690
|
*[Symbol.iterator]() {
|
|
7679
7691
|
let current = this.head.next;
|
|
7680
7692
|
while (current !== this.tail) {
|
|
7681
|
-
_OpList.assertIsOwned(current);
|
|
7693
|
+
_OpList.assertIsOwned(current, this.debugListId);
|
|
7682
7694
|
const next = current.next;
|
|
7683
7695
|
yield current;
|
|
7684
7696
|
current = next;
|
|
7685
7697
|
}
|
|
7686
7698
|
}
|
|
7699
|
+
*reversed() {
|
|
7700
|
+
let current = this.tail.prev;
|
|
7701
|
+
while (current !== this.head) {
|
|
7702
|
+
_OpList.assertIsOwned(current, this.debugListId);
|
|
7703
|
+
const prev = current.prev;
|
|
7704
|
+
yield current;
|
|
7705
|
+
current = prev;
|
|
7706
|
+
}
|
|
7707
|
+
}
|
|
7687
7708
|
static replace(oldOp, newOp) {
|
|
7688
7709
|
_OpList.assertIsNotEnd(oldOp);
|
|
7689
7710
|
_OpList.assertIsNotEnd(newOp);
|
|
@@ -7751,7 +7772,7 @@ var _OpList = class {
|
|
|
7751
7772
|
_OpList.assertIsNotEnd(before);
|
|
7752
7773
|
_OpList.assertIsNotEnd(op);
|
|
7753
7774
|
_OpList.assertIsUnowned(op);
|
|
7754
|
-
_OpList.assertIsOwned(before
|
|
7775
|
+
_OpList.assertIsOwned(before);
|
|
7755
7776
|
op.debugListId = before.debugListId;
|
|
7756
7777
|
op.prev = null;
|
|
7757
7778
|
before.prev.next = op;
|
|
@@ -7793,7 +7814,6 @@ function createVariableOp(xref, variable2, initializer) {
|
|
|
7793
7814
|
return __spreadValues({
|
|
7794
7815
|
kind: OpKind.Variable,
|
|
7795
7816
|
xref,
|
|
7796
|
-
name: null,
|
|
7797
7817
|
variable: variable2,
|
|
7798
7818
|
initializer
|
|
7799
7819
|
}, NEW_OP);
|
|
@@ -7838,14 +7858,15 @@ function createTextOp(xref, initialValue) {
|
|
|
7838
7858
|
initialValue
|
|
7839
7859
|
}, TRAIT_CONSUMES_SLOT), NEW_OP);
|
|
7840
7860
|
}
|
|
7841
|
-
function createListenerOp(
|
|
7842
|
-
return __spreadValues({
|
|
7861
|
+
function createListenerOp(target, name, tag) {
|
|
7862
|
+
return __spreadValues(__spreadValues({
|
|
7843
7863
|
kind: OpKind.Listener,
|
|
7844
|
-
|
|
7864
|
+
target,
|
|
7865
|
+
tag,
|
|
7845
7866
|
name,
|
|
7846
7867
|
handlerOps: new OpList(),
|
|
7847
7868
|
handlerFnName: null
|
|
7848
|
-
}, NEW_OP);
|
|
7869
|
+
}, NEW_OP), TRAIT_USES_SLOT_INDEX);
|
|
7849
7870
|
}
|
|
7850
7871
|
|
|
7851
7872
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/ir/src/ops/update.mjs
|
|
@@ -7950,7 +7971,7 @@ function phaseGenerateAdvance(cpl) {
|
|
|
7950
7971
|
if (delta < 0) {
|
|
7951
7972
|
throw new Error(`AssertionError: slot counter should never need to move backwards`);
|
|
7952
7973
|
}
|
|
7953
|
-
OpList.insertBefore(
|
|
7974
|
+
OpList.insertBefore(createAdvanceOp(delta), op);
|
|
7954
7975
|
slotContext = slot;
|
|
7955
7976
|
}
|
|
7956
7977
|
}
|
|
@@ -8008,8 +8029,8 @@ function reference(slot) {
|
|
|
8008
8029
|
literal(slot)
|
|
8009
8030
|
]);
|
|
8010
8031
|
}
|
|
8011
|
-
function nextContext() {
|
|
8012
|
-
return importExpr(Identifiers.nextContext).callFn([]);
|
|
8032
|
+
function nextContext(steps) {
|
|
8033
|
+
return importExpr(Identifiers.nextContext).callFn(steps === 1 ? [] : [literal(steps)]);
|
|
8013
8034
|
}
|
|
8014
8035
|
function getCurrentView() {
|
|
8015
8036
|
return importExpr(Identifiers.getCurrentView).callFn([]);
|
|
@@ -8020,7 +8041,7 @@ function restoreView(savedView) {
|
|
|
8020
8041
|
]);
|
|
8021
8042
|
}
|
|
8022
8043
|
function resetView(returnValue) {
|
|
8023
|
-
return importExpr(Identifiers.
|
|
8044
|
+
return importExpr(Identifiers.resetView).callFn([
|
|
8024
8045
|
returnValue
|
|
8025
8046
|
]);
|
|
8026
8047
|
}
|
|
@@ -8042,11 +8063,15 @@ function textInterpolate(strings, expressions) {
|
|
|
8042
8063
|
throw new Error(`AssertionError: expected specific shape of args for strings/expressions in interpolation`);
|
|
8043
8064
|
}
|
|
8044
8065
|
const interpolationArgs = [];
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
|
|
8066
|
+
if (expressions.length === 1 && strings[0] === "" && strings[1] === "") {
|
|
8067
|
+
interpolationArgs.push(expressions[0]);
|
|
8068
|
+
} else {
|
|
8069
|
+
let idx;
|
|
8070
|
+
for (idx = 0; idx < expressions.length; idx++) {
|
|
8071
|
+
interpolationArgs.push(literal(strings[idx]), expressions[idx]);
|
|
8072
|
+
}
|
|
8073
|
+
interpolationArgs.push(literal(strings[idx]));
|
|
8048
8074
|
}
|
|
8049
|
-
interpolationArgs.push(literal(strings[idx]));
|
|
8050
8075
|
return callInterpolation(TEXT_INTERPOLATE_CONFIG, [], interpolationArgs);
|
|
8051
8076
|
}
|
|
8052
8077
|
function call(instruction, args) {
|
|
@@ -8087,7 +8112,7 @@ function phaseReify(cpl) {
|
|
|
8087
8112
|
}
|
|
8088
8113
|
function reifyCreateOperations(view, ops) {
|
|
8089
8114
|
for (const op of ops) {
|
|
8090
|
-
transformExpressionsInOp(op, reifyIrExpression);
|
|
8115
|
+
transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
|
|
8091
8116
|
switch (op.kind) {
|
|
8092
8117
|
case OpKind.Text:
|
|
8093
8118
|
OpList.replace(op, text(op.slot, op.initialValue));
|
|
@@ -8103,17 +8128,17 @@ function reifyCreateOperations(view, ops) {
|
|
|
8103
8128
|
break;
|
|
8104
8129
|
case OpKind.Template:
|
|
8105
8130
|
const childView = view.tpl.views.get(op.xref);
|
|
8106
|
-
OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.
|
|
8131
|
+
OpList.replace(op, template(op.slot, variable(childView.fnName), childView.decls, childView.vars, op.tag, op.attributes));
|
|
8107
8132
|
break;
|
|
8108
8133
|
case OpKind.Listener:
|
|
8109
8134
|
const listenerFn = reifyListenerHandler(view, op.handlerFnName, op.handlerOps);
|
|
8110
8135
|
OpList.replace(op, listener(op.name, listenerFn));
|
|
8111
8136
|
break;
|
|
8112
8137
|
case OpKind.Variable:
|
|
8113
|
-
if (op.name === null) {
|
|
8138
|
+
if (op.variable.name === null) {
|
|
8114
8139
|
throw new Error(`AssertionError: unnamed variable ${op.xref}`);
|
|
8115
8140
|
}
|
|
8116
|
-
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.name, op.initializer)));
|
|
8141
|
+
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer, void 0, StmtModifier.Final)));
|
|
8117
8142
|
break;
|
|
8118
8143
|
case OpKind.Statement:
|
|
8119
8144
|
break;
|
|
@@ -8124,7 +8149,7 @@ function reifyCreateOperations(view, ops) {
|
|
|
8124
8149
|
}
|
|
8125
8150
|
function reifyUpdateOperations(_view, ops) {
|
|
8126
8151
|
for (const op of ops) {
|
|
8127
|
-
transformExpressionsInOp(op, reifyIrExpression);
|
|
8152
|
+
transformExpressionsInOp(op, reifyIrExpression, VisitorContextFlag.None);
|
|
8128
8153
|
switch (op.kind) {
|
|
8129
8154
|
case OpKind.Advance:
|
|
8130
8155
|
OpList.replace(op, advance(op.delta));
|
|
@@ -8136,10 +8161,10 @@ function reifyUpdateOperations(_view, ops) {
|
|
|
8136
8161
|
OpList.replace(op, textInterpolate(op.strings, op.expressions));
|
|
8137
8162
|
break;
|
|
8138
8163
|
case OpKind.Variable:
|
|
8139
|
-
if (op.name === null) {
|
|
8164
|
+
if (op.variable.name === null) {
|
|
8140
8165
|
throw new Error(`AssertionError: unnamed variable ${op.xref}`);
|
|
8141
8166
|
}
|
|
8142
|
-
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.name, op.initializer)));
|
|
8167
|
+
OpList.replace(op, createStatementOp(new DeclareVarStmt(op.variable.name, op.initializer, void 0, StmtModifier.Final)));
|
|
8143
8168
|
break;
|
|
8144
8169
|
case OpKind.Statement:
|
|
8145
8170
|
break;
|
|
@@ -8151,7 +8176,7 @@ function reifyUpdateOperations(_view, ops) {
|
|
|
8151
8176
|
function reifyIrExpression(expr) {
|
|
8152
8177
|
switch (expr.kind) {
|
|
8153
8178
|
case ExpressionKind.NextContext:
|
|
8154
|
-
return nextContext();
|
|
8179
|
+
return nextContext(expr.steps);
|
|
8155
8180
|
case ExpressionKind.Reference:
|
|
8156
8181
|
return reference(expr.slot + 1 + expr.offset);
|
|
8157
8182
|
case ExpressionKind.LexicalRead:
|
|
@@ -8224,6 +8249,12 @@ function phaseSlotAllocation(cpl) {
|
|
|
8224
8249
|
const childView = cpl.views.get(op.xref);
|
|
8225
8250
|
op.decls = childView.decls;
|
|
8226
8251
|
}
|
|
8252
|
+
if (hasUsesSlotIndexTrait(op) && op.slot === null) {
|
|
8253
|
+
if (!slotMap.has(op.target)) {
|
|
8254
|
+
throw new Error(`AssertionError: no slot allocated for ${OpKind[op.kind]} target ${op.target}`);
|
|
8255
|
+
}
|
|
8256
|
+
op.slot = slotMap.get(op.target);
|
|
8257
|
+
}
|
|
8227
8258
|
visitExpressionsInOp(op, (expr) => {
|
|
8228
8259
|
if (!hasUsesSlotIndexTrait(expr) || expr.slot !== null) {
|
|
8229
8260
|
return;
|
|
@@ -8279,40 +8310,60 @@ function varsUsedByIrExpression(expr) {
|
|
|
8279
8310
|
|
|
8280
8311
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/naming.mjs
|
|
8281
8312
|
function phaseNaming(cpl) {
|
|
8282
|
-
cpl.root
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
break;
|
|
8296
|
-
case OpKind.Variable:
|
|
8297
|
-
if (op.name === null) {
|
|
8298
|
-
op.name = `_r${vIndex++}`;
|
|
8299
|
-
varNames.set(op.xref, op.name);
|
|
8313
|
+
addNamesToView(cpl.root, cpl.componentName, { index: 0 });
|
|
8314
|
+
}
|
|
8315
|
+
function addNamesToView(view, baseName, state) {
|
|
8316
|
+
if (view.fnName === null) {
|
|
8317
|
+
view.fnName = `${baseName}_Template`;
|
|
8318
|
+
}
|
|
8319
|
+
const varNames = /* @__PURE__ */ new Map();
|
|
8320
|
+
for (const op of view.ops()) {
|
|
8321
|
+
switch (op.kind) {
|
|
8322
|
+
case OpKind.Listener:
|
|
8323
|
+
if (op.handlerFnName === null) {
|
|
8324
|
+
if (op.slot === null) {
|
|
8325
|
+
throw new Error(`Expected a slot to be assigned`);
|
|
8300
8326
|
}
|
|
8301
|
-
|
|
8302
|
-
}
|
|
8303
|
-
}
|
|
8304
|
-
for (const op of view.ops()) {
|
|
8305
|
-
visitExpressionsInOp(op, (expr) => {
|
|
8306
|
-
if (!(expr instanceof ReadVariableExpr) || expr.name !== null) {
|
|
8307
|
-
return;
|
|
8327
|
+
op.handlerFnName = `${view.fnName}_${op.tag}_${op.name}_${op.slot}_listener`;
|
|
8308
8328
|
}
|
|
8309
|
-
|
|
8310
|
-
|
|
8329
|
+
break;
|
|
8330
|
+
case OpKind.Variable:
|
|
8331
|
+
varNames.set(op.xref, getVariableName(op.variable, state));
|
|
8332
|
+
break;
|
|
8333
|
+
case OpKind.Template:
|
|
8334
|
+
const childView = view.tpl.views.get(op.xref);
|
|
8335
|
+
if (op.slot === null) {
|
|
8336
|
+
throw new Error(`Expected slot to be assigned`);
|
|
8311
8337
|
}
|
|
8312
|
-
|
|
8313
|
-
|
|
8338
|
+
const safeTagName = op.tag.replace("-", "_");
|
|
8339
|
+
addNamesToView(childView, `${baseName}_${safeTagName}_${op.slot}`, state);
|
|
8340
|
+
break;
|
|
8341
|
+
}
|
|
8342
|
+
}
|
|
8343
|
+
for (const op of view.ops()) {
|
|
8344
|
+
visitExpressionsInOp(op, (expr) => {
|
|
8345
|
+
if (!(expr instanceof ReadVariableExpr) || expr.name !== null) {
|
|
8346
|
+
return;
|
|
8347
|
+
}
|
|
8348
|
+
if (!varNames.has(expr.xref)) {
|
|
8349
|
+
throw new Error(`Variable ${expr.xref} not yet named`);
|
|
8350
|
+
}
|
|
8351
|
+
expr.name = varNames.get(expr.xref);
|
|
8352
|
+
});
|
|
8353
|
+
}
|
|
8354
|
+
}
|
|
8355
|
+
function getVariableName(variable2, state) {
|
|
8356
|
+
if (variable2.name === null) {
|
|
8357
|
+
switch (variable2.kind) {
|
|
8358
|
+
case SemanticVariableKind.Identifier:
|
|
8359
|
+
variable2.name = `${variable2.identifier}_${state.index++}`;
|
|
8360
|
+
break;
|
|
8361
|
+
default:
|
|
8362
|
+
variable2.name = `_r${state.index++}`;
|
|
8363
|
+
break;
|
|
8314
8364
|
}
|
|
8315
8365
|
}
|
|
8366
|
+
return variable2.name;
|
|
8316
8367
|
}
|
|
8317
8368
|
|
|
8318
8369
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/local_refs.mjs
|
|
@@ -8353,10 +8404,7 @@ function phaseGenerateVariables(cpl) {
|
|
|
8353
8404
|
function recursivelyProcessView(view, parentScope) {
|
|
8354
8405
|
const scope = getScopeForView(view, parentScope);
|
|
8355
8406
|
view.create.prepend([
|
|
8356
|
-
createVariableOp(view.tpl.allocateXrefId(),
|
|
8357
|
-
kind: SemanticVariableKind.SavedView,
|
|
8358
|
-
view: view.xref
|
|
8359
|
-
}, new GetCurrentViewExpr())
|
|
8407
|
+
createVariableOp(view.tpl.allocateXrefId(), scope.savedViewVariable, new GetCurrentViewExpr())
|
|
8360
8408
|
]);
|
|
8361
8409
|
for (const op of view.create) {
|
|
8362
8410
|
switch (op.kind) {
|
|
@@ -8365,10 +8413,7 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
8365
8413
|
break;
|
|
8366
8414
|
case OpKind.Listener:
|
|
8367
8415
|
const preambleOps2 = [
|
|
8368
|
-
createVariableOp(view.tpl.allocateXrefId(),
|
|
8369
|
-
kind: SemanticVariableKind.Context,
|
|
8370
|
-
view: view.xref
|
|
8371
|
-
}, new RestoreViewExpr(view.xref)),
|
|
8416
|
+
createVariableOp(view.tpl.allocateXrefId(), scope.viewContextVariable, new RestoreViewExpr(view.xref)),
|
|
8372
8417
|
...generateVariablesInScopeForView(view, scope)
|
|
8373
8418
|
];
|
|
8374
8419
|
op.handlerOps.prepend(preambleOps2);
|
|
@@ -8386,9 +8431,27 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
8386
8431
|
function getScopeForView(view, parent) {
|
|
8387
8432
|
const scope = {
|
|
8388
8433
|
view: view.xref,
|
|
8434
|
+
viewContextVariable: {
|
|
8435
|
+
kind: SemanticVariableKind.Context,
|
|
8436
|
+
name: null,
|
|
8437
|
+
view: view.xref
|
|
8438
|
+
},
|
|
8439
|
+
savedViewVariable: {
|
|
8440
|
+
kind: SemanticVariableKind.SavedView,
|
|
8441
|
+
name: null,
|
|
8442
|
+
view: view.xref
|
|
8443
|
+
},
|
|
8444
|
+
contextVariables: /* @__PURE__ */ new Map(),
|
|
8389
8445
|
references: [],
|
|
8390
8446
|
parent
|
|
8391
8447
|
};
|
|
8448
|
+
for (const identifier of view.contextVariables.keys()) {
|
|
8449
|
+
scope.contextVariables.set(identifier, {
|
|
8450
|
+
kind: SemanticVariableKind.Identifier,
|
|
8451
|
+
name: null,
|
|
8452
|
+
identifier
|
|
8453
|
+
});
|
|
8454
|
+
}
|
|
8392
8455
|
for (const op of view.create) {
|
|
8393
8456
|
switch (op.kind) {
|
|
8394
8457
|
case OpKind.Element:
|
|
@@ -8401,7 +8464,12 @@ function getScopeForView(view, parent) {
|
|
|
8401
8464
|
scope.references.push({
|
|
8402
8465
|
name: op.localRefs[offset].name,
|
|
8403
8466
|
targetId: op.xref,
|
|
8404
|
-
offset
|
|
8467
|
+
offset,
|
|
8468
|
+
variable: {
|
|
8469
|
+
kind: SemanticVariableKind.Identifier,
|
|
8470
|
+
name: null,
|
|
8471
|
+
identifier: op.localRefs[offset].name
|
|
8472
|
+
}
|
|
8405
8473
|
});
|
|
8406
8474
|
}
|
|
8407
8475
|
break;
|
|
@@ -8412,22 +8480,13 @@ function getScopeForView(view, parent) {
|
|
|
8412
8480
|
function generateVariablesInScopeForView(view, scope) {
|
|
8413
8481
|
const newOps = [];
|
|
8414
8482
|
if (scope.view !== view.xref) {
|
|
8415
|
-
newOps.push(createVariableOp(view.tpl.allocateXrefId(),
|
|
8416
|
-
kind: SemanticVariableKind.Context,
|
|
8417
|
-
view: scope.view
|
|
8418
|
-
}, new NextContextExpr()));
|
|
8483
|
+
newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.viewContextVariable, new NextContextExpr()));
|
|
8419
8484
|
}
|
|
8420
8485
|
for (const [name, value] of view.tpl.views.get(scope.view).contextVariables) {
|
|
8421
|
-
newOps.push(createVariableOp(view.tpl.allocateXrefId(),
|
|
8422
|
-
kind: SemanticVariableKind.Identifier,
|
|
8423
|
-
name
|
|
8424
|
-
}, new ReadPropExpr(new ContextExpr(view.xref), value)));
|
|
8486
|
+
newOps.push(createVariableOp(view.tpl.allocateXrefId(), scope.contextVariables.get(name), new ReadPropExpr(new ContextExpr(scope.view), value)));
|
|
8425
8487
|
}
|
|
8426
8488
|
for (const ref of scope.references) {
|
|
8427
|
-
newOps.push(createVariableOp(view.tpl.allocateXrefId(),
|
|
8428
|
-
kind: SemanticVariableKind.Identifier,
|
|
8429
|
-
name: ref.name
|
|
8430
|
-
}, new ReferenceExpr(ref.targetId, ref.offset)));
|
|
8489
|
+
newOps.push(createVariableOp(view.tpl.allocateXrefId(), ref.variable, new ReferenceExpr(ref.targetId, ref.offset)));
|
|
8431
8490
|
}
|
|
8432
8491
|
if (scope.parent !== null) {
|
|
8433
8492
|
newOps.push(...generateVariablesInScopeForView(view, scope.parent));
|
|
@@ -8449,10 +8508,10 @@ function processLexicalScope(view, ops, savedView) {
|
|
|
8449
8508
|
case OpKind.Variable:
|
|
8450
8509
|
switch (op.variable.kind) {
|
|
8451
8510
|
case SemanticVariableKind.Identifier:
|
|
8452
|
-
if (scope.has(op.variable.
|
|
8511
|
+
if (scope.has(op.variable.identifier)) {
|
|
8453
8512
|
continue;
|
|
8454
8513
|
}
|
|
8455
|
-
scope.set(op.variable.
|
|
8514
|
+
scope.set(op.variable.identifier, op.xref);
|
|
8456
8515
|
break;
|
|
8457
8516
|
case SemanticVariableKind.SavedView:
|
|
8458
8517
|
savedView = {
|
|
@@ -8484,7 +8543,7 @@ function processLexicalScope(view, ops, savedView) {
|
|
|
8484
8543
|
} else {
|
|
8485
8544
|
return expr;
|
|
8486
8545
|
}
|
|
8487
|
-
});
|
|
8546
|
+
}, VisitorContextFlag.None);
|
|
8488
8547
|
}
|
|
8489
8548
|
}
|
|
8490
8549
|
|
|
@@ -8522,7 +8581,290 @@ function processLexicalScope2(view, ops) {
|
|
|
8522
8581
|
} else {
|
|
8523
8582
|
return expr;
|
|
8524
8583
|
}
|
|
8525
|
-
});
|
|
8584
|
+
}, VisitorContextFlag.None);
|
|
8585
|
+
}
|
|
8586
|
+
}
|
|
8587
|
+
|
|
8588
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/variable_optimization.mjs
|
|
8589
|
+
function phaseVariableOptimization(cpl, options) {
|
|
8590
|
+
for (const [_, view] of cpl.views) {
|
|
8591
|
+
optimizeVariablesInOpList(view.create, options);
|
|
8592
|
+
optimizeVariablesInOpList(view.update, options);
|
|
8593
|
+
for (const op of view.create) {
|
|
8594
|
+
if (op.kind === OpKind.Listener) {
|
|
8595
|
+
optimizeVariablesInOpList(op.handlerOps, options);
|
|
8596
|
+
}
|
|
8597
|
+
}
|
|
8598
|
+
}
|
|
8599
|
+
}
|
|
8600
|
+
var Fence;
|
|
8601
|
+
(function(Fence2) {
|
|
8602
|
+
Fence2[Fence2["None"] = 0] = "None";
|
|
8603
|
+
Fence2[Fence2["ViewContextRead"] = 1] = "ViewContextRead";
|
|
8604
|
+
Fence2[Fence2["ViewContextWrite"] = 3] = "ViewContextWrite";
|
|
8605
|
+
Fence2[Fence2["SideEffectful"] = 4] = "SideEffectful";
|
|
8606
|
+
})(Fence || (Fence = {}));
|
|
8607
|
+
function optimizeVariablesInOpList(ops, options) {
|
|
8608
|
+
const varDecls = /* @__PURE__ */ new Map();
|
|
8609
|
+
const varUsages = /* @__PURE__ */ new Map();
|
|
8610
|
+
const varRemoteUsages = /* @__PURE__ */ new Set();
|
|
8611
|
+
const opMap = /* @__PURE__ */ new Map();
|
|
8612
|
+
for (const op of ops) {
|
|
8613
|
+
if (op.kind === OpKind.Variable) {
|
|
8614
|
+
if (varDecls.has(op.xref) || varUsages.has(op.xref)) {
|
|
8615
|
+
throw new Error(`Should not see two declarations of the same variable: ${op.xref}`);
|
|
8616
|
+
}
|
|
8617
|
+
varDecls.set(op.xref, op);
|
|
8618
|
+
varUsages.set(op.xref, 0);
|
|
8619
|
+
}
|
|
8620
|
+
opMap.set(op, collectOpInfo(op));
|
|
8621
|
+
countVariableUsages(op, varUsages, varRemoteUsages);
|
|
8622
|
+
}
|
|
8623
|
+
let contextIsUsed = false;
|
|
8624
|
+
for (const op of ops.reversed()) {
|
|
8625
|
+
const opInfo = opMap.get(op);
|
|
8626
|
+
if (op.kind === OpKind.Variable && varUsages.get(op.xref) === 0) {
|
|
8627
|
+
if (contextIsUsed && opInfo.fences & Fence.ViewContextWrite || opInfo.fences & Fence.SideEffectful) {
|
|
8628
|
+
const stmtOp = createStatementOp(op.initializer.toStmt());
|
|
8629
|
+
opMap.set(stmtOp, opInfo);
|
|
8630
|
+
OpList.replace(op, stmtOp);
|
|
8631
|
+
} else {
|
|
8632
|
+
uncountVariableUsages(op, varUsages);
|
|
8633
|
+
OpList.remove(op);
|
|
8634
|
+
}
|
|
8635
|
+
opMap.delete(op);
|
|
8636
|
+
varDecls.delete(op.xref);
|
|
8637
|
+
varUsages.delete(op.xref);
|
|
8638
|
+
continue;
|
|
8639
|
+
}
|
|
8640
|
+
if (opInfo.fences & Fence.ViewContextRead) {
|
|
8641
|
+
contextIsUsed = true;
|
|
8642
|
+
}
|
|
8643
|
+
}
|
|
8644
|
+
const toInline = [];
|
|
8645
|
+
for (const [id, count] of varUsages) {
|
|
8646
|
+
if (count !== 1) {
|
|
8647
|
+
continue;
|
|
8648
|
+
}
|
|
8649
|
+
if (varRemoteUsages.has(id)) {
|
|
8650
|
+
continue;
|
|
8651
|
+
}
|
|
8652
|
+
toInline.push(id);
|
|
8653
|
+
}
|
|
8654
|
+
let candidate;
|
|
8655
|
+
while (candidate = toInline.pop()) {
|
|
8656
|
+
const decl = varDecls.get(candidate);
|
|
8657
|
+
const varInfo = opMap.get(decl);
|
|
8658
|
+
for (let targetOp = decl.next; targetOp.kind !== OpKind.ListEnd; targetOp = targetOp.next) {
|
|
8659
|
+
const opInfo = opMap.get(targetOp);
|
|
8660
|
+
if (opInfo.variablesUsed.has(candidate)) {
|
|
8661
|
+
if (options.conservative && !allowConservativeInlining(decl, targetOp)) {
|
|
8662
|
+
break;
|
|
8663
|
+
}
|
|
8664
|
+
if (tryInlineVariableInitializer(candidate, decl.initializer, targetOp, varInfo.fences)) {
|
|
8665
|
+
opInfo.variablesUsed.delete(candidate);
|
|
8666
|
+
for (const id of varInfo.variablesUsed) {
|
|
8667
|
+
opInfo.variablesUsed.add(id);
|
|
8668
|
+
}
|
|
8669
|
+
opInfo.fences |= varInfo.fences;
|
|
8670
|
+
varDecls.delete(candidate);
|
|
8671
|
+
varUsages.delete(candidate);
|
|
8672
|
+
opMap.delete(decl);
|
|
8673
|
+
OpList.remove(decl);
|
|
8674
|
+
}
|
|
8675
|
+
break;
|
|
8676
|
+
}
|
|
8677
|
+
if (!safeToInlinePastFences(opInfo.fences, varInfo.fences)) {
|
|
8678
|
+
break;
|
|
8679
|
+
}
|
|
8680
|
+
}
|
|
8681
|
+
}
|
|
8682
|
+
}
|
|
8683
|
+
function fencesForIrExpression(expr) {
|
|
8684
|
+
switch (expr.kind) {
|
|
8685
|
+
case ExpressionKind.NextContext:
|
|
8686
|
+
return Fence.ViewContextWrite;
|
|
8687
|
+
case ExpressionKind.RestoreView:
|
|
8688
|
+
return Fence.ViewContextWrite | Fence.SideEffectful;
|
|
8689
|
+
case ExpressionKind.Reference:
|
|
8690
|
+
return Fence.ViewContextRead;
|
|
8691
|
+
default:
|
|
8692
|
+
return Fence.None;
|
|
8693
|
+
}
|
|
8694
|
+
}
|
|
8695
|
+
function collectOpInfo(op) {
|
|
8696
|
+
let fences = Fence.None;
|
|
8697
|
+
const variablesUsed = /* @__PURE__ */ new Set();
|
|
8698
|
+
visitExpressionsInOp(op, (expr) => {
|
|
8699
|
+
switch (expr.kind) {
|
|
8700
|
+
case ExpressionKind.ReadVariable:
|
|
8701
|
+
variablesUsed.add(expr.xref);
|
|
8702
|
+
break;
|
|
8703
|
+
default:
|
|
8704
|
+
fences |= fencesForIrExpression(expr);
|
|
8705
|
+
}
|
|
8706
|
+
});
|
|
8707
|
+
return { fences, variablesUsed };
|
|
8708
|
+
}
|
|
8709
|
+
function countVariableUsages(op, varUsages, varRemoteUsage) {
|
|
8710
|
+
visitExpressionsInOp(op, (expr, flags) => {
|
|
8711
|
+
if (expr.kind !== ExpressionKind.ReadVariable) {
|
|
8712
|
+
return;
|
|
8713
|
+
}
|
|
8714
|
+
const count = varUsages.get(expr.xref);
|
|
8715
|
+
if (count === void 0) {
|
|
8716
|
+
return;
|
|
8717
|
+
}
|
|
8718
|
+
varUsages.set(expr.xref, count + 1);
|
|
8719
|
+
if (flags & VisitorContextFlag.InChildOperation) {
|
|
8720
|
+
varRemoteUsage.add(expr.xref);
|
|
8721
|
+
}
|
|
8722
|
+
});
|
|
8723
|
+
}
|
|
8724
|
+
function uncountVariableUsages(op, varUsages) {
|
|
8725
|
+
visitExpressionsInOp(op, (expr) => {
|
|
8726
|
+
if (expr.kind !== ExpressionKind.ReadVariable) {
|
|
8727
|
+
return;
|
|
8728
|
+
}
|
|
8729
|
+
const count = varUsages.get(expr.xref);
|
|
8730
|
+
if (count === void 0) {
|
|
8731
|
+
return;
|
|
8732
|
+
} else if (count === 0) {
|
|
8733
|
+
throw new Error(`Inaccurate variable count: ${expr.xref} - found another read but count is already 0`);
|
|
8734
|
+
}
|
|
8735
|
+
varUsages.set(expr.xref, count - 1);
|
|
8736
|
+
});
|
|
8737
|
+
}
|
|
8738
|
+
function safeToInlinePastFences(fences, declFences) {
|
|
8739
|
+
if (fences & Fence.ViewContextWrite) {
|
|
8740
|
+
if (declFences & Fence.ViewContextRead) {
|
|
8741
|
+
return false;
|
|
8742
|
+
}
|
|
8743
|
+
} else if (fences & Fence.ViewContextRead) {
|
|
8744
|
+
if (declFences & Fence.ViewContextWrite) {
|
|
8745
|
+
return false;
|
|
8746
|
+
}
|
|
8747
|
+
}
|
|
8748
|
+
return true;
|
|
8749
|
+
}
|
|
8750
|
+
function tryInlineVariableInitializer(id, initializer, target, declFences) {
|
|
8751
|
+
let inlined = false;
|
|
8752
|
+
let inliningAllowed = true;
|
|
8753
|
+
transformExpressionsInOp(target, (expr, flags) => {
|
|
8754
|
+
if (inlined || !inliningAllowed) {
|
|
8755
|
+
return expr;
|
|
8756
|
+
} else if (flags & VisitorContextFlag.InChildOperation && declFences & Fence.ViewContextRead) {
|
|
8757
|
+
return expr;
|
|
8758
|
+
}
|
|
8759
|
+
switch (expr.kind) {
|
|
8760
|
+
case ExpressionKind.ReadVariable:
|
|
8761
|
+
if (expr.xref === id) {
|
|
8762
|
+
inlined = true;
|
|
8763
|
+
return initializer;
|
|
8764
|
+
}
|
|
8765
|
+
break;
|
|
8766
|
+
default:
|
|
8767
|
+
const exprFences = fencesForIrExpression(expr);
|
|
8768
|
+
inliningAllowed = inliningAllowed && safeToInlinePastFences(exprFences, declFences);
|
|
8769
|
+
break;
|
|
8770
|
+
}
|
|
8771
|
+
return expr;
|
|
8772
|
+
}, VisitorContextFlag.None);
|
|
8773
|
+
return inlined;
|
|
8774
|
+
}
|
|
8775
|
+
function allowConservativeInlining(decl, target) {
|
|
8776
|
+
switch (decl.variable.kind) {
|
|
8777
|
+
case SemanticVariableKind.Identifier:
|
|
8778
|
+
return false;
|
|
8779
|
+
case SemanticVariableKind.Context:
|
|
8780
|
+
return target.kind === OpKind.Variable;
|
|
8781
|
+
default:
|
|
8782
|
+
return true;
|
|
8783
|
+
}
|
|
8784
|
+
}
|
|
8785
|
+
|
|
8786
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/chaining.mjs
|
|
8787
|
+
var CHAINABLE = /* @__PURE__ */ new Set([
|
|
8788
|
+
Identifiers.elementStart,
|
|
8789
|
+
Identifiers.elementEnd,
|
|
8790
|
+
Identifiers.property
|
|
8791
|
+
]);
|
|
8792
|
+
function phaseChaining(cpl) {
|
|
8793
|
+
for (const [_, view] of cpl.views) {
|
|
8794
|
+
chainOperationsInList(view.create);
|
|
8795
|
+
chainOperationsInList(view.update);
|
|
8796
|
+
}
|
|
8797
|
+
}
|
|
8798
|
+
function chainOperationsInList(opList) {
|
|
8799
|
+
let chain = null;
|
|
8800
|
+
for (const op of opList) {
|
|
8801
|
+
if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement)) {
|
|
8802
|
+
chain = null;
|
|
8803
|
+
continue;
|
|
8804
|
+
}
|
|
8805
|
+
if (!(op.statement.expr instanceof InvokeFunctionExpr) || !(op.statement.expr.fn instanceof ExternalExpr)) {
|
|
8806
|
+
chain = null;
|
|
8807
|
+
continue;
|
|
8808
|
+
}
|
|
8809
|
+
const instruction = op.statement.expr.fn.value;
|
|
8810
|
+
if (!CHAINABLE.has(instruction)) {
|
|
8811
|
+
chain = null;
|
|
8812
|
+
continue;
|
|
8813
|
+
}
|
|
8814
|
+
if (chain !== null && chain.instruction === instruction) {
|
|
8815
|
+
const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
|
|
8816
|
+
chain.expression = expression;
|
|
8817
|
+
chain.op.statement = expression.toStmt();
|
|
8818
|
+
OpList.remove(op);
|
|
8819
|
+
} else {
|
|
8820
|
+
chain = {
|
|
8821
|
+
op,
|
|
8822
|
+
instruction,
|
|
8823
|
+
expression: op.statement.expr
|
|
8824
|
+
};
|
|
8825
|
+
}
|
|
8826
|
+
}
|
|
8827
|
+
}
|
|
8828
|
+
|
|
8829
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/phases/next_context_merging.mjs
|
|
8830
|
+
function phaseMergeNextContext(cpl) {
|
|
8831
|
+
for (const view of cpl.views.values()) {
|
|
8832
|
+
for (const op of view.create) {
|
|
8833
|
+
if (op.kind === OpKind.Listener) {
|
|
8834
|
+
mergeNextContextsInOps(op.handlerOps);
|
|
8835
|
+
}
|
|
8836
|
+
}
|
|
8837
|
+
mergeNextContextsInOps(view.update);
|
|
8838
|
+
}
|
|
8839
|
+
}
|
|
8840
|
+
function mergeNextContextsInOps(ops) {
|
|
8841
|
+
for (const op of ops) {
|
|
8842
|
+
if (op.kind !== OpKind.Statement || !(op.statement instanceof ExpressionStatement) || !(op.statement.expr instanceof NextContextExpr)) {
|
|
8843
|
+
continue;
|
|
8844
|
+
}
|
|
8845
|
+
const mergeSteps = op.statement.expr.steps;
|
|
8846
|
+
let tryToMerge = true;
|
|
8847
|
+
for (let candidate = op.next; candidate.kind !== OpKind.ListEnd && tryToMerge; candidate = candidate.next) {
|
|
8848
|
+
visitExpressionsInOp(candidate, (expr, flags) => {
|
|
8849
|
+
if (!tryToMerge) {
|
|
8850
|
+
return;
|
|
8851
|
+
}
|
|
8852
|
+
if (flags & VisitorContextFlag.InChildOperation) {
|
|
8853
|
+
return;
|
|
8854
|
+
}
|
|
8855
|
+
switch (expr.kind) {
|
|
8856
|
+
case ExpressionKind.NextContext:
|
|
8857
|
+
expr.steps += mergeSteps;
|
|
8858
|
+
OpList.remove(op);
|
|
8859
|
+
tryToMerge = false;
|
|
8860
|
+
break;
|
|
8861
|
+
case ExpressionKind.GetCurrentView:
|
|
8862
|
+
case ExpressionKind.Reference:
|
|
8863
|
+
tryToMerge = false;
|
|
8864
|
+
break;
|
|
8865
|
+
}
|
|
8866
|
+
});
|
|
8867
|
+
}
|
|
8526
8868
|
}
|
|
8527
8869
|
}
|
|
8528
8870
|
|
|
@@ -8538,18 +8880,25 @@ function transformTemplate(cpl) {
|
|
|
8538
8880
|
phaseVarCounting(cpl);
|
|
8539
8881
|
phaseGenerateAdvance(cpl);
|
|
8540
8882
|
phaseNaming(cpl);
|
|
8883
|
+
phaseVariableOptimization(cpl, { conservative: true });
|
|
8884
|
+
phaseMergeNextContext(cpl);
|
|
8541
8885
|
phaseReify(cpl);
|
|
8886
|
+
phaseChaining(cpl);
|
|
8542
8887
|
}
|
|
8543
8888
|
function emitTemplateFn(tpl, pool) {
|
|
8544
8889
|
const rootFn = emitView(tpl.root);
|
|
8545
|
-
|
|
8546
|
-
|
|
8890
|
+
emitChildViews(tpl.root, pool);
|
|
8891
|
+
return rootFn;
|
|
8892
|
+
}
|
|
8893
|
+
function emitChildViews(parent, pool) {
|
|
8894
|
+
for (const view of parent.tpl.views.values()) {
|
|
8895
|
+
if (view.parent !== parent.xref) {
|
|
8547
8896
|
continue;
|
|
8548
8897
|
}
|
|
8898
|
+
emitChildViews(view, pool);
|
|
8549
8899
|
const viewFn = emitView(view);
|
|
8550
8900
|
pool.statements.push(viewFn.toDeclStmt(viewFn.name));
|
|
8551
8901
|
}
|
|
8552
|
-
return rootFn;
|
|
8553
8902
|
}
|
|
8554
8903
|
function emitView(view) {
|
|
8555
8904
|
if (view.fnName === null) {
|
|
@@ -8569,13 +8918,29 @@ function emitView(view) {
|
|
|
8569
8918
|
}
|
|
8570
8919
|
updateStatements.push(op.statement);
|
|
8571
8920
|
}
|
|
8572
|
-
const
|
|
8573
|
-
const
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8921
|
+
const createCond = maybeGenerateRfBlock(1, createStatements);
|
|
8922
|
+
const updateCond = maybeGenerateRfBlock(2, updateStatements);
|
|
8923
|
+
return fn(
|
|
8924
|
+
[
|
|
8925
|
+
new FnParam("rf"),
|
|
8926
|
+
new FnParam("ctx")
|
|
8927
|
+
],
|
|
8928
|
+
[
|
|
8929
|
+
...createCond,
|
|
8930
|
+
...updateCond
|
|
8931
|
+
],
|
|
8932
|
+
void 0,
|
|
8933
|
+
void 0,
|
|
8934
|
+
view.fnName
|
|
8935
|
+
);
|
|
8936
|
+
}
|
|
8937
|
+
function maybeGenerateRfBlock(flag, statements) {
|
|
8938
|
+
if (statements.length === 0) {
|
|
8939
|
+
return [];
|
|
8940
|
+
}
|
|
8941
|
+
return [
|
|
8942
|
+
ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable("rf"), literal(flag)), statements)
|
|
8943
|
+
];
|
|
8579
8944
|
}
|
|
8580
8945
|
|
|
8581
8946
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/template/pipeline/src/compilation.mjs
|
|
@@ -8696,23 +9061,27 @@ function ingestBoundText(view, text2) {
|
|
|
8696
9061
|
}
|
|
8697
9062
|
const textXref = view.tpl.allocateXrefId();
|
|
8698
9063
|
view.create.push(createTextOp(textXref, ""));
|
|
8699
|
-
view.update.push(createInterpolateTextOp(textXref, value.strings, value.expressions.map((expr) => convertAst(expr))));
|
|
9064
|
+
view.update.push(createInterpolateTextOp(textXref, value.strings, value.expressions.map((expr) => convertAst(expr, view.tpl))));
|
|
8700
9065
|
}
|
|
8701
|
-
function convertAst(ast) {
|
|
9066
|
+
function convertAst(ast, cpl) {
|
|
8702
9067
|
if (ast instanceof ASTWithSource) {
|
|
8703
|
-
return convertAst(ast.ast);
|
|
9068
|
+
return convertAst(ast.ast, cpl);
|
|
8704
9069
|
} else if (ast instanceof PropertyRead) {
|
|
8705
9070
|
if (ast.receiver instanceof ImplicitReceiver) {
|
|
8706
9071
|
return new LexicalReadExpr(ast.name);
|
|
8707
9072
|
} else {
|
|
8708
|
-
return new ReadPropExpr(convertAst(ast.receiver), ast.name);
|
|
9073
|
+
return new ReadPropExpr(convertAst(ast.receiver, cpl), ast.name);
|
|
8709
9074
|
}
|
|
8710
9075
|
} else if (ast instanceof Call) {
|
|
8711
9076
|
if (ast.receiver instanceof ImplicitReceiver) {
|
|
8712
9077
|
throw new Error(`Unexpected ImplicitReceiver`);
|
|
8713
9078
|
} else {
|
|
8714
|
-
return new InvokeFunctionExpr(convertAst(ast.receiver), ast.args.map((arg) => convertAst(arg)));
|
|
9079
|
+
return new InvokeFunctionExpr(convertAst(ast.receiver, cpl), ast.args.map((arg) => convertAst(arg, cpl)));
|
|
8715
9080
|
}
|
|
9081
|
+
} else if (ast instanceof LiteralPrimitive) {
|
|
9082
|
+
return literal(ast.value);
|
|
9083
|
+
} else if (ast instanceof ThisReceiver) {
|
|
9084
|
+
return new ContextExpr(cpl.root.xref);
|
|
8716
9085
|
} else {
|
|
8717
9086
|
throw new Error(`Unhandled expression type: ${ast.constructor.name}`);
|
|
8718
9087
|
}
|
|
@@ -8738,18 +9107,17 @@ function ingestBindings(view, op, element2) {
|
|
|
8738
9107
|
if (element2 instanceof Template) {
|
|
8739
9108
|
for (const attr of element2.templateAttrs) {
|
|
8740
9109
|
if (typeof attr.value === "string") {
|
|
8741
|
-
throw new Error(`TODO: unhandled static attribute bindings (is this a thing?)`);
|
|
8742
9110
|
} else {
|
|
8743
|
-
view.update.push(createPropertyOp(op.xref, attr.name, convertAst(attr.value)));
|
|
9111
|
+
view.update.push(createPropertyOp(op.xref, attr.name, convertAst(attr.value, view.tpl)));
|
|
8744
9112
|
}
|
|
8745
9113
|
}
|
|
8746
9114
|
} else {
|
|
8747
9115
|
for (const input of element2.inputs) {
|
|
8748
|
-
view.update.push(createPropertyOp(op.xref, input.name, convertAst(input.value)));
|
|
9116
|
+
view.update.push(createPropertyOp(op.xref, input.name, convertAst(input.value, view.tpl)));
|
|
8749
9117
|
}
|
|
8750
9118
|
for (const output of element2.outputs) {
|
|
8751
|
-
const listenerOp = createListenerOp(op.xref, output.name);
|
|
8752
|
-
listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(output.handler))));
|
|
9119
|
+
const listenerOp = createListenerOp(op.xref, output.name, op.tag);
|
|
9120
|
+
listenerOp.handlerOps.push(createStatementOp(new ReturnStatement(convertAst(output.handler, view.tpl))));
|
|
8753
9121
|
view.create.push(listenerOp);
|
|
8754
9122
|
}
|
|
8755
9123
|
}
|
|
@@ -17229,10 +17597,12 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
17229
17597
|
const tpl = ingest(meta.name, meta.template.nodes);
|
|
17230
17598
|
transformTemplate(tpl);
|
|
17231
17599
|
const templateFn = emitTemplateFn(tpl, constantPool);
|
|
17232
|
-
definitionMap.set("template", templateFn);
|
|
17233
17600
|
definitionMap.set("decls", literal(tpl.root.decls));
|
|
17234
17601
|
definitionMap.set("vars", literal(tpl.root.vars));
|
|
17235
|
-
|
|
17602
|
+
if (tpl.consts.length > 0) {
|
|
17603
|
+
definitionMap.set("consts", literalArr(tpl.consts));
|
|
17604
|
+
}
|
|
17605
|
+
definitionMap.set("template", templateFn);
|
|
17236
17606
|
}
|
|
17237
17607
|
if (meta.declarations.length > 0) {
|
|
17238
17608
|
definitionMap.set("dependencies", compileDeclarationList(literalArr(meta.declarations.map((decl) => decl.type)), meta.declarationListEmitMode));
|
|
@@ -18170,7 +18540,7 @@ function publishFacade(global2) {
|
|
|
18170
18540
|
}
|
|
18171
18541
|
|
|
18172
18542
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/version.mjs
|
|
18173
|
-
var VERSION2 = new Version("16.0.0-rc.
|
|
18543
|
+
var VERSION2 = new Version("16.0.0-rc.2");
|
|
18174
18544
|
|
|
18175
18545
|
// bazel-out/k8-fastbuild/bin/packages/compiler/src/i18n/extractor_merger.mjs
|
|
18176
18546
|
var _I18N_ATTR = "i18n";
|
|
@@ -18480,6 +18850,7 @@ function _parseMessageMeta(i18n) {
|
|
|
18480
18850
|
var XmlTagDefinition = class {
|
|
18481
18851
|
constructor() {
|
|
18482
18852
|
this.closedByParent = false;
|
|
18853
|
+
this.implicitNamespacePrefix = null;
|
|
18483
18854
|
this.isVoid = false;
|
|
18484
18855
|
this.ignoreFirstLf = false;
|
|
18485
18856
|
this.canSelfClose = true;
|
|
@@ -18818,6 +19189,9 @@ ${errors.join("\n")}`);
|
|
|
18818
19189
|
}
|
|
18819
19190
|
};
|
|
18820
19191
|
var _WriteVisitor2 = class {
|
|
19192
|
+
constructor() {
|
|
19193
|
+
this._nextPlaceholderId = 0;
|
|
19194
|
+
}
|
|
18821
19195
|
visitText(text2, context) {
|
|
18822
19196
|
return [new Text3(text2.value)];
|
|
18823
19197
|
}
|
|
@@ -19485,7 +19859,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION = "12.0.0";
|
|
|
19485
19859
|
function compileDeclareClassMetadata(metadata) {
|
|
19486
19860
|
const definitionMap = new DefinitionMap();
|
|
19487
19861
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
19488
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
19862
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19489
19863
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19490
19864
|
definitionMap.set("type", metadata.type);
|
|
19491
19865
|
definitionMap.set("decorators", metadata.decorators);
|
|
@@ -19554,7 +19928,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
19554
19928
|
var _a2;
|
|
19555
19929
|
const definitionMap = new DefinitionMap();
|
|
19556
19930
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION2));
|
|
19557
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
19931
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19558
19932
|
definitionMap.set("type", meta.type.value);
|
|
19559
19933
|
if (meta.isStandalone) {
|
|
19560
19934
|
definitionMap.set("isStandalone", literal(meta.isStandalone));
|
|
@@ -19736,7 +20110,7 @@ var MINIMUM_PARTIAL_LINKER_VERSION3 = "12.0.0";
|
|
|
19736
20110
|
function compileDeclareFactoryFunction(meta) {
|
|
19737
20111
|
const definitionMap = new DefinitionMap();
|
|
19738
20112
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION3));
|
|
19739
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
20113
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19740
20114
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19741
20115
|
definitionMap.set("type", meta.type.value);
|
|
19742
20116
|
definitionMap.set("deps", compileDependencies(meta.deps));
|
|
@@ -19759,7 +20133,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
19759
20133
|
function createInjectableDefinitionMap(meta) {
|
|
19760
20134
|
const definitionMap = new DefinitionMap();
|
|
19761
20135
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION4));
|
|
19762
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
20136
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19763
20137
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19764
20138
|
definitionMap.set("type", meta.type.value);
|
|
19765
20139
|
if (meta.providedIn !== void 0) {
|
|
@@ -19797,7 +20171,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
19797
20171
|
function createInjectorDefinitionMap(meta) {
|
|
19798
20172
|
const definitionMap = new DefinitionMap();
|
|
19799
20173
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION5));
|
|
19800
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
20174
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19801
20175
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19802
20176
|
definitionMap.set("type", meta.type.value);
|
|
19803
20177
|
definitionMap.set("providers", meta.providers);
|
|
@@ -19818,7 +20192,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
19818
20192
|
function createNgModuleDefinitionMap(meta) {
|
|
19819
20193
|
const definitionMap = new DefinitionMap();
|
|
19820
20194
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION6));
|
|
19821
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
20195
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19822
20196
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19823
20197
|
definitionMap.set("type", meta.type.value);
|
|
19824
20198
|
if (meta.bootstrap.length > 0) {
|
|
@@ -19853,7 +20227,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
19853
20227
|
function createPipeDefinitionMap(meta) {
|
|
19854
20228
|
const definitionMap = new DefinitionMap();
|
|
19855
20229
|
definitionMap.set("minVersion", literal(MINIMUM_PARTIAL_LINKER_VERSION7));
|
|
19856
|
-
definitionMap.set("version", literal("16.0.0-rc.
|
|
20230
|
+
definitionMap.set("version", literal("16.0.0-rc.2"));
|
|
19857
20231
|
definitionMap.set("ngImport", importExpr(Identifiers.core));
|
|
19858
20232
|
definitionMap.set("type", meta.type.value);
|
|
19859
20233
|
if (meta.isStandalone) {
|
|
@@ -19870,7 +20244,7 @@ function createPipeDefinitionMap(meta) {
|
|
|
19870
20244
|
publishFacade(_global);
|
|
19871
20245
|
|
|
19872
20246
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/version.mjs
|
|
19873
|
-
var VERSION3 = new Version("16.0.0-rc.
|
|
20247
|
+
var VERSION3 = new Version("16.0.0-rc.2");
|
|
19874
20248
|
|
|
19875
20249
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/transformers/api.mjs
|
|
19876
20250
|
var EmitFlags;
|
|
@@ -22089,7 +22463,8 @@ var DtsMetadataReader = class {
|
|
|
22089
22463
|
rawDeclarations: null,
|
|
22090
22464
|
rawImports: null,
|
|
22091
22465
|
rawExports: null,
|
|
22092
|
-
decorator: null
|
|
22466
|
+
decorator: null,
|
|
22467
|
+
mayDeclareProviders: true
|
|
22093
22468
|
};
|
|
22094
22469
|
}
|
|
22095
22470
|
getDirectiveMetadata(ref) {
|
|
@@ -22130,7 +22505,8 @@ var DtsMetadataReader = class {
|
|
|
22130
22505
|
isStandalone,
|
|
22131
22506
|
imports: null,
|
|
22132
22507
|
schemas: null,
|
|
22133
|
-
decorator: null
|
|
22508
|
+
decorator: null,
|
|
22509
|
+
assumedToExportProviders: isComponent && isStandalone
|
|
22134
22510
|
});
|
|
22135
22511
|
}
|
|
22136
22512
|
getPipeMetadata(ref) {
|
|
@@ -22411,6 +22787,50 @@ var ResourceRegistry = class {
|
|
|
22411
22787
|
}
|
|
22412
22788
|
};
|
|
22413
22789
|
|
|
22790
|
+
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/providers.mjs
|
|
22791
|
+
var ExportedProviderStatusResolver = class {
|
|
22792
|
+
constructor(metaReader) {
|
|
22793
|
+
this.metaReader = metaReader;
|
|
22794
|
+
this.calculating = /* @__PURE__ */ new Set();
|
|
22795
|
+
}
|
|
22796
|
+
mayExportProviders(ref, dependencyCallback) {
|
|
22797
|
+
var _a2;
|
|
22798
|
+
if (this.calculating.has(ref.node)) {
|
|
22799
|
+
return false;
|
|
22800
|
+
}
|
|
22801
|
+
this.calculating.add(ref.node);
|
|
22802
|
+
if (dependencyCallback !== void 0) {
|
|
22803
|
+
dependencyCallback(ref);
|
|
22804
|
+
}
|
|
22805
|
+
try {
|
|
22806
|
+
const dirMeta = this.metaReader.getDirectiveMetadata(ref);
|
|
22807
|
+
if (dirMeta !== null) {
|
|
22808
|
+
if (!dirMeta.isComponent || !dirMeta.isStandalone) {
|
|
22809
|
+
return false;
|
|
22810
|
+
}
|
|
22811
|
+
if (dirMeta.assumedToExportProviders) {
|
|
22812
|
+
return true;
|
|
22813
|
+
}
|
|
22814
|
+
return ((_a2 = dirMeta.imports) != null ? _a2 : []).some((importRef) => this.mayExportProviders(importRef, dependencyCallback));
|
|
22815
|
+
}
|
|
22816
|
+
const pipeMeta = this.metaReader.getPipeMetadata(ref);
|
|
22817
|
+
if (pipeMeta !== null) {
|
|
22818
|
+
return false;
|
|
22819
|
+
}
|
|
22820
|
+
const ngModuleMeta = this.metaReader.getNgModuleMetadata(ref);
|
|
22821
|
+
if (ngModuleMeta !== null) {
|
|
22822
|
+
if (ngModuleMeta.mayDeclareProviders) {
|
|
22823
|
+
return true;
|
|
22824
|
+
}
|
|
22825
|
+
return ngModuleMeta.imports.some((importRef) => this.mayExportProviders(importRef, dependencyCallback));
|
|
22826
|
+
}
|
|
22827
|
+
return false;
|
|
22828
|
+
} finally {
|
|
22829
|
+
this.calculating.delete(ref.node);
|
|
22830
|
+
}
|
|
22831
|
+
}
|
|
22832
|
+
};
|
|
22833
|
+
|
|
22414
22834
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/host_directives_resolver.mjs
|
|
22415
22835
|
var EMPTY_ARRAY = [];
|
|
22416
22836
|
var HostDirectivesResolver = class {
|
|
@@ -27025,7 +27445,8 @@ var DirectiveDecoratorHandler = class {
|
|
|
27025
27445
|
isStandalone: analysis.meta.isStandalone,
|
|
27026
27446
|
imports: null,
|
|
27027
27447
|
schemas: null,
|
|
27028
|
-
decorator: analysis.decorator
|
|
27448
|
+
decorator: analysis.decorator,
|
|
27449
|
+
assumedToExportProviders: false
|
|
27029
27450
|
}));
|
|
27030
27451
|
this.injectableRegistry.registerInjectable(node, {
|
|
27031
27452
|
ctorDeps: analysis.meta.deps
|
|
@@ -27147,14 +27568,19 @@ function isResolvedModuleWithProviders(sv) {
|
|
|
27147
27568
|
|
|
27148
27569
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
|
|
27149
27570
|
var NgModuleSymbol = class extends SemanticSymbol {
|
|
27150
|
-
constructor() {
|
|
27151
|
-
super(
|
|
27571
|
+
constructor(decl, hasProviders) {
|
|
27572
|
+
super(decl);
|
|
27573
|
+
this.hasProviders = hasProviders;
|
|
27152
27574
|
this.remotelyScopedComponents = [];
|
|
27575
|
+
this.transitiveImportsFromStandaloneComponents = /* @__PURE__ */ new Set();
|
|
27153
27576
|
}
|
|
27154
27577
|
isPublicApiAffected(previousSymbol) {
|
|
27155
27578
|
if (!(previousSymbol instanceof NgModuleSymbol)) {
|
|
27156
27579
|
return true;
|
|
27157
27580
|
}
|
|
27581
|
+
if (previousSymbol.hasProviders !== this.hasProviders) {
|
|
27582
|
+
return true;
|
|
27583
|
+
}
|
|
27158
27584
|
return false;
|
|
27159
27585
|
}
|
|
27160
27586
|
isEmitAffected(previousSymbol) {
|
|
@@ -27178,6 +27604,19 @@ var NgModuleSymbol = class extends SemanticSymbol {
|
|
|
27178
27604
|
return true;
|
|
27179
27605
|
}
|
|
27180
27606
|
}
|
|
27607
|
+
if (previousSymbol.transitiveImportsFromStandaloneComponents.size !== this.transitiveImportsFromStandaloneComponents.size) {
|
|
27608
|
+
return true;
|
|
27609
|
+
}
|
|
27610
|
+
const previousImports = Array.from(previousSymbol.transitiveImportsFromStandaloneComponents);
|
|
27611
|
+
for (const transitiveImport of this.transitiveImportsFromStandaloneComponents) {
|
|
27612
|
+
const prevEntry = previousImports.find((prevEntry2) => isSymbolEqual(prevEntry2, transitiveImport));
|
|
27613
|
+
if (prevEntry === void 0) {
|
|
27614
|
+
return true;
|
|
27615
|
+
}
|
|
27616
|
+
if (transitiveImport.isPublicApiAffected(prevEntry)) {
|
|
27617
|
+
return true;
|
|
27618
|
+
}
|
|
27619
|
+
}
|
|
27181
27620
|
return false;
|
|
27182
27621
|
}
|
|
27183
27622
|
isTypeCheckApiAffected(previousSymbol) {
|
|
@@ -27189,15 +27628,20 @@ var NgModuleSymbol = class extends SemanticSymbol {
|
|
|
27189
27628
|
addRemotelyScopedComponent(component, usedDirectives, usedPipes) {
|
|
27190
27629
|
this.remotelyScopedComponents.push({ component, usedDirectives, usedPipes });
|
|
27191
27630
|
}
|
|
27631
|
+
addTransitiveImportFromStandaloneComponent(importedSymbol) {
|
|
27632
|
+
this.transitiveImportsFromStandaloneComponents.add(importedSymbol);
|
|
27633
|
+
}
|
|
27192
27634
|
};
|
|
27193
27635
|
var NgModuleDecoratorHandler = class {
|
|
27194
|
-
constructor(reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, isCore, refEmitter, annotateForClosureCompiler, onlyPublishPublicTypings, injectableRegistry, perf) {
|
|
27636
|
+
constructor(reflector, evaluator, metaReader, metaRegistry, scopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, annotateForClosureCompiler, onlyPublishPublicTypings, injectableRegistry, perf) {
|
|
27195
27637
|
this.reflector = reflector;
|
|
27196
27638
|
this.evaluator = evaluator;
|
|
27197
27639
|
this.metaReader = metaReader;
|
|
27198
27640
|
this.metaRegistry = metaRegistry;
|
|
27199
27641
|
this.scopeRegistry = scopeRegistry;
|
|
27200
27642
|
this.referencesRegistry = referencesRegistry;
|
|
27643
|
+
this.exportedProviderStatusResolver = exportedProviderStatusResolver;
|
|
27644
|
+
this.semanticDepGraphUpdater = semanticDepGraphUpdater;
|
|
27201
27645
|
this.isCore = isCore;
|
|
27202
27646
|
this.refEmitter = refEmitter;
|
|
27203
27647
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
@@ -27396,8 +27840,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
27396
27840
|
}
|
|
27397
27841
|
};
|
|
27398
27842
|
}
|
|
27399
|
-
symbol(node) {
|
|
27400
|
-
return new NgModuleSymbol(node);
|
|
27843
|
+
symbol(node, analysis) {
|
|
27844
|
+
return new NgModuleSymbol(node, analysis.providers !== null);
|
|
27401
27845
|
}
|
|
27402
27846
|
register(node, analysis) {
|
|
27403
27847
|
this.metaRegistry.registerNgModuleMetadata({
|
|
@@ -27410,7 +27854,8 @@ var NgModuleDecoratorHandler = class {
|
|
|
27410
27854
|
rawDeclarations: analysis.rawDeclarations,
|
|
27411
27855
|
rawImports: analysis.rawImports,
|
|
27412
27856
|
rawExports: analysis.rawExports,
|
|
27413
|
-
decorator: analysis.decorator
|
|
27857
|
+
decorator: analysis.decorator,
|
|
27858
|
+
mayDeclareProviders: analysis.providers !== null
|
|
27414
27859
|
});
|
|
27415
27860
|
this.injectableRegistry.registerInjectable(node, {
|
|
27416
27861
|
ctorDeps: analysis.fac.deps
|
|
@@ -27436,10 +27881,28 @@ var NgModuleDecoratorHandler = class {
|
|
|
27436
27881
|
continue;
|
|
27437
27882
|
}
|
|
27438
27883
|
const refsToEmit = [];
|
|
27884
|
+
let symbol = null;
|
|
27885
|
+
if (this.semanticDepGraphUpdater !== null) {
|
|
27886
|
+
const sym = this.semanticDepGraphUpdater.getSymbol(node);
|
|
27887
|
+
if (sym instanceof NgModuleSymbol) {
|
|
27888
|
+
symbol = sym;
|
|
27889
|
+
}
|
|
27890
|
+
}
|
|
27439
27891
|
for (const ref of topLevelImport.resolvedReferences) {
|
|
27440
27892
|
const dirMeta = this.metaReader.getDirectiveMetadata(ref);
|
|
27441
|
-
if (dirMeta !== null
|
|
27442
|
-
|
|
27893
|
+
if (dirMeta !== null) {
|
|
27894
|
+
if (!dirMeta.isComponent) {
|
|
27895
|
+
continue;
|
|
27896
|
+
}
|
|
27897
|
+
const mayExportProviders = this.exportedProviderStatusResolver.mayExportProviders(dirMeta.ref, (importRef) => {
|
|
27898
|
+
if (symbol !== null && this.semanticDepGraphUpdater !== null) {
|
|
27899
|
+
const importSymbol = this.semanticDepGraphUpdater.getSymbol(importRef.node);
|
|
27900
|
+
symbol.addTransitiveImportFromStandaloneComponent(importSymbol);
|
|
27901
|
+
}
|
|
27902
|
+
});
|
|
27903
|
+
if (!mayExportProviders) {
|
|
27904
|
+
continue;
|
|
27905
|
+
}
|
|
27443
27906
|
}
|
|
27444
27907
|
const pipeMeta = dirMeta === null ? this.metaReader.getPipeMetadata(ref) : null;
|
|
27445
27908
|
if (pipeMeta !== null) {
|
|
@@ -27651,12 +28114,7 @@ function checkCustomElementSelectorForErrors(selector) {
|
|
|
27651
28114
|
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/resources.mjs
|
|
27652
28115
|
var import_typescript50 = __toESM(require("typescript"), 1);
|
|
27653
28116
|
function getTemplateDeclarationNodeForError(declaration) {
|
|
27654
|
-
|
|
27655
|
-
case true:
|
|
27656
|
-
return declaration.expression;
|
|
27657
|
-
case false:
|
|
27658
|
-
return declaration.templateUrlExpression;
|
|
27659
|
-
}
|
|
28117
|
+
return declaration.isInline ? declaration.expression : declaration.templateUrlExpression;
|
|
27660
28118
|
}
|
|
27661
28119
|
function extractTemplate(node, template2, evaluator, depTracker, resourceLoader, options) {
|
|
27662
28120
|
if (template2.isInline) {
|
|
@@ -28398,7 +28856,8 @@ var ComponentDecoratorHandler = class {
|
|
|
28398
28856
|
imports: analysis.resolvedImports,
|
|
28399
28857
|
animationTriggerNames: analysis.animationTriggerNames,
|
|
28400
28858
|
schemas: analysis.schemas,
|
|
28401
|
-
decorator: analysis.decorator
|
|
28859
|
+
decorator: analysis.decorator,
|
|
28860
|
+
assumedToExportProviders: false
|
|
28402
28861
|
}));
|
|
28403
28862
|
this.resourceRegistry.registerResources(analysis.resources, node);
|
|
28404
28863
|
this.injectableRegistry.registerInjectable(node, {
|
|
@@ -35388,9 +35847,6 @@ var NgCompiler = class {
|
|
|
35388
35847
|
get perfRecorder() {
|
|
35389
35848
|
return this.livePerfRecorder;
|
|
35390
35849
|
}
|
|
35391
|
-
get incrementalDriver() {
|
|
35392
|
-
return this.incrementalCompilation;
|
|
35393
|
-
}
|
|
35394
35850
|
updateWithChangedResources(changedResources, perfRecorder) {
|
|
35395
35851
|
this.livePerfRecorder = perfRecorder;
|
|
35396
35852
|
this.delegatingPerfRecorder.target = perfRecorder;
|
|
@@ -35785,6 +36241,7 @@ var NgCompiler = class {
|
|
|
35785
36241
|
const metaRegistry = new CompoundMetadataRegistry([localMetaRegistry, ngModuleScopeRegistry]);
|
|
35786
36242
|
const injectableRegistry = new InjectableClassRegistry(reflector, isCore);
|
|
35787
36243
|
const hostDirectivesResolver = new HostDirectivesResolver(metaReader);
|
|
36244
|
+
const exportedProviderStatusResolver = new ExportedProviderStatusResolver(metaReader);
|
|
35788
36245
|
const typeCheckScopeRegistry = new TypeCheckScopeRegistry(scopeReader, metaReader, hostDirectivesResolver);
|
|
35789
36246
|
let referencesRegistry;
|
|
35790
36247
|
let exportReferenceGraph = null;
|
|
@@ -35804,7 +36261,7 @@ var NgCompiler = class {
|
|
|
35804
36261
|
new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder),
|
|
35805
36262
|
new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder),
|
|
35806
36263
|
new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder),
|
|
35807
|
-
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, isCore, refEmitter, this.closureCompilerEnabled, (_a2 = this.options.onlyPublishPublicTypingsForNgModules) != null ? _a2 : false, injectableRegistry, this.delegatingPerfRecorder)
|
|
36264
|
+
new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_a2 = this.options.onlyPublishPublicTypingsForNgModules) != null ? _a2 : false, injectableRegistry, this.delegatingPerfRecorder)
|
|
35808
36265
|
];
|
|
35809
36266
|
const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
|
|
35810
36267
|
const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
|