forked from dsherret/ts-morph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
IfStatement.ts
28 lines (25 loc) · 873 Bytes
/
IfStatement.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
import { ts } from "../../../typescript";
import { ChildOrderableNode } from "../base";
import { Expression } from "../expression";
import { Statement } from "./Statement";
export const IfStatementBase = ChildOrderableNode(Statement);
export class IfStatement extends IfStatementBase<ts.IfStatement> {
/**
* Gets this if statement's expression.
*/
getExpression(): Expression {
return this._getNodeFromCompilerNode(this.compilerNode.expression);
}
/**
* Gets this if statement's then statement.
*/
getThenStatement(): Statement {
return this._getNodeFromCompilerNode(this.compilerNode.thenStatement);
}
/**
* Gets this if statement's else statement.
*/
getElseStatement(): Statement | undefined {
return this._getNodeFromCompilerNodeIfExists(this.compilerNode.elseStatement);
}
}