Skip to content

Commit 442720b

Browse files
authored
Remove FlowNodes and FlowFlags from public API (#58036)
1 parent 46b4c92 commit 442720b

File tree

2 files changed

+11
-55
lines changed

2 files changed

+11
-55
lines changed

src/compiler/types.ts

+11
Original file line numberDiff line numberDiff line change
@@ -4070,6 +4070,7 @@ export interface JSDocImportTag extends JSDocTag {
40704070

40714071
// NOTE: Ensure this is up-to-date with src/debug/debug.ts
40724072
// dprint-ignore
4073+
/** @internal */
40734074
export const enum FlowFlags {
40744075
Unreachable = 1 << 0, // Unreachable code
40754076
Start = 1 << 1, // Start of flow graph
@@ -4089,6 +4090,7 @@ export const enum FlowFlags {
40894090
Condition = TrueCondition | FalseCondition,
40904091
}
40914092

4093+
/** @internal */
40924094
export type FlowNode =
40934095
| FlowStart
40944096
| FlowLabel
@@ -4099,6 +4101,7 @@ export type FlowNode =
40994101
| FlowCall
41004102
| FlowReduceLabel;
41014103

4104+
/** @internal */
41024105
export interface FlowNodeBase {
41034106
flags: FlowFlags;
41044107
id?: number; // Node id used by flow type cache in checker
@@ -4107,35 +4110,41 @@ export interface FlowNodeBase {
41074110
// FlowStart represents the start of a control flow. For a function expression or arrow
41084111
// function, the node property references the function (which in turn has a flowNode
41094112
// property for the containing control flow).
4113+
/** @internal */
41104114
export interface FlowStart extends FlowNodeBase {
41114115
node?: FunctionExpression | ArrowFunction | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
41124116
}
41134117

41144118
// FlowLabel represents a junction with multiple possible preceding control flows.
4119+
/** @internal */
41154120
export interface FlowLabel extends FlowNodeBase {
41164121
antecedents: FlowNode[] | undefined;
41174122
}
41184123

41194124
// FlowAssignment represents a node that assigns a value to a narrowable reference,
41204125
// i.e. an identifier or a dotted name that starts with an identifier or 'this'.
4126+
/** @internal */
41214127
export interface FlowAssignment extends FlowNodeBase {
41224128
node: Expression | VariableDeclaration | BindingElement;
41234129
antecedent: FlowNode;
41244130
}
41254131

4132+
/** @internal */
41264133
export interface FlowCall extends FlowNodeBase {
41274134
node: CallExpression;
41284135
antecedent: FlowNode;
41294136
}
41304137

41314138
// FlowCondition represents a condition that is known to be true or false at the
41324139
// node's location in the control flow.
4140+
/** @internal */
41334141
export interface FlowCondition extends FlowNodeBase {
41344142
node: Expression;
41354143
antecedent: FlowNode;
41364144
}
41374145

41384146
// dprint-ignore
4147+
/** @internal */
41394148
export interface FlowSwitchClause extends FlowNodeBase {
41404149
switchStatement: SwitchStatement;
41414150
clauseStart: number; // Start index of case/default clause range
@@ -4145,11 +4154,13 @@ export interface FlowSwitchClause extends FlowNodeBase {
41454154

41464155
// FlowArrayMutation represents a node potentially mutates an array, i.e. an
41474156
// operation of the form 'x.push(value)', 'x.unshift(value)' or 'x[n] = value'.
4157+
/** @internal */
41484158
export interface FlowArrayMutation extends FlowNodeBase {
41494159
node: CallExpression | BinaryExpression;
41504160
antecedent: FlowNode;
41514161
}
41524162

4163+
/** @internal */
41534164
export interface FlowReduceLabel extends FlowNodeBase {
41544165
target: FlowLabel;
41554166
antecedents: FlowNode[];

tests/baselines/reference/api/typescript.d.ts

-55
Original file line numberDiff line numberDiff line change
@@ -5793,61 +5793,6 @@ declare namespace ts {
57935793
readonly moduleSpecifier: Expression;
57945794
readonly attributes?: ImportAttributes;
57955795
}
5796-
enum FlowFlags {
5797-
Unreachable = 1,
5798-
Start = 2,
5799-
BranchLabel = 4,
5800-
LoopLabel = 8,
5801-
Assignment = 16,
5802-
TrueCondition = 32,
5803-
FalseCondition = 64,
5804-
SwitchClause = 128,
5805-
ArrayMutation = 256,
5806-
Call = 512,
5807-
ReduceLabel = 1024,
5808-
Referenced = 2048,
5809-
Shared = 4096,
5810-
Label = 12,
5811-
Condition = 96,
5812-
}
5813-
type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel;
5814-
interface FlowNodeBase {
5815-
flags: FlowFlags;
5816-
id?: number;
5817-
}
5818-
interface FlowStart extends FlowNodeBase {
5819-
node?: FunctionExpression | ArrowFunction | MethodDeclaration | GetAccessorDeclaration | SetAccessorDeclaration;
5820-
}
5821-
interface FlowLabel extends FlowNodeBase {
5822-
antecedents: FlowNode[] | undefined;
5823-
}
5824-
interface FlowAssignment extends FlowNodeBase {
5825-
node: Expression | VariableDeclaration | BindingElement;
5826-
antecedent: FlowNode;
5827-
}
5828-
interface FlowCall extends FlowNodeBase {
5829-
node: CallExpression;
5830-
antecedent: FlowNode;
5831-
}
5832-
interface FlowCondition extends FlowNodeBase {
5833-
node: Expression;
5834-
antecedent: FlowNode;
5835-
}
5836-
interface FlowSwitchClause extends FlowNodeBase {
5837-
switchStatement: SwitchStatement;
5838-
clauseStart: number;
5839-
clauseEnd: number;
5840-
antecedent: FlowNode;
5841-
}
5842-
interface FlowArrayMutation extends FlowNodeBase {
5843-
node: CallExpression | BinaryExpression;
5844-
antecedent: FlowNode;
5845-
}
5846-
interface FlowReduceLabel extends FlowNodeBase {
5847-
target: FlowLabel;
5848-
antecedents: FlowNode[];
5849-
antecedent: FlowNode;
5850-
}
58515796
type FlowType = Type | IncompleteType;
58525797
interface IncompleteType {
58535798
flags: TypeFlags | 0;

0 commit comments

Comments
 (0)