File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ namespace ts {
125
125
// state used for emit helpers
126
126
let emitFlags : NodeFlags ;
127
127
128
+ let clonedNodeMarker = 0 ;
129
+
128
130
// If this file is an external module, then it is automatically in strict-mode according to
129
131
// ES6. If it is not an external module, then we'll determine if it is in strict mode or
130
132
// not depending on if we see "use strict" in certain places or if we hit a class/namespace
@@ -150,6 +152,7 @@ namespace ts {
150
152
classifiableNames = createMap < string > ( ) ;
151
153
symbolCount = 0 ;
152
154
skipTransformFlagAggregation = isDeclarationFile ( file ) ;
155
+ clonedNodeMarker = 0 ;
153
156
154
157
Symbol = objectAllocator . getSymbolConstructor ( ) ;
155
158
@@ -775,6 +778,21 @@ namespace ts {
775
778
}
776
779
}
777
780
781
+ function markClonableFlowNodes < T extends FlowNode > ( flowNode : T ) : T {
782
+ if ( clonedNodeMarker !== 0 ) {
783
+ flowNode . flags |= clonedNodeMarker << 22 ;
784
+ }
785
+ return flowNode ;
786
+ }
787
+
788
+ function getFlowNodeMarker ( flowNode : FlowNode ) : number {
789
+ return flowNode . flags >> 22 ;
790
+ }
791
+
792
+ function resetFlowNodeMarker ( flowNode : FlowNode ) : void {
793
+ flowNode . flags &=
794
+ }
795
+
778
796
function createFlowCondition ( flags : FlowFlags , antecedent : FlowNode , expression : Expression ) : FlowNode {
779
797
if ( antecedent . flags & FlowFlags . Unreachable ) {
780
798
return antecedent ;
Original file line number Diff line number Diff line change @@ -2055,7 +2055,9 @@ namespace ts {
2055
2055
Referenced = 1 << 9 , // Referenced as antecedent once
2056
2056
Shared = 1 << 10 , // Referenced as antecedent more than once
2057
2057
Label = BranchLabel | LoopLabel ,
2058
- Condition = TrueCondition | FalseCondition
2058
+ Condition = TrueCondition | FalseCondition ,
2059
+
2060
+ // range from 22-29 bits is reserved for marking flow nodes that should be cloned during binding
2059
2061
}
2060
2062
2061
2063
export interface FlowNode {
You can’t perform that action at this time.
0 commit comments