use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class CodeGenerator method processWorker.
private void processWorker(BLangInvokableNode invokableNode, WorkerInfo workerInfo, BLangBlockStmt body, LocalVariableAttributeInfo localVarAttributeInfo, SymbolEnv invokableSymbolEnv, boolean defaultWorker, VariableIndex lvIndexCopy) {
int codeAttrNameCPIndex = this.addUTF8CPEntry(this.currentPkgInfo, AttributeInfo.Kind.CODE_ATTRIBUTE.value());
workerInfo.codeAttributeInfo.attributeNameIndex = codeAttrNameCPIndex;
workerInfo.addAttributeInfo(AttributeInfo.Kind.LOCAL_VARIABLES_ATTRIBUTE, localVarAttributeInfo);
if (body != null) {
localVarAttrInfo = new LocalVariableAttributeInfo(localVarAttributeInfo.attributeNameIndex);
localVarAttrInfo.localVars = new ArrayList<>(localVarAttributeInfo.localVars);
workerInfo.addAttributeInfo(AttributeInfo.Kind.LOCAL_VARIABLES_ATTRIBUTE, localVarAttrInfo);
workerInfo.codeAttributeInfo.codeAddrs = nextIP();
this.lvIndexes = lvIndexCopy;
this.currentWorkerInfo = workerInfo;
this.genNode(body, invokableSymbolEnv);
}
this.endWorkerInfoUnit(workerInfo.codeAttributeInfo);
this.emit(InstructionCodes.HALT);
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class ASTBuilderUtil method createVariableDefStmt.
static BLangVariableDef createVariableDefStmt(DiagnosticPos pos, BLangBlockStmt target) {
final BLangVariableDef variableDef = createVariableDef(pos);
target.addStatement(variableDef);
return variableDef;
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class ASTBuilderUtil method createForeach.
static BLangForeach createForeach(DiagnosticPos pos, BLangBlockStmt target, BLangSimpleVarRef collectionVarRef, List<BLangSimpleVarRef> varRefs, List<BType> inputTypes) {
final BLangForeach foreach = (BLangForeach) TreeBuilder.createForeachNode();
foreach.pos = pos;
target.addStatement(foreach);
foreach.body = ASTBuilderUtil.createBlockStmt(pos);
foreach.collection = collectionVarRef;
foreach.varRefs.addAll(varRefs);
foreach.varTypes = inputTypes;
return foreach;
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class ASTBuilderUtil method createIfStmt.
static BLangIf createIfStmt(DiagnosticPos pos, BLangBlockStmt target) {
final BLangIf ifNode = (BLangIf) TreeBuilder.createIfElseStatementNode();
ifNode.pos = pos;
target.addStatement(ifNode);
return ifNode;
}
use of org.wso2.ballerinalang.compiler.tree.statements.BLangBlockStmt in project ballerina by ballerina-lang.
the class ASTBuilderUtil method createExpressionStmt.
static BLangExpressionStmt createExpressionStmt(DiagnosticPos pos, BLangBlockStmt target) {
final BLangExpressionStmt exprStmt = (BLangExpressionStmt) TreeBuilder.createExpressionStatementNode();
exprStmt.pos = pos;
target.addStatement(exprStmt);
return exprStmt;
}
Aggregations