use of org.ballerinalang.model.tree.statements.IfNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method endIfElseNode.
public void endIfElseNode(Set<Whitespace> ws) {
IfNode ifNode = ifElseStatementStack.pop();
ifNode.addWS(ws);
addStmtToCurrentBlock(ifNode);
}
use of org.ballerinalang.model.tree.statements.IfNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addIfBlock.
public void addIfBlock(DiagnosticPos pos, Set<Whitespace> ws) {
IfNode ifNode = ifElseStatementStack.peek();
((BLangIf) ifNode).pos = pos;
ifNode.addWS(ws);
ifNode.setCondition(exprNodeStack.pop());
ifNode.setBody(blockNodeStack.pop());
}
use of org.ballerinalang.model.tree.statements.IfNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addElseBlock.
public void addElseBlock(DiagnosticPos pos, Set<Whitespace> ws) {
IfNode ifNode = ifElseStatementStack.peek();
while (ifNode.getElseStatement() != null) {
ifNode = (IfNode) ifNode.getElseStatement();
}
ifNode.addWS(ws);
BlockNode elseBlock = blockNodeStack.pop();
((BLangBlockStmt) elseBlock).pos = pos;
ifNode.setElseStatement(elseBlock);
}
use of org.ballerinalang.model.tree.statements.IfNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addElseIfBlock.
public void addElseIfBlock(DiagnosticPos pos, Set<Whitespace> ws) {
IfNode elseIfNode = ifElseStatementStack.pop();
((BLangIf) elseIfNode).pos = pos;
elseIfNode.setCondition(exprNodeStack.pop());
elseIfNode.setBody(blockNodeStack.pop());
Set<Whitespace> elseWS = removeNthFromStart(ws, 0);
elseIfNode.addWS(ws);
IfNode parentIfNode = ifElseStatementStack.peek();
while (parentIfNode.getElseStatement() != null) {
parentIfNode = (IfNode) parentIfNode.getElseStatement();
}
parentIfNode.addWS(elseWS);
parentIfNode.setElseStatement(elseIfNode);
}
Aggregations