forked from rollup/rollup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContinueStatement.ts
32 lines (29 loc) · 932 Bytes
/
ContinueStatement.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { type HasEffectsContext, type InclusionContext } from '../ExecutionContext';
import type Identifier from './Identifier';
import type * as NodeType from './NodeType';
import { StatementBase } from './shared/Node';
export default class ContinueStatement extends StatementBase {
declare label: Identifier | null;
declare type: NodeType.tContinueStatement;
hasEffects(context: HasEffectsContext): boolean {
if (this.label) {
if (!context.ignore.labels.has(this.label.name)) return true;
context.includedLabels.add(this.label.name);
} else {
if (!context.ignore.continues) return true;
context.hasContinue = true;
}
context.brokenFlow = true;
return false;
}
include(context: InclusionContext): void {
this.included = true;
if (this.label) {
this.label.include();
context.includedLabels.add(this.label.name);
} else {
context.hasContinue = true;
}
context.brokenFlow = true;
}
}