forked from rollup/rollup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWhileStatement.ts
26 lines (23 loc) · 870 Bytes
/
WhileStatement.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
import type { HasEffectsContext, InclusionContext } from '../ExecutionContext';
import type * as NodeType from './NodeType';
import {
type ExpressionNode,
type IncludeChildren,
StatementBase,
type StatementNode
} from './shared/Node';
import { hasLoopBodyEffects, includeLoopBody } from './shared/loops';
export default class WhileStatement extends StatementBase {
declare body: StatementNode;
declare test: ExpressionNode;
declare type: NodeType.tWhileStatement;
hasEffects(context: HasEffectsContext): boolean {
if (this.test.hasEffects(context)) return true;
return hasLoopBodyEffects(context, this.body);
}
include(context: InclusionContext, includeChildrenRecursively: IncludeChildren): void {
this.included = true;
this.test.include(context, includeChildrenRecursively);
includeLoopBody(context, this.body, includeChildrenRecursively);
}
}