Search in sources :

Example 6 with BLangBlockStmt

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createMatchStatementPattern.

static BLangMatchStmtPatternClause createMatchStatementPattern(DiagnosticPos pos, BLangVariable variable, BLangBlockStmt body) {
    BLangMatchStmtPatternClause patternClause = (BLangMatchStmtPatternClause) TreeBuilder.createMatchStatementPattern();
    patternClause.pos = pos;
    patternClause.variable = variable;
    patternClause.body = body;
    return patternClause;
}
Also used : BLangMatchStmtPatternClause(org.wso2.ballerinalang.compiler.tree.statements.BLangMatch.BLangMatchStmtPatternClause)

Example 7 with BLangBlockStmt

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.

the class ASTBuilderUtil method createBlockStmt.

static BLangBlockStmt createBlockStmt(DiagnosticPos pos, List<BLangStatement> stmts) {
    final BLangBlockStmt blockNode = (BLangBlockStmt) TreeBuilder.createBlockNode();
    blockNode.pos = pos;
    blockNode.stmts = stmts;
    return blockNode;
}
Also used : BLangBlockStmt(org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt)

Example 8 with BLangBlockStmt

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt 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 9 with BLangBlockStmt

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt 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 10 with BLangBlockStmt

use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt 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

BLangBlockStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt)33 DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)22 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)19 BLangAssignment (org.wso2.ballerinalang.compiler.tree.statements.BLangAssignment)16 BLangVariableDef (org.wso2.ballerinalang.compiler.tree.statements.BLangVariableDef)12 SymbolEnv (org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv)9 BLangExpression (org.wso2.ballerinalang.compiler.tree.expressions.BLangExpression)8 BLangIf (org.wso2.ballerinalang.compiler.tree.statements.BLangIf)8 BLangExpressionStmt (org.wso2.ballerinalang.compiler.tree.statements.BLangExpressionStmt)7 BLangBinaryExpr (org.wso2.ballerinalang.compiler.tree.expressions.BLangBinaryExpr)6 BLangIndexBasedAccess (org.wso2.ballerinalang.compiler.tree.expressions.BLangIndexBasedAccess)6 BLangInvocation (org.wso2.ballerinalang.compiler.tree.expressions.BLangInvocation)6 BLangReturn (org.wso2.ballerinalang.compiler.tree.statements.BLangReturn)6 Name (org.wso2.ballerinalang.compiler.util.Name)6 BVarSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BVarSymbol)5 BLangMatchStmtPatternClause (org.wso2.ballerinalang.compiler.tree.statements.BLangMatch.BLangMatchStmtPatternClause)5 ArrayList (java.util.ArrayList)4 BLangNode (org.wso2.ballerinalang.compiler.tree.BLangNode)4 BLangForeach (org.wso2.ballerinalang.compiler.tree.statements.BLangForeach)4 Whitespace (org.ballerinalang.model.Whitespace)3