@@ -11,8 +11,8 @@ import type {ParseSourceSpan} from '../../../../parse_util';
11
11
12
12
import * as t from '../../../../render3/r3_ast' ;
13
13
import { ExpressionKind , OpKind , SanitizerFn } from './enums' ;
14
- import { ConsumesVarsTrait , UsesSlotIndex , UsesSlotIndexTrait , UsesVarOffset , UsesVarOffsetTrait } from './traits' ;
15
-
14
+ import { ConsumesVarsTrait , UsesVarOffset , UsesVarOffsetTrait } from './traits' ;
15
+ import { SlotHandle } from './handle' ;
16
16
import type { XrefId } from './operations' ;
17
17
import type { CreateOp } from './ops/create' ;
18
18
import { Interpolation , type UpdateOp } from './ops/update' ;
@@ -90,14 +90,10 @@ export class LexicalReadExpr extends ExpressionBase {
90
90
/**
91
91
* Runtime operation to retrieve the value of a local reference.
92
92
*/
93
- export class ReferenceExpr extends ExpressionBase implements UsesSlotIndexTrait {
93
+ export class ReferenceExpr extends ExpressionBase {
94
94
override readonly kind = ExpressionKind . Reference ;
95
95
96
- readonly [ UsesSlotIndex ] = true ;
97
-
98
- targetSlot : number | null = null ;
99
-
100
- constructor ( readonly target : XrefId , readonly offset : number ) {
96
+ constructor ( readonly target : XrefId , readonly targetSlot : SlotHandle , readonly offset : number ) {
101
97
super ( ) ;
102
98
}
103
99
@@ -114,9 +110,7 @@ export class ReferenceExpr extends ExpressionBase implements UsesSlotIndexTrait
114
110
override transformInternalExpressions ( ) : void { }
115
111
116
112
override clone ( ) : ReferenceExpr {
117
- const expr = new ReferenceExpr ( this . target , this . offset ) ;
118
- expr . targetSlot = this . targetSlot ;
119
- return expr ;
113
+ return new ReferenceExpr ( this . target , this . targetSlot , this . offset ) ;
120
114
}
121
115
}
122
116
@@ -442,18 +436,17 @@ export class PureFunctionParameterExpr extends ExpressionBase {
442
436
}
443
437
}
444
438
445
- export class PipeBindingExpr extends ExpressionBase implements UsesSlotIndexTrait ,
446
- ConsumesVarsTrait ,
439
+ export class PipeBindingExpr extends ExpressionBase implements ConsumesVarsTrait ,
447
440
UsesVarOffsetTrait {
448
441
override readonly kind = ExpressionKind . PipeBinding ;
449
- readonly [ UsesSlotIndex ] = true ;
450
442
readonly [ ConsumesVarsTrait ] = true ;
451
443
readonly [ UsesVarOffset ] = true ;
452
444
453
- targetSlot : number | null = null ;
454
445
varOffset : number | null = null ;
455
446
456
- constructor ( readonly target : XrefId , readonly name : string , readonly args : o . Expression [ ] ) {
447
+ constructor (
448
+ readonly target : XrefId , readonly targetSlot : SlotHandle , readonly name : string ,
449
+ readonly args : o . Expression [ ] ) {
457
450
super ( ) ;
458
451
}
459
452
@@ -479,27 +472,24 @@ export class PipeBindingExpr extends ExpressionBase implements UsesSlotIndexTrai
479
472
}
480
473
481
474
override clone ( ) {
482
- const r = new PipeBindingExpr ( this . target , this . name , this . args . map ( a => a . clone ( ) ) ) ;
483
- r . targetSlot = this . targetSlot ;
475
+ const r =
476
+ new PipeBindingExpr ( this . target , this . targetSlot , this . name , this . args . map ( a => a . clone ( ) ) ) ;
484
477
r . varOffset = this . varOffset ;
485
478
return r ;
486
479
}
487
480
}
488
481
489
- export class PipeBindingVariadicExpr extends ExpressionBase implements UsesSlotIndexTrait ,
490
- ConsumesVarsTrait ,
482
+ export class PipeBindingVariadicExpr extends ExpressionBase implements ConsumesVarsTrait ,
491
483
UsesVarOffsetTrait {
492
484
override readonly kind = ExpressionKind . PipeBindingVariadic ;
493
- readonly [ UsesSlotIndex ] = true ;
494
485
readonly [ ConsumesVarsTrait ] = true ;
495
486
readonly [ UsesVarOffset ] = true ;
496
487
497
- targetSlot : number | null = null ;
498
488
varOffset : number | null = null ;
499
489
500
490
constructor (
501
- readonly target : XrefId , readonly name : string , public args : o . Expression ,
502
- public numArgs : number ) {
491
+ readonly target : XrefId , readonly targetSlot : SlotHandle , readonly name : string ,
492
+ public args : o . Expression , public numArgs : number ) {
503
493
super ( ) ;
504
494
}
505
495
@@ -521,8 +511,8 @@ export class PipeBindingVariadicExpr extends ExpressionBase implements UsesSlotI
521
511
}
522
512
523
513
override clone ( ) : PipeBindingVariadicExpr {
524
- const r = new PipeBindingVariadicExpr ( this . target , this . name , this . args . clone ( ) , this . numArgs ) ;
525
- r . targetSlot = this . targetSlot ;
514
+ const r = new PipeBindingVariadicExpr (
515
+ this . target , this . targetSlot , this . name , this . args . clone ( ) , this . numArgs ) ;
526
516
r . varOffset = this . varOffset ;
527
517
return r ;
528
518
}
@@ -766,31 +756,25 @@ export class SanitizerExpr extends ExpressionBase {
766
756
override transformInternalExpressions ( ) : void { }
767
757
}
768
758
769
- export class SlotLiteralExpr extends ExpressionBase implements UsesSlotIndexTrait {
759
+ export class SlotLiteralExpr extends ExpressionBase {
770
760
override readonly kind = ExpressionKind . SlotLiteralExpr ;
771
- readonly [ UsesSlotIndex ] = true ;
772
761
773
- constructor ( readonly target : XrefId ) {
762
+ constructor ( readonly slot : SlotHandle ) {
774
763
super ( ) ;
775
764
}
776
765
777
- targetSlot : number | null = null ;
778
-
779
766
override visitExpression ( visitor : o . ExpressionVisitor , context : any ) : any { }
780
767
781
768
override isEquivalent ( e : Expression ) : boolean {
782
- return e instanceof SlotLiteralExpr && e . target === this . target &&
783
- e . targetSlot === this . targetSlot ;
769
+ return e instanceof SlotLiteralExpr && e . slot === this . slot ;
784
770
}
785
771
786
772
override isConstant ( ) {
787
773
return true ;
788
774
}
789
775
790
776
override clone ( ) : SlotLiteralExpr {
791
- const copy = new SlotLiteralExpr ( this . target ) ;
792
- copy . targetSlot = this . targetSlot ;
793
- return copy ;
777
+ return new SlotLiteralExpr ( this . slot ) ;
794
778
}
795
779
796
780
override transformInternalExpressions ( ) : void { }
@@ -805,7 +789,7 @@ export class ConditionalCaseExpr extends ExpressionBase {
805
789
* @param target The Xref of the view to be displayed if this condition is true.
806
790
*/
807
791
constructor (
808
- public expr : o . Expression | null , readonly target : XrefId ,
792
+ public expr : o . Expression | null , readonly target : XrefId , readonly targetSlot : SlotHandle ,
809
793
readonly alias : t . Variable | null = null ) {
810
794
super ( ) ;
811
795
}
@@ -825,7 +809,7 @@ export class ConditionalCaseExpr extends ExpressionBase {
825
809
}
826
810
827
811
override clone ( ) : ConditionalCaseExpr {
828
- return new ConditionalCaseExpr ( this . expr , this . target ) ;
812
+ return new ConditionalCaseExpr ( this . expr , this . target , this . targetSlot ) ;
829
813
}
830
814
831
815
override transformInternalExpressions ( transform : ExpressionTransform , flags : VisitorContextFlag ) :
@@ -975,7 +959,6 @@ export function transformExpressionsInOp(
975
959
case OpKind . ContainerStart :
976
960
case OpKind . Defer :
977
961
case OpKind . DeferOn :
978
- case OpKind . DeferSecondaryBlock :
979
962
case OpKind . DisableBindings :
980
963
case OpKind . Element :
981
964
case OpKind . ElementEnd :
0 commit comments