use of org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addWorkerSendStmt.
public void addWorkerSendStmt(DiagnosticPos pos, Set<Whitespace> ws, String workerName, boolean isForkJoinSend) {
BLangWorkerSend workerSendNode = (BLangWorkerSend) TreeBuilder.createWorkerSendNode();
workerSendNode.setWorkerName(this.createIdentifier(workerName));
exprNodeListStack.pop().forEach(expr -> workerSendNode.exprs.add((BLangExpression) expr));
workerSendNode.addWS(commaWsStack.pop());
workerSendNode.isForkJoinSend = isForkJoinSend;
workerSendNode.pos = pos;
workerSendNode.addWS(ws);
addStmtToCurrentBlock(workerSendNode);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addArrayInitExpr.
public void addArrayInitExpr(DiagnosticPos pos, Set<Whitespace> ws, boolean argsAvailable) {
List<ExpressionNode> argExprList;
BLangArrayLiteral arrayLiteral = (BLangArrayLiteral) TreeBuilder.createArrayLiteralNode();
if (argsAvailable) {
arrayLiteral.addWS(commaWsStack.pop());
argExprList = exprNodeListStack.pop();
} else {
argExprList = new ArrayList<>(0);
}
arrayLiteral.exprs = argExprList.stream().map(expr -> (BLangExpression) expr).collect(Collectors.toList());
arrayLiteral.pos = pos;
arrayLiteral.addWS(ws);
addExpressionNode(arrayLiteral);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression in project ballerina by ballerina-lang.
the class BLangPackageBuilder method createUnaryExpr.
public void createUnaryExpr(DiagnosticPos pos, Set<Whitespace> ws, String operator) {
BLangUnaryExpr unaryExpressionNode = (BLangUnaryExpr) TreeBuilder.createUnaryExpressionNode();
unaryExpressionNode.pos = pos;
unaryExpressionNode.addWS(ws);
unaryExpressionNode.expr = (BLangExpression) exprNodeStack.pop();
unaryExpressionNode.operator = OperatorKind.valueFrom(operator);
addExpressionNode(unaryExpressionNode);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addIntRangeExpression.
public void addIntRangeExpression(DiagnosticPos pos, Set<Whitespace> ws, boolean includeStart, boolean includeEnd) {
BLangIntRangeExpression intRangeExpr = (BLangIntRangeExpression) TreeBuilder.createIntRangeExpression();
intRangeExpr.pos = pos;
intRangeExpr.addWS(ws);
intRangeExpr.endExpr = (BLangExpression) this.exprNodeStack.pop();
intRangeExpr.startExpr = (BLangExpression) this.exprNodeStack.pop();
intRangeExpr.includeStart = includeStart;
intRangeExpr.includeEnd = includeEnd;
exprNodeStack.push(intRangeExpr);
}
use of org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addPostIncrementStatement.
public void addPostIncrementStatement(DiagnosticPos pos, Set<Whitespace> ws, String operator) {
BLangPostIncrement postIncrement = (BLangPostIncrement) TreeBuilder.createPostIncrementNode();
postIncrement.setVariable((BLangVariableReference) exprNodeStack.pop());
postIncrement.pos = pos;
postIncrement.addWS(ws);
addLiteralValue(pos, ws, TypeTags.INT, Long.parseLong("1"));
postIncrement.increment = (BLangExpression) exprNodeStack.pop();
postIncrement.opKind = OperatorKind.valueFrom(operator);
addStmtToCurrentBlock(postIncrement);
}
Aggregations