-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathDoWhileStatement.ts
31 lines (27 loc) · 1.04 KB
/
DoWhileStatement.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
import type { HasEffectsContext, InclusionContext } from '../ExecutionContext';
import type * as NodeType from './NodeType';
import { hasLoopBodyEffects, includeLoopBody } from './shared/loops';
import {
doNotDeoptimize,
type ExpressionNode,
type IncludeChildren,
onlyIncludeSelfNoDeoptimize,
StatementBase,
type StatementNode
} from './shared/Node';
export default class DoWhileStatement extends StatementBase {
declare body: StatementNode;
declare test: ExpressionNode;
declare type: NodeType.tDoWhileStatement;
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);
}
}
DoWhileStatement.prototype.includeNode = onlyIncludeSelfNoDeoptimize;
DoWhileStatement.prototype.applyDeoptimizations = doNotDeoptimize;