@angular/compiler-cli 17.3.6 → 17.3.7

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.
@@ -271,7 +271,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
271
271
 
272
272
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/linker/src/file_linker/partial_linkers/util.mjs
273
273
  import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
274
- var PLACEHOLDER_VERSION = "17.3.6";
274
+ var PLACEHOLDER_VERSION = "17.3.7";
275
275
  var SHOULD_USE_TEMPLATE_PIPELINE_FOR_LINKER = true;
276
276
  function wrapReference(wrapped) {
277
277
  return { value: wrapped, type: wrapped };
@@ -6060,16 +6060,20 @@ var TcbIfOp = class extends TcbOp {
6060
6060
  return void 0;
6061
6061
  }
6062
6062
  if (branch.expression === null) {
6063
- const branchScope = Scope.forNodes(this.tcb, this.scope, null, branch.children, this.generateBranchGuard(index));
6063
+ const branchScope = this.getBranchScope(this.scope, branch, index);
6064
6064
  return ts30.factory.createBlock(branchScope.render());
6065
6065
  }
6066
6066
  const expressionScope = Scope.forNodes(this.tcb, this.scope, branch, [], null);
6067
6067
  expressionScope.render().forEach((stmt) => this.scope.addStatement(stmt));
6068
6068
  this.expressionScopes.set(branch, expressionScope);
6069
6069
  const expression = branch.expressionAlias === null ? tcbExpression(branch.expression, this.tcb, expressionScope) : expressionScope.resolve(branch.expressionAlias);
6070
- const bodyScope = Scope.forNodes(this.tcb, expressionScope, null, branch.children, this.generateBranchGuard(index));
6070
+ const bodyScope = this.getBranchScope(expressionScope, branch, index);
6071
6071
  return ts30.factory.createIfStatement(expression, ts30.factory.createBlock(bodyScope.render()), this.generateBranch(index + 1));
6072
6072
  }
6073
+ getBranchScope(parentScope, branch, index) {
6074
+ const checkBody = this.tcb.env.config.checkControlFlowBodies;
6075
+ return Scope.forNodes(this.tcb, parentScope, null, checkBody ? branch.children : [], checkBody ? this.generateBranchGuard(index) : null);
6076
+ }
6073
6077
  generateBranchGuard(index) {
6074
6078
  let guard = null;
6075
6079
  for (let i = 0; i <= index; i++) {
@@ -6115,9 +6119,10 @@ var TcbSwitchOp = class extends TcbOp {
6115
6119
  return null;
6116
6120
  }
6117
6121
  generateCase(index, switchValue, defaultCase) {
6122
+ const checkBodies = this.tcb.env.config.checkControlFlowBodies;
6118
6123
  if (index >= this.block.cases.length) {
6119
6124
  if (defaultCase !== null) {
6120
- const defaultScope = Scope.forNodes(this.tcb, this.scope, null, defaultCase.children, this.generateGuard(defaultCase, switchValue));
6125
+ const defaultScope = Scope.forNodes(this.tcb, this.scope, null, checkBodies ? defaultCase.children : [], checkBodies ? this.generateGuard(defaultCase, switchValue) : null);
6121
6126
  return ts30.factory.createBlock(defaultScope.render());
6122
6127
  }
6123
6128
  return void 0;
@@ -6126,7 +6131,7 @@ var TcbSwitchOp = class extends TcbOp {
6126
6131
  if (current.expression === null) {
6127
6132
  return this.generateCase(index + 1, switchValue, current);
6128
6133
  }
6129
- const caseScope = Scope.forNodes(this.tcb, this.scope, null, current.children, this.generateGuard(current, switchValue));
6134
+ const caseScope = Scope.forNodes(this.tcb, this.scope, null, checkBodies ? current.children : [], checkBodies ? this.generateGuard(current, switchValue) : null);
6130
6135
  const caseValue = tcbExpression(current.expression, this.tcb, caseScope);
6131
6136
  return ts30.factory.createIfStatement(ts30.factory.createBinaryExpression(switchValue, ts30.SyntaxKind.EqualsEqualsEqualsToken, caseValue), ts30.factory.createBlock(caseScope.render()), this.generateCase(index + 1, switchValue, defaultCase));
6132
6137
  }
@@ -6164,7 +6169,7 @@ var TcbForOfOp = class extends TcbOp {
6164
6169
  return false;
6165
6170
  }
6166
6171
  execute() {
6167
- const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, this.block.children, null);
6172
+ const loopScope = Scope.forNodes(this.tcb, this.scope, this.block, this.tcb.env.config.checkControlFlowBodies ? this.block.children : [], null);
6168
6173
  const initializerId = loopScope.resolve(this.block.item);
6169
6174
  if (!ts30.isIdentifier(initializerId)) {
6170
6175
  throw new Error(`Could not resolve for loop variable ${this.block.item.name} to an identifier`);
@@ -6375,7 +6380,7 @@ var _Scope = class {
6375
6380
  this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.expression), new TcbSwitchOp(this.tcb, this, node));
6376
6381
  } else if (node instanceof TmplAstForLoopBlock2) {
6377
6382
  this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
6378
- node.empty && this.appendChildren(node.empty);
6383
+ node.empty && this.tcb.env.config.checkControlFlowBodies && this.appendChildren(node.empty);
6379
6384
  } else if (node instanceof TmplAstBoundText) {
6380
6385
  this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.value));
6381
6386
  } else if (node instanceof TmplAstIcu) {
@@ -9424,6 +9429,7 @@ var NgCompiler = class {
9424
9429
  alwaysCheckSchemaInTemplateBodies: true,
9425
9430
  checkTypeOfInputBindings: strictTemplates,
9426
9431
  honorAccessModifiersForInputBindings: false,
9432
+ checkControlFlowBodies: true,
9427
9433
  strictNullInputBindings: strictTemplates,
9428
9434
  checkTypeOfAttributes: strictTemplates,
9429
9435
  checkTypeOfDomBindings: false,
@@ -9447,6 +9453,7 @@ var NgCompiler = class {
9447
9453
  applyTemplateContextGuards: false,
9448
9454
  checkQueries: false,
9449
9455
  checkTemplateBodies: false,
9456
+ checkControlFlowBodies: false,
9450
9457
  alwaysCheckSchemaInTemplateBodies: this.closureCompilerEnabled,
9451
9458
  checkTypeOfInputBindings: false,
9452
9459
  strictNullInputBindings: false,
@@ -10456,4 +10463,4 @@ export {
10456
10463
  * Use of this source code is governed by an MIT-style license that can be
10457
10464
  * found in the LICENSE file at https://angular.io/license
10458
10465
  */
10459
- //# sourceMappingURL=chunk-YUCWD6QQ.js.map
10466
+ //# sourceMappingURL=chunk-EM4I4HTR.js.map