use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addTimeoutCause.
public void addTimeoutCause(Set<Whitespace> ws, String identifier) {
BLangForkJoin forkJoin = (BLangForkJoin) this.forkJoinNodesStack.peek();
forkJoin.timeoutBody = (BLangBlockStmt) this.blockNodeStack.pop();
forkJoin.timeoutExpression = (BLangExpression) this.exprNodeStack.pop();
Set<Whitespace> varWS = removeNthFromLast(ws, 3);
forkJoin.addWS(ws);
forkJoin.timeoutVariable = (BLangVariable) this.generateBasicVarNode((DiagnosticPos) this.typeNodeStack.peek().getPosition(), varWS, identifier, false);
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addTransactionBlock.
public void addTransactionBlock(DiagnosticPos pos) {
TransactionNode transactionNode = transactionNodeStack.peek();
BLangBlockStmt transactionBlock = (BLangBlockStmt) this.blockNodeStack.pop();
transactionBlock.pos = pos;
transactionNode.setTransactionBody(transactionBlock);
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addMatchStmtPattern.
public void addMatchStmtPattern(DiagnosticPos pos, Set<Whitespace> ws, String identifier) {
BLangMatchStmtPatternClause patternClause = (BLangMatchStmtPatternClause) TreeBuilder.createMatchStatementPattern();
patternClause.pos = pos;
Set<Whitespace> varDefWS = removeNthFromStart(ws, 0);
patternClause.addWS(ws);
// Create a variable node
identifier = identifier == null ? Names.IGNORE.value : identifier;
BLangVariable var = (BLangVariable) TreeBuilder.createVariableNode();
var.pos = pos;
var.setName(this.createIdentifier(identifier));
var.setTypeNode(this.typeNodeStack.pop());
var.addWS(varDefWS);
patternClause.variable = var;
patternClause.body = (BLangBlockStmt) blockNodeStack.pop();
patternClause.body.pos = pos;
this.matchStmtStack.peekFirst().patternClauses.add(patternClause);
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addForeachStatement.
public void addForeachStatement(DiagnosticPos pos, Set<Whitespace> ws) {
BLangForeach foreach = (BLangForeach) TreeBuilder.createForeachNode();
foreach.addWS(ws);
foreach.pos = pos;
foreach.setCollection(exprNodeStack.pop());
foreach.addWS(commaWsStack.pop());
List<ExpressionNode> lExprList = exprNodeListStack.pop();
lExprList.forEach(expressionNode -> foreach.addVariable((BLangVariableReference) expressionNode));
BLangBlockStmt foreachBlock = (BLangBlockStmt) this.blockNodeStack.pop();
foreachBlock.pos = pos;
foreach.setBody(foreachBlock);
addStmtToCurrentBlock(foreach);
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addOnretryBlock.
public void addOnretryBlock(DiagnosticPos pos, Set<Whitespace> ws) {
TransactionNode transactionNode = transactionNodeStack.peek();
BLangBlockStmt onretryBlock = (BLangBlockStmt) this.blockNodeStack.pop();
onretryBlock.pos = pos;
transactionNode.addWS(ws);
transactionNode.setOnRetryBody(onretryBlock);
}
Aggregations