@angular/compiler 20.0.0-next.3 → 20.0.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/compiler.mjs +236 -92
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +3 -1
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.4
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2896,6 +2896,11 @@ class Identifiers {
|
|
|
2896
2896
|
name: 'ɵɵdeferEnableTimerScheduling',
|
|
2897
2897
|
moduleName: CORE,
|
|
2898
2898
|
};
|
|
2899
|
+
static conditionalCreate = { name: 'ɵɵconditionalCreate', moduleName: CORE };
|
|
2900
|
+
static conditionalBranchCreate = {
|
|
2901
|
+
name: 'ɵɵconditionalBranchCreate',
|
|
2902
|
+
moduleName: CORE,
|
|
2903
|
+
};
|
|
2899
2904
|
static conditional = { name: 'ɵɵconditional', moduleName: CORE };
|
|
2900
2905
|
static repeater = { name: 'ɵɵrepeater', moduleName: CORE };
|
|
2901
2906
|
static repeaterCreate = { name: 'ɵɵrepeaterCreate', moduleName: CORE };
|
|
@@ -8729,167 +8734,175 @@ var OpKind;
|
|
|
8729
8734
|
* node.
|
|
8730
8735
|
*/
|
|
8731
8736
|
OpKind[OpKind["DisableBindings"] = 10] = "DisableBindings";
|
|
8737
|
+
/**
|
|
8738
|
+
* Create a conditional creation instruction op.
|
|
8739
|
+
*/
|
|
8740
|
+
OpKind[OpKind["ConditionalCreate"] = 11] = "ConditionalCreate";
|
|
8741
|
+
/**
|
|
8742
|
+
* Create a conditional branch creation instruction op.
|
|
8743
|
+
*/
|
|
8744
|
+
OpKind[OpKind["ConditionalBranchCreate"] = 12] = "ConditionalBranchCreate";
|
|
8732
8745
|
/**
|
|
8733
8746
|
* An op to conditionally render a template.
|
|
8734
8747
|
*/
|
|
8735
|
-
OpKind[OpKind["Conditional"] =
|
|
8748
|
+
OpKind[OpKind["Conditional"] = 13] = "Conditional";
|
|
8736
8749
|
/**
|
|
8737
8750
|
* An operation to re-enable binding, after it was previously disabled.
|
|
8738
8751
|
*/
|
|
8739
|
-
OpKind[OpKind["EnableBindings"] =
|
|
8752
|
+
OpKind[OpKind["EnableBindings"] = 14] = "EnableBindings";
|
|
8740
8753
|
/**
|
|
8741
8754
|
* An operation to render a text node.
|
|
8742
8755
|
*/
|
|
8743
|
-
OpKind[OpKind["Text"] =
|
|
8756
|
+
OpKind[OpKind["Text"] = 15] = "Text";
|
|
8744
8757
|
/**
|
|
8745
8758
|
* An operation declaring an event listener for an element.
|
|
8746
8759
|
*/
|
|
8747
|
-
OpKind[OpKind["Listener"] =
|
|
8760
|
+
OpKind[OpKind["Listener"] = 16] = "Listener";
|
|
8748
8761
|
/**
|
|
8749
8762
|
* An operation to interpolate text into a text node.
|
|
8750
8763
|
*/
|
|
8751
|
-
OpKind[OpKind["InterpolateText"] =
|
|
8764
|
+
OpKind[OpKind["InterpolateText"] = 17] = "InterpolateText";
|
|
8752
8765
|
/**
|
|
8753
8766
|
* An intermediate binding op, that has not yet been processed into an individual property,
|
|
8754
8767
|
* attribute, style, etc.
|
|
8755
8768
|
*/
|
|
8756
|
-
OpKind[OpKind["Binding"] =
|
|
8769
|
+
OpKind[OpKind["Binding"] = 18] = "Binding";
|
|
8757
8770
|
/**
|
|
8758
8771
|
* An operation to bind an expression to a property of an element.
|
|
8759
8772
|
*/
|
|
8760
|
-
OpKind[OpKind["Property"] =
|
|
8773
|
+
OpKind[OpKind["Property"] = 19] = "Property";
|
|
8761
8774
|
/**
|
|
8762
8775
|
* An operation to bind an expression to a style property of an element.
|
|
8763
8776
|
*/
|
|
8764
|
-
OpKind[OpKind["StyleProp"] =
|
|
8777
|
+
OpKind[OpKind["StyleProp"] = 20] = "StyleProp";
|
|
8765
8778
|
/**
|
|
8766
8779
|
* An operation to bind an expression to a class property of an element.
|
|
8767
8780
|
*/
|
|
8768
|
-
OpKind[OpKind["ClassProp"] =
|
|
8781
|
+
OpKind[OpKind["ClassProp"] = 21] = "ClassProp";
|
|
8769
8782
|
/**
|
|
8770
8783
|
* An operation to bind an expression to the styles of an element.
|
|
8771
8784
|
*/
|
|
8772
|
-
OpKind[OpKind["StyleMap"] =
|
|
8785
|
+
OpKind[OpKind["StyleMap"] = 22] = "StyleMap";
|
|
8773
8786
|
/**
|
|
8774
8787
|
* An operation to bind an expression to the classes of an element.
|
|
8775
8788
|
*/
|
|
8776
|
-
OpKind[OpKind["ClassMap"] =
|
|
8789
|
+
OpKind[OpKind["ClassMap"] = 23] = "ClassMap";
|
|
8777
8790
|
/**
|
|
8778
8791
|
* An operation to advance the runtime's implicit slot context during the update phase of a view.
|
|
8779
8792
|
*/
|
|
8780
|
-
OpKind[OpKind["Advance"] =
|
|
8793
|
+
OpKind[OpKind["Advance"] = 24] = "Advance";
|
|
8781
8794
|
/**
|
|
8782
8795
|
* An operation to instantiate a pipe.
|
|
8783
8796
|
*/
|
|
8784
|
-
OpKind[OpKind["Pipe"] =
|
|
8797
|
+
OpKind[OpKind["Pipe"] = 25] = "Pipe";
|
|
8785
8798
|
/**
|
|
8786
8799
|
* An operation to associate an attribute with an element.
|
|
8787
8800
|
*/
|
|
8788
|
-
OpKind[OpKind["Attribute"] =
|
|
8801
|
+
OpKind[OpKind["Attribute"] = 26] = "Attribute";
|
|
8789
8802
|
/**
|
|
8790
8803
|
* An attribute that has been extracted for inclusion in the consts array.
|
|
8791
8804
|
*/
|
|
8792
|
-
OpKind[OpKind["ExtractedAttribute"] =
|
|
8805
|
+
OpKind[OpKind["ExtractedAttribute"] = 27] = "ExtractedAttribute";
|
|
8793
8806
|
/**
|
|
8794
8807
|
* An operation that configures a `@defer` block.
|
|
8795
8808
|
*/
|
|
8796
|
-
OpKind[OpKind["Defer"] =
|
|
8809
|
+
OpKind[OpKind["Defer"] = 28] = "Defer";
|
|
8797
8810
|
/**
|
|
8798
8811
|
* An operation that controls when a `@defer` loads.
|
|
8799
8812
|
*/
|
|
8800
|
-
OpKind[OpKind["DeferOn"] =
|
|
8813
|
+
OpKind[OpKind["DeferOn"] = 29] = "DeferOn";
|
|
8801
8814
|
/**
|
|
8802
8815
|
* An operation that controls when a `@defer` loads, using a custom expression as the condition.
|
|
8803
8816
|
*/
|
|
8804
|
-
OpKind[OpKind["DeferWhen"] =
|
|
8817
|
+
OpKind[OpKind["DeferWhen"] = 30] = "DeferWhen";
|
|
8805
8818
|
/**
|
|
8806
8819
|
* An i18n message that has been extracted for inclusion in the consts array.
|
|
8807
8820
|
*/
|
|
8808
|
-
OpKind[OpKind["I18nMessage"] =
|
|
8821
|
+
OpKind[OpKind["I18nMessage"] = 31] = "I18nMessage";
|
|
8809
8822
|
/**
|
|
8810
8823
|
* A host binding property.
|
|
8811
8824
|
*/
|
|
8812
|
-
OpKind[OpKind["HostProperty"] =
|
|
8825
|
+
OpKind[OpKind["HostProperty"] = 32] = "HostProperty";
|
|
8813
8826
|
/**
|
|
8814
8827
|
* A namespace change, which causes the subsequent elements to be processed as either HTML or SVG.
|
|
8815
8828
|
*/
|
|
8816
|
-
OpKind[OpKind["Namespace"] =
|
|
8829
|
+
OpKind[OpKind["Namespace"] = 33] = "Namespace";
|
|
8817
8830
|
/**
|
|
8818
8831
|
* Configure a content projeciton definition for the view.
|
|
8819
8832
|
*/
|
|
8820
|
-
OpKind[OpKind["ProjectionDef"] =
|
|
8833
|
+
OpKind[OpKind["ProjectionDef"] = 34] = "ProjectionDef";
|
|
8821
8834
|
/**
|
|
8822
8835
|
* Create a content projection slot.
|
|
8823
8836
|
*/
|
|
8824
|
-
OpKind[OpKind["Projection"] =
|
|
8837
|
+
OpKind[OpKind["Projection"] = 35] = "Projection";
|
|
8825
8838
|
/**
|
|
8826
8839
|
* Create a repeater creation instruction op.
|
|
8827
8840
|
*/
|
|
8828
|
-
OpKind[OpKind["RepeaterCreate"] =
|
|
8841
|
+
OpKind[OpKind["RepeaterCreate"] = 36] = "RepeaterCreate";
|
|
8829
8842
|
/**
|
|
8830
8843
|
* An update up for a repeater.
|
|
8831
8844
|
*/
|
|
8832
|
-
OpKind[OpKind["Repeater"] =
|
|
8845
|
+
OpKind[OpKind["Repeater"] = 37] = "Repeater";
|
|
8833
8846
|
/**
|
|
8834
8847
|
* An operation to bind an expression to the property side of a two-way binding.
|
|
8835
8848
|
*/
|
|
8836
|
-
OpKind[OpKind["TwoWayProperty"] =
|
|
8849
|
+
OpKind[OpKind["TwoWayProperty"] = 38] = "TwoWayProperty";
|
|
8837
8850
|
/**
|
|
8838
8851
|
* An operation declaring the event side of a two-way binding.
|
|
8839
8852
|
*/
|
|
8840
|
-
OpKind[OpKind["TwoWayListener"] =
|
|
8853
|
+
OpKind[OpKind["TwoWayListener"] = 39] = "TwoWayListener";
|
|
8841
8854
|
/**
|
|
8842
8855
|
* A creation-time operation that initializes the slot for a `@let` declaration.
|
|
8843
8856
|
*/
|
|
8844
|
-
OpKind[OpKind["DeclareLet"] =
|
|
8857
|
+
OpKind[OpKind["DeclareLet"] = 40] = "DeclareLet";
|
|
8845
8858
|
/**
|
|
8846
8859
|
* An update-time operation that stores the current value of a `@let` declaration.
|
|
8847
8860
|
*/
|
|
8848
|
-
OpKind[OpKind["StoreLet"] =
|
|
8861
|
+
OpKind[OpKind["StoreLet"] = 41] = "StoreLet";
|
|
8849
8862
|
/**
|
|
8850
8863
|
* The start of an i18n block.
|
|
8851
8864
|
*/
|
|
8852
|
-
OpKind[OpKind["I18nStart"] =
|
|
8865
|
+
OpKind[OpKind["I18nStart"] = 42] = "I18nStart";
|
|
8853
8866
|
/**
|
|
8854
8867
|
* A self-closing i18n on a single element.
|
|
8855
8868
|
*/
|
|
8856
|
-
OpKind[OpKind["I18n"] =
|
|
8869
|
+
OpKind[OpKind["I18n"] = 43] = "I18n";
|
|
8857
8870
|
/**
|
|
8858
8871
|
* The end of an i18n block.
|
|
8859
8872
|
*/
|
|
8860
|
-
OpKind[OpKind["I18nEnd"] =
|
|
8873
|
+
OpKind[OpKind["I18nEnd"] = 44] = "I18nEnd";
|
|
8861
8874
|
/**
|
|
8862
8875
|
* An expression in an i18n message.
|
|
8863
8876
|
*/
|
|
8864
|
-
OpKind[OpKind["I18nExpression"] =
|
|
8877
|
+
OpKind[OpKind["I18nExpression"] = 45] = "I18nExpression";
|
|
8865
8878
|
/**
|
|
8866
8879
|
* An instruction that applies a set of i18n expressions.
|
|
8867
8880
|
*/
|
|
8868
|
-
OpKind[OpKind["I18nApply"] =
|
|
8881
|
+
OpKind[OpKind["I18nApply"] = 46] = "I18nApply";
|
|
8869
8882
|
/**
|
|
8870
8883
|
* An instruction to create an ICU expression.
|
|
8871
8884
|
*/
|
|
8872
|
-
OpKind[OpKind["IcuStart"] =
|
|
8885
|
+
OpKind[OpKind["IcuStart"] = 47] = "IcuStart";
|
|
8873
8886
|
/**
|
|
8874
8887
|
* An instruction to update an ICU expression.
|
|
8875
8888
|
*/
|
|
8876
|
-
OpKind[OpKind["IcuEnd"] =
|
|
8889
|
+
OpKind[OpKind["IcuEnd"] = 48] = "IcuEnd";
|
|
8877
8890
|
/**
|
|
8878
8891
|
* An instruction representing a placeholder in an ICU expression.
|
|
8879
8892
|
*/
|
|
8880
|
-
OpKind[OpKind["IcuPlaceholder"] =
|
|
8893
|
+
OpKind[OpKind["IcuPlaceholder"] = 49] = "IcuPlaceholder";
|
|
8881
8894
|
/**
|
|
8882
8895
|
* An i18n context containing information needed to generate an i18n message.
|
|
8883
8896
|
*/
|
|
8884
|
-
OpKind[OpKind["I18nContext"] =
|
|
8897
|
+
OpKind[OpKind["I18nContext"] = 50] = "I18nContext";
|
|
8885
8898
|
/**
|
|
8886
8899
|
* A creation op that corresponds to i18n attributes on an element.
|
|
8887
8900
|
*/
|
|
8888
|
-
OpKind[OpKind["I18nAttributes"] =
|
|
8901
|
+
OpKind[OpKind["I18nAttributes"] = 51] = "I18nAttributes";
|
|
8889
8902
|
/**
|
|
8890
8903
|
* Creation op that attaches the location at which an element was defined in a template to it.
|
|
8891
8904
|
*/
|
|
8892
|
-
OpKind[OpKind["SourceLocation"] =
|
|
8905
|
+
OpKind[OpKind["SourceLocation"] = 52] = "SourceLocation";
|
|
8893
8906
|
})(OpKind || (OpKind = {}));
|
|
8894
8907
|
/**
|
|
8895
8908
|
* Distinguishes different kinds of IR expressions.
|
|
@@ -10439,6 +10452,8 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10439
10452
|
case OpKind.IcuPlaceholder:
|
|
10440
10453
|
case OpKind.DeclareLet:
|
|
10441
10454
|
case OpKind.SourceLocation:
|
|
10455
|
+
case OpKind.ConditionalCreate:
|
|
10456
|
+
case OpKind.ConditionalBranchCreate:
|
|
10442
10457
|
// These operations contain no expressions.
|
|
10443
10458
|
break;
|
|
10444
10459
|
default:
|
|
@@ -10854,6 +10869,8 @@ const elementContainerOpKinds = new Set([
|
|
|
10854
10869
|
OpKind.ContainerStart,
|
|
10855
10870
|
OpKind.Template,
|
|
10856
10871
|
OpKind.RepeaterCreate,
|
|
10872
|
+
OpKind.ConditionalCreate,
|
|
10873
|
+
OpKind.ConditionalBranchCreate,
|
|
10857
10874
|
]);
|
|
10858
10875
|
/**
|
|
10859
10876
|
* Checks whether the given operation represents the creation of an element or container.
|
|
@@ -10905,6 +10922,48 @@ function createTemplateOp(xref, templateKind, tag, functionNameSuffix, namespace
|
|
|
10905
10922
|
...NEW_OP,
|
|
10906
10923
|
};
|
|
10907
10924
|
}
|
|
10925
|
+
function createConditionalCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10926
|
+
return {
|
|
10927
|
+
kind: OpKind.ConditionalCreate,
|
|
10928
|
+
xref,
|
|
10929
|
+
templateKind,
|
|
10930
|
+
attributes: null,
|
|
10931
|
+
tag,
|
|
10932
|
+
handle: new SlotHandle(),
|
|
10933
|
+
functionNameSuffix,
|
|
10934
|
+
decls: null,
|
|
10935
|
+
vars: null,
|
|
10936
|
+
localRefs: [],
|
|
10937
|
+
nonBindable: false,
|
|
10938
|
+
namespace,
|
|
10939
|
+
i18nPlaceholder,
|
|
10940
|
+
startSourceSpan,
|
|
10941
|
+
wholeSourceSpan,
|
|
10942
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10943
|
+
...NEW_OP,
|
|
10944
|
+
};
|
|
10945
|
+
}
|
|
10946
|
+
function createConditionalBranchCreateOp(xref, templateKind, tag, functionNameSuffix, namespace, i18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10947
|
+
return {
|
|
10948
|
+
kind: OpKind.ConditionalBranchCreate,
|
|
10949
|
+
xref,
|
|
10950
|
+
templateKind,
|
|
10951
|
+
attributes: null,
|
|
10952
|
+
tag,
|
|
10953
|
+
handle: new SlotHandle(),
|
|
10954
|
+
functionNameSuffix,
|
|
10955
|
+
decls: null,
|
|
10956
|
+
vars: null,
|
|
10957
|
+
localRefs: [],
|
|
10958
|
+
nonBindable: false,
|
|
10959
|
+
namespace,
|
|
10960
|
+
i18nPlaceholder,
|
|
10961
|
+
startSourceSpan,
|
|
10962
|
+
wholeSourceSpan,
|
|
10963
|
+
...TRAIT_CONSUMES_SLOT,
|
|
10964
|
+
...NEW_OP,
|
|
10965
|
+
};
|
|
10966
|
+
}
|
|
10908
10967
|
function createRepeaterCreateOp(primaryView, emptyView, tag, track, varNames, emptyTag, i18nPlaceholder, emptyI18nPlaceholder, startSourceSpan, wholeSourceSpan) {
|
|
10909
10968
|
return {
|
|
10910
10969
|
kind: OpKind.RepeaterCreate,
|
|
@@ -11852,36 +11911,38 @@ function specializeBindings(job) {
|
|
|
11852
11911
|
}
|
|
11853
11912
|
}
|
|
11854
11913
|
|
|
11855
|
-
const
|
|
11856
|
-
Identifiers.attribute,
|
|
11857
|
-
Identifiers.classProp,
|
|
11858
|
-
Identifiers.element,
|
|
11859
|
-
Identifiers.elementContainer,
|
|
11860
|
-
Identifiers.elementContainerEnd,
|
|
11861
|
-
Identifiers.elementContainerStart,
|
|
11862
|
-
Identifiers.elementEnd,
|
|
11863
|
-
Identifiers.elementStart,
|
|
11864
|
-
Identifiers.hostProperty,
|
|
11865
|
-
Identifiers.i18nExp,
|
|
11866
|
-
Identifiers.listener,
|
|
11867
|
-
Identifiers.listener,
|
|
11868
|
-
Identifiers.property,
|
|
11869
|
-
Identifiers.styleProp,
|
|
11870
|
-
Identifiers.stylePropInterpolate1,
|
|
11871
|
-
Identifiers.stylePropInterpolate2,
|
|
11872
|
-
Identifiers.stylePropInterpolate3,
|
|
11873
|
-
Identifiers.stylePropInterpolate4,
|
|
11874
|
-
Identifiers.stylePropInterpolate5,
|
|
11875
|
-
Identifiers.stylePropInterpolate6,
|
|
11876
|
-
Identifiers.stylePropInterpolate7,
|
|
11877
|
-
Identifiers.stylePropInterpolate8,
|
|
11878
|
-
Identifiers.stylePropInterpolateV,
|
|
11879
|
-
Identifiers.syntheticHostListener,
|
|
11880
|
-
Identifiers.syntheticHostProperty,
|
|
11881
|
-
Identifiers.templateCreate,
|
|
11882
|
-
Identifiers.twoWayProperty,
|
|
11883
|
-
Identifiers.twoWayListener,
|
|
11884
|
-
Identifiers.declareLet,
|
|
11914
|
+
const CHAIN_COMPATIBILITY = new Map([
|
|
11915
|
+
[Identifiers.attribute, Identifiers.attribute],
|
|
11916
|
+
[Identifiers.classProp, Identifiers.classProp],
|
|
11917
|
+
[Identifiers.element, Identifiers.element],
|
|
11918
|
+
[Identifiers.elementContainer, Identifiers.elementContainer],
|
|
11919
|
+
[Identifiers.elementContainerEnd, Identifiers.elementContainerEnd],
|
|
11920
|
+
[Identifiers.elementContainerStart, Identifiers.elementContainerStart],
|
|
11921
|
+
[Identifiers.elementEnd, Identifiers.elementEnd],
|
|
11922
|
+
[Identifiers.elementStart, Identifiers.elementStart],
|
|
11923
|
+
[Identifiers.hostProperty, Identifiers.hostProperty],
|
|
11924
|
+
[Identifiers.i18nExp, Identifiers.i18nExp],
|
|
11925
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11926
|
+
[Identifiers.listener, Identifiers.listener],
|
|
11927
|
+
[Identifiers.property, Identifiers.property],
|
|
11928
|
+
[Identifiers.styleProp, Identifiers.styleProp],
|
|
11929
|
+
[Identifiers.stylePropInterpolate1, Identifiers.stylePropInterpolate1],
|
|
11930
|
+
[Identifiers.stylePropInterpolate2, Identifiers.stylePropInterpolate2],
|
|
11931
|
+
[Identifiers.stylePropInterpolate3, Identifiers.stylePropInterpolate3],
|
|
11932
|
+
[Identifiers.stylePropInterpolate4, Identifiers.stylePropInterpolate4],
|
|
11933
|
+
[Identifiers.stylePropInterpolate5, Identifiers.stylePropInterpolate5],
|
|
11934
|
+
[Identifiers.stylePropInterpolate6, Identifiers.stylePropInterpolate6],
|
|
11935
|
+
[Identifiers.stylePropInterpolate7, Identifiers.stylePropInterpolate7],
|
|
11936
|
+
[Identifiers.stylePropInterpolate8, Identifiers.stylePropInterpolate8],
|
|
11937
|
+
[Identifiers.stylePropInterpolateV, Identifiers.stylePropInterpolateV],
|
|
11938
|
+
[Identifiers.syntheticHostListener, Identifiers.syntheticHostListener],
|
|
11939
|
+
[Identifiers.syntheticHostProperty, Identifiers.syntheticHostProperty],
|
|
11940
|
+
[Identifiers.templateCreate, Identifiers.templateCreate],
|
|
11941
|
+
[Identifiers.twoWayProperty, Identifiers.twoWayProperty],
|
|
11942
|
+
[Identifiers.twoWayListener, Identifiers.twoWayListener],
|
|
11943
|
+
[Identifiers.declareLet, Identifiers.declareLet],
|
|
11944
|
+
[Identifiers.conditionalCreate, Identifiers.conditionalBranchCreate],
|
|
11945
|
+
[Identifiers.conditionalBranchCreate, Identifiers.conditionalBranchCreate],
|
|
11885
11946
|
]);
|
|
11886
11947
|
/**
|
|
11887
11948
|
* Chaining results in repeated call expressions, causing a deep AST of receiver expressions. To prevent running out of
|
|
@@ -11927,14 +11988,16 @@ function chainOperationsInList(opList) {
|
|
|
11927
11988
|
continue;
|
|
11928
11989
|
}
|
|
11929
11990
|
const instruction = op.statement.expr.fn.value;
|
|
11930
|
-
if (!
|
|
11991
|
+
if (!CHAIN_COMPATIBILITY.has(instruction)) {
|
|
11931
11992
|
// This instruction isn't chainable.
|
|
11932
11993
|
chain = null;
|
|
11933
11994
|
continue;
|
|
11934
11995
|
}
|
|
11935
11996
|
// This instruction can be chained. It can either be added on to the previous chain (if
|
|
11936
11997
|
// compatible) or it can be the start of a new chain.
|
|
11937
|
-
if (chain !== null &&
|
|
11998
|
+
if (chain !== null &&
|
|
11999
|
+
CHAIN_COMPATIBILITY.get(chain.instruction) === instruction &&
|
|
12000
|
+
chain.length < MAX_CHAIN_LENGTH) {
|
|
11938
12001
|
// This instruction can be added onto the previous chain.
|
|
11939
12002
|
const expression = chain.expression.callFn(op.statement.expr.args, op.statement.expr.sourceSpan, op.statement.expr.pure);
|
|
11940
12003
|
chain.expression = expression;
|
|
@@ -13153,6 +13216,8 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
13153
13216
|
const scope = getScopeForView(view, parentScope);
|
|
13154
13217
|
for (const op of view.create) {
|
|
13155
13218
|
switch (op.kind) {
|
|
13219
|
+
case OpKind.ConditionalCreate:
|
|
13220
|
+
case OpKind.ConditionalBranchCreate:
|
|
13156
13221
|
case OpKind.Template:
|
|
13157
13222
|
// Descend into child embedded views.
|
|
13158
13223
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
@@ -13210,6 +13275,8 @@ function getScopeForView(view, parent) {
|
|
|
13210
13275
|
for (const op of view.create) {
|
|
13211
13276
|
switch (op.kind) {
|
|
13212
13277
|
case OpKind.ElementStart:
|
|
13278
|
+
case OpKind.ConditionalCreate:
|
|
13279
|
+
case OpKind.ConditionalBranchCreate:
|
|
13213
13280
|
case OpKind.Template:
|
|
13214
13281
|
if (!Array.isArray(op.localRefs)) {
|
|
13215
13282
|
throw new Error(`AssertionError: expected localRefs to be an array`);
|
|
@@ -21740,6 +21807,8 @@ function liftLocalRefs(job) {
|
|
|
21740
21807
|
for (const op of unit.create) {
|
|
21741
21808
|
switch (op.kind) {
|
|
21742
21809
|
case OpKind.ElementStart:
|
|
21810
|
+
case OpKind.ConditionalCreate:
|
|
21811
|
+
case OpKind.ConditionalBranchCreate:
|
|
21743
21812
|
case OpKind.Template:
|
|
21744
21813
|
if (!Array.isArray(op.localRefs)) {
|
|
21745
21814
|
throw new Error(`AssertionError: expected localRefs to be an array still`);
|
|
@@ -21882,7 +21951,9 @@ function parseExtractedStyles(job) {
|
|
|
21882
21951
|
isStringLiteral(op.expression)) {
|
|
21883
21952
|
const target = elements.get(op.target);
|
|
21884
21953
|
if (target !== undefined &&
|
|
21885
|
-
target.kind === OpKind.Template
|
|
21954
|
+
(target.kind === OpKind.Template ||
|
|
21955
|
+
target.kind === OpKind.ConditionalCreate ||
|
|
21956
|
+
target.kind === OpKind.ConditionalBranchCreate) &&
|
|
21886
21957
|
target.templateKind === TemplateKind.Structural) {
|
|
21887
21958
|
// TemplateDefinitionBuilder will not apply class and style bindings to structural
|
|
21888
21959
|
// directives; instead, it will leave them as attributes.
|
|
@@ -21997,6 +22068,8 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
21997
22068
|
addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
|
|
21998
22069
|
}
|
|
21999
22070
|
break;
|
|
22071
|
+
case OpKind.ConditionalCreate:
|
|
22072
|
+
case OpKind.ConditionalBranchCreate:
|
|
22000
22073
|
case OpKind.Template:
|
|
22001
22074
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
22002
22075
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
@@ -22482,6 +22555,8 @@ function propagateI18nBlocksToTemplates(unit, subTemplateIndex) {
|
|
|
22482
22555
|
}
|
|
22483
22556
|
i18nBlock = null;
|
|
22484
22557
|
break;
|
|
22558
|
+
case OpKind.ConditionalCreate:
|
|
22559
|
+
case OpKind.ConditionalBranchCreate:
|
|
22485
22560
|
case OpKind.Template:
|
|
22486
22561
|
subTemplateIndex = propagateI18nBlocksForView(unit.job.views.get(op.xref), i18nBlock, op.i18nPlaceholder, subTemplateIndex);
|
|
22487
22562
|
break;
|
|
@@ -22846,6 +22921,42 @@ function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
|
|
|
22846
22921
|
}
|
|
22847
22922
|
return call(Identifiers.i18nStart, args, sourceSpan);
|
|
22848
22923
|
}
|
|
22924
|
+
function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
22925
|
+
const args = [
|
|
22926
|
+
literal(slot),
|
|
22927
|
+
templateFnRef,
|
|
22928
|
+
literal(decls),
|
|
22929
|
+
literal(vars),
|
|
22930
|
+
literal(tag),
|
|
22931
|
+
literal(constIndex),
|
|
22932
|
+
];
|
|
22933
|
+
if (localRefs !== null) {
|
|
22934
|
+
args.push(literal(localRefs));
|
|
22935
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
22936
|
+
}
|
|
22937
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
22938
|
+
args.pop();
|
|
22939
|
+
}
|
|
22940
|
+
return call(Identifiers.conditionalCreate, args, sourceSpan);
|
|
22941
|
+
}
|
|
22942
|
+
function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
|
|
22943
|
+
const args = [
|
|
22944
|
+
literal(slot),
|
|
22945
|
+
templateFnRef,
|
|
22946
|
+
literal(decls),
|
|
22947
|
+
literal(vars),
|
|
22948
|
+
literal(tag),
|
|
22949
|
+
literal(constIndex),
|
|
22950
|
+
];
|
|
22951
|
+
if (localRefs !== null) {
|
|
22952
|
+
args.push(literal(localRefs));
|
|
22953
|
+
args.push(importExpr(Identifiers.templateRefExtractor));
|
|
22954
|
+
}
|
|
22955
|
+
while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
|
|
22956
|
+
args.pop();
|
|
22957
|
+
}
|
|
22958
|
+
return call(Identifiers.conditionalBranchCreate, args, sourceSpan);
|
|
22959
|
+
}
|
|
22849
22960
|
function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
|
|
22850
22961
|
const args = [
|
|
22851
22962
|
literal(slot),
|
|
@@ -23415,6 +23526,26 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23415
23526
|
}
|
|
23416
23527
|
OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
|
|
23417
23528
|
break;
|
|
23529
|
+
case OpKind.ConditionalCreate:
|
|
23530
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
23531
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
23532
|
+
}
|
|
23533
|
+
if (Array.isArray(op.localRefs)) {
|
|
23534
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
23535
|
+
}
|
|
23536
|
+
const conditionalCreateChildView = unit.job.views.get(op.xref);
|
|
23537
|
+
OpList.replace(op, conditionalCreate(op.handle.slot, variable(conditionalCreateChildView.fnName), conditionalCreateChildView.decls, conditionalCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23538
|
+
break;
|
|
23539
|
+
case OpKind.ConditionalBranchCreate:
|
|
23540
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
23541
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
23542
|
+
}
|
|
23543
|
+
if (Array.isArray(op.localRefs)) {
|
|
23544
|
+
throw new Error(`AssertionError: local refs array should have been extracted into a constant`);
|
|
23545
|
+
}
|
|
23546
|
+
const conditionalBranchCreateChildView = unit.job.views.get(op.xref);
|
|
23547
|
+
OpList.replace(op, conditionalBranchCreate(op.handle.slot, variable(conditionalBranchCreateChildView.fnName), conditionalBranchCreateChildView.decls, conditionalBranchCreateChildView.vars, op.tag, op.attributes, op.localRefs, op.startSourceSpan));
|
|
23548
|
+
break;
|
|
23418
23549
|
case OpKind.RepeaterCreate:
|
|
23419
23550
|
if (op.handle.slot === null) {
|
|
23420
23551
|
throw new Error('No slot was assigned for repeater instruction');
|
|
@@ -23972,6 +24103,8 @@ function resolvePlaceholdersForView(job, unit, i18nContexts, elements, pendingSt
|
|
|
23972
24103
|
pendingStructuralDirective = undefined;
|
|
23973
24104
|
}
|
|
23974
24105
|
break;
|
|
24106
|
+
case OpKind.ConditionalCreate:
|
|
24107
|
+
case OpKind.ConditionalBranchCreate:
|
|
23975
24108
|
case OpKind.Template:
|
|
23976
24109
|
const view = job.views.get(op.xref);
|
|
23977
24110
|
if (op.i18nPlaceholder === undefined) {
|
|
@@ -24535,7 +24668,10 @@ function allocateSlots(job) {
|
|
|
24535
24668
|
// propagate the number of slots used for each view into the operation which declares it.
|
|
24536
24669
|
for (const unit of job.units) {
|
|
24537
24670
|
for (const op of unit.ops()) {
|
|
24538
|
-
if (op.kind === OpKind.Template ||
|
|
24671
|
+
if (op.kind === OpKind.Template ||
|
|
24672
|
+
op.kind === OpKind.ConditionalCreate ||
|
|
24673
|
+
op.kind === OpKind.ConditionalBranchCreate ||
|
|
24674
|
+
op.kind === OpKind.RepeaterCreate) {
|
|
24539
24675
|
// Record the number of slots used by the view this `ir.TemplateOp` declares in the
|
|
24540
24676
|
// operation itself, so it can be emitted later.
|
|
24541
24677
|
const childView = job.views.get(op.xref);
|
|
@@ -24596,6 +24732,8 @@ function optimizeStoreLet(job) {
|
|
|
24596
24732
|
* typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
|
|
24597
24733
|
* incorrectly prints `a ? b : c ?? d`. This is different from how it handles the same situation
|
|
24598
24734
|
* with `||` and `&&` where it prints the parentheses even if they are not present in the AST.
|
|
24735
|
+
* Note: We may be able to remove this case if Typescript resolves the following issue:
|
|
24736
|
+
* https://github.com/microsoft/TypeScript/issues/61369
|
|
24599
24737
|
*/
|
|
24600
24738
|
function stripNonrequiredParentheses(job) {
|
|
24601
24739
|
// Check which parentheses are required.
|
|
@@ -24970,7 +25108,10 @@ function countVariables(job) {
|
|
|
24970
25108
|
// an embedded view).
|
|
24971
25109
|
for (const unit of job.units) {
|
|
24972
25110
|
for (const op of unit.create) {
|
|
24973
|
-
if (op.kind !== OpKind.Template &&
|
|
25111
|
+
if (op.kind !== OpKind.Template &&
|
|
25112
|
+
op.kind !== OpKind.RepeaterCreate &&
|
|
25113
|
+
op.kind !== OpKind.ConditionalCreate &&
|
|
25114
|
+
op.kind !== OpKind.ConditionalBranchCreate) {
|
|
24974
25115
|
continue;
|
|
24975
25116
|
}
|
|
24976
25117
|
const childView = job.views.get(op.xref);
|
|
@@ -25954,13 +26095,14 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
25954
26095
|
}
|
|
25955
26096
|
ifCaseI18nMeta = ifCase.i18n;
|
|
25956
26097
|
}
|
|
25957
|
-
const
|
|
25958
|
-
|
|
26098
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
26099
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, 'Conditional', Namespace.HTML, ifCaseI18nMeta, ifCase.startSourceSpan, ifCase.sourceSpan);
|
|
26100
|
+
unit.create.push(conditionalCreateOp);
|
|
25959
26101
|
if (firstXref === null) {
|
|
25960
26102
|
firstXref = cView.xref;
|
|
25961
26103
|
}
|
|
25962
26104
|
const caseExpr = ifCase.expression ? convertAst(ifCase.expression, unit.job, null) : null;
|
|
25963
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
26105
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle, ifCase.expressionAlias);
|
|
25964
26106
|
conditions.push(conditionalCaseExpr);
|
|
25965
26107
|
ingestNodes(cView, ifCase.children);
|
|
25966
26108
|
}
|
|
@@ -25976,7 +26118,8 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
25976
26118
|
}
|
|
25977
26119
|
let firstXref = null;
|
|
25978
26120
|
let conditions = [];
|
|
25979
|
-
for (
|
|
26121
|
+
for (let i = 0; i < switchBlock.cases.length; i++) {
|
|
26122
|
+
const switchCase = switchBlock.cases[i];
|
|
25980
26123
|
const cView = unit.job.allocateView(unit.xref);
|
|
25981
26124
|
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
|
|
25982
26125
|
let switchCaseI18nMeta = undefined;
|
|
@@ -25986,15 +26129,16 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
25986
26129
|
}
|
|
25987
26130
|
switchCaseI18nMeta = switchCase.i18n;
|
|
25988
26131
|
}
|
|
25989
|
-
const
|
|
25990
|
-
|
|
26132
|
+
const createOp = i === 0 ? createConditionalCreateOp : createConditionalBranchCreateOp;
|
|
26133
|
+
const conditionalCreateOp = createOp(cView.xref, TemplateKind.Block, tagName, 'Case', Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
26134
|
+
unit.create.push(conditionalCreateOp);
|
|
25991
26135
|
if (firstXref === null) {
|
|
25992
26136
|
firstXref = cView.xref;
|
|
25993
26137
|
}
|
|
25994
26138
|
const caseExpr = switchCase.expression
|
|
25995
26139
|
? convertAst(switchCase.expression, unit.job, switchBlock.startSourceSpan)
|
|
25996
26140
|
: null;
|
|
25997
|
-
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr,
|
|
26141
|
+
const conditionalCaseExpr = new ConditionalCaseExpr(caseExpr, conditionalCreateOp.xref, conditionalCreateOp.handle);
|
|
25998
26142
|
conditions.push(conditionalCaseExpr);
|
|
25999
26143
|
ingestNodes(cView, switchCase.children);
|
|
26000
26144
|
}
|
|
@@ -32911,7 +33055,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32911
33055
|
function compileDeclareClassMetadata(metadata) {
|
|
32912
33056
|
const definitionMap = new DefinitionMap();
|
|
32913
33057
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32914
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33058
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
32915
33059
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32916
33060
|
definitionMap.set('type', metadata.type);
|
|
32917
33061
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32929,7 +33073,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32929
33073
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32930
33074
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32931
33075
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32932
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33076
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
32933
33077
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32934
33078
|
definitionMap.set('type', metadata.type);
|
|
32935
33079
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33024,7 +33168,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33024
33168
|
const definitionMap = new DefinitionMap();
|
|
33025
33169
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33026
33170
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33027
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33171
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
33028
33172
|
// e.g. `type: MyDirective`
|
|
33029
33173
|
definitionMap.set('type', meta.type.value);
|
|
33030
33174
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33440,7 +33584,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33440
33584
|
function compileDeclareFactoryFunction(meta) {
|
|
33441
33585
|
const definitionMap = new DefinitionMap();
|
|
33442
33586
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33443
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33587
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
33444
33588
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33445
33589
|
definitionMap.set('type', meta.type.value);
|
|
33446
33590
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33475,7 +33619,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33475
33619
|
function createInjectableDefinitionMap(meta) {
|
|
33476
33620
|
const definitionMap = new DefinitionMap();
|
|
33477
33621
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33478
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33622
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
33479
33623
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33480
33624
|
definitionMap.set('type', meta.type.value);
|
|
33481
33625
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33526,7 +33670,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33526
33670
|
function createInjectorDefinitionMap(meta) {
|
|
33527
33671
|
const definitionMap = new DefinitionMap();
|
|
33528
33672
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33529
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33673
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
33530
33674
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33531
33675
|
definitionMap.set('type', meta.type.value);
|
|
33532
33676
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33559,7 +33703,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33559
33703
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33560
33704
|
}
|
|
33561
33705
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33562
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33706
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
33563
33707
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33564
33708
|
definitionMap.set('type', meta.type.value);
|
|
33565
33709
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33610,7 +33754,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33610
33754
|
function createPipeDefinitionMap(meta) {
|
|
33611
33755
|
const definitionMap = new DefinitionMap();
|
|
33612
33756
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33613
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33757
|
+
definitionMap.set('version', literal('20.0.0-next.4'));
|
|
33614
33758
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33615
33759
|
// e.g. `type: MyPipe`
|
|
33616
33760
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33768,7 +33912,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
33768
33912
|
* @description
|
|
33769
33913
|
* Entry point for all public APIs of the compiler package.
|
|
33770
33914
|
*/
|
|
33771
|
-
const VERSION = new Version('20.0.0-next.
|
|
33915
|
+
const VERSION = new Version('20.0.0-next.4');
|
|
33772
33916
|
|
|
33773
33917
|
//////////////////////////////////////
|
|
33774
33918
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|