Search in sources :

Example 26 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createIfElseStmt.

static BLangIf createIfElseStmt(DiagnosticPos pos, BLangExpression conditionExpr, BLangBlockStmt thenBody, BLangStatement elseStmt) {
    final BLangIf ifNode = (BLangIf) TreeBuilder.createIfElseStatementNode();
    ifNode.pos = pos;
    ifNode.expr = conditionExpr;
    ifNode.body = thenBody;
    ifNode.elseStmt = elseStmt;
    return ifNode;
}
Also used : BLangIf(org.wso2.ballerinalang.compiler.tree.statements.BLangIf)

Example 27 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createVariable.

static BLangVariable createVariable(DiagnosticPos pos, String name, BType type, BLangExpression expr, BVarSymbol varSymbol) {
    final BLangVariable varNode = (BLangVariable) TreeBuilder.createVariableNode();
    varNode.pos = pos;
    varNode.name = createIdentifier(pos, name);
    varNode.type = type;
    varNode.expr = expr;
    varNode.symbol = varSymbol;
    return varNode;
}
Also used : BLangVariable(org.wso2.ballerinalang.compiler.tree.BLangVariable)

Example 28 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createNextStmt.

static void createNextStmt(DiagnosticPos pos, BLangBlockStmt target) {
    final BLangNext nextStmt = (BLangNext) TreeBuilder.createNextNode();
    nextStmt.pos = pos;
    target.addStatement(nextStmt);
}
Also used : BLangNext(org.wso2.ballerinalang.compiler.tree.statements.BLangNext)

Example 29 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createUnaryExpr.

static BLangUnaryExpr createUnaryExpr(DiagnosticPos pos, BLangExpression expr, BType type, OperatorKind kind, BOperatorSymbol symbol) {
    final BLangUnaryExpr unaryExpr = (BLangUnaryExpr) TreeBuilder.createUnaryExpressionNode();
    unaryExpr.pos = pos;
    unaryExpr.expr = expr;
    unaryExpr.type = type;
    unaryExpr.operator = kind;
    unaryExpr.opSymbol = symbol;
    return unaryExpr;
}
Also used : BLangUnaryExpr(org.wso2.ballerinalang.compiler.tree.expressions.BLangUnaryExpr)

Example 30 with DiagnosticPos

use of org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createAssignmentStmt.

static BLangAssignment createAssignmentStmt(DiagnosticPos pos, BLangBlockStmt target) {
    final BLangAssignment assignment = (BLangAssignment) TreeBuilder.createAssignmentNode();
    assignment.pos = pos;
    target.addStatement(assignment);
    return assignment;
}
Also used : BLangAssignment(org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)

Aggregations

DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)56 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)33 BLangBlockStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt)22 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)17 ArrayList (java.util.ArrayList)15 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)14 Whitespace (org.ballerinalang.model.Whitespace)13 BLangVariableDef (org.wso2.ballerinalang.compiler.tree.statements.BLangVariableDef)12 BLangFunction (org.wso2.ballerinalang.compiler.tree.BLangFunction)11 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)11 IdentifierNode (org.ballerinalang.model.tree.IdentifierNode)9 SelectExpressionNode (org.ballerinalang.model.tree.clauses.SelectExpressionNode)9 ExpressionNode (org.ballerinalang.model.tree.expressions.ExpressionNode)9 BLangNameReference (org.wso2.ballerinalang.compiler.tree.BLangNameReference)9 BLangBinaryExpr (org.wso2.ballerinalang.compiler.tree.expressions.BLangBinaryExpr)9 BLangExpressionStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangExpressionStmt)9 BLangIdentifier (org.wso2.ballerinalang.compiler.tree.BLangIdentifier)8 BLangStruct (org.wso2.ballerinalang.compiler.tree.BLangStruct)8 BLangSimpleVarRef (org.wso2.ballerinalang.compiler.tree.expressions.BLangSimpleVarRef)8 BLangXMLQuotedString (org.wso2.ballerinalang.compiler.tree.expressions.BLangXMLQuotedString)8