use of org.ballerinalang.model.tree.expressions.ExpressionNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method createFunctionInvocation.
public void createFunctionInvocation(DiagnosticPos pos, Set<Whitespace> ws, boolean argsAvailable) {
BLangInvocation invocationNode = (BLangInvocation) TreeBuilder.createInvocationNode();
invocationNode.pos = pos;
invocationNode.addWS(ws);
if (argsAvailable) {
List<ExpressionNode> exprNodes = exprNodeListStack.pop();
exprNodes.forEach(exprNode -> invocationNode.argExprs.add((BLangExpression) exprNode));
invocationNode.addWS(commaWsStack.pop());
}
BLangNameReference nameReference = nameReferenceStack.pop();
invocationNode.name = (BLangIdentifier) nameReference.name;
invocationNode.addWS(nameReference.ws);
invocationNode.pkgAlias = (BLangIdentifier) nameReference.pkgAlias;
addExpressionNode(invocationNode);
}
use of org.ballerinalang.model.tree.expressions.ExpressionNode in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addThrowStmt.
public void addThrowStmt(DiagnosticPos poc, Set<Whitespace> ws) {
ExpressionNode throwExpr = this.exprNodeStack.pop();
BLangThrow throwNode = (BLangThrow) TreeBuilder.createThrowNode();
throwNode.pos = poc;
throwNode.addWS(ws);
throwNode.expr = (BLangExpression) throwExpr;
addStmtToCurrentBlock(throwNode);
}
use of org.ballerinalang.model.tree.expressions.ExpressionNode 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.ballerinalang.model.tree.expressions.ExpressionNode in project ballerina by ballerina-lang.
the class SemanticAnalyzer method visit.
public void visit(BLangBinaryExpr binaryExpr) {
ExpressionNode leftExpression = binaryExpr.getLeftExpression();
((BLangExpression) leftExpression).accept(this);
ExpressionNode rightExpression = binaryExpr.getRightExpression();
((BLangExpression) rightExpression).accept(this);
}
use of org.ballerinalang.model.tree.expressions.ExpressionNode in project ballerina by ballerina-lang.
the class SemanticAnalyzer method visit.
public void visit(BLangWindow windowClause) {
ExpressionNode expressionNode = windowClause.getFunctionInvocation();
((BLangExpression) expressionNode).accept(this);
}
Aggregations