use of org.wso2.ballerinalang.compiler.tree.BLangWorker in project ballerina by ballerina-lang.
the class TreeVisitor method visit.
@Override
public void visit(BLangWorker workerNode) {
SymbolEnv workerEnv = SymbolEnv.createWorkerEnv(workerNode, this.symbolEnv);
this.blockOwnerStack.push(workerNode);
this.acceptNode(workerNode.body, workerEnv);
this.blockOwnerStack.pop();
}
use of org.wso2.ballerinalang.compiler.tree.BLangWorker in project ballerina by ballerina-lang.
the class SymbolEnter method visit.
@Override
public void visit(BLangWorker workerNode) {
BInvokableSymbol workerSymbol = Symbols.createWorkerSymbol(Flags.asMask(workerNode.flagSet), names.fromIdNode(workerNode.name), env.enclPkg.symbol.pkgID, null, env.scope.owner);
workerNode.symbol = workerSymbol;
defineSymbolWithCurrentEnvOwner(workerNode.pos, workerSymbol);
}
use of org.wso2.ballerinalang.compiler.tree.BLangWorker in project ballerina by ballerina-lang.
the class TaintAnalyzer method analyzeReturnTaintedStatus.
private void analyzeReturnTaintedStatus(BLangInvokableNode invokableNode, SymbolEnv symbolEnv) {
invokableNode.endpoints.forEach(endpoint -> endpoint.accept(this));
if (invokableNode.workers.isEmpty()) {
analyzeNode(invokableNode.body, symbolEnv);
} else {
for (BLangWorker worker : invokableNode.workers) {
worker.endpoints.forEach(endpoint -> endpoint.accept(this));
analyzeNode(worker, symbolEnv);
if (this.blockedNode != null || taintErrorSet.size() > 0) {
break;
}
}
}
}
use of org.wso2.ballerinalang.compiler.tree.BLangWorker in project ballerina by ballerina-lang.
the class SemanticAnalyzer method visit.
@Override
public void visit(BLangWorker workerNode) {
SymbolEnv workerEnv = SymbolEnv.createWorkerEnv(workerNode, this.env);
this.analyzeNode(workerNode.body, workerEnv);
}
use of org.wso2.ballerinalang.compiler.tree.BLangWorker in project ballerina by ballerina-lang.
the class CodeGenerator method visitInvokableNode.
private void visitInvokableNode(BLangInvokableNode invokableNode, CallableUnitInfo callableUnitInfo, SymbolEnv invokableSymbolEnv) {
int localVarAttrNameIndex = addUTF8CPEntry(currentPkgInfo, AttributeInfo.Kind.LOCAL_VARIABLES_ATTRIBUTE.value());
LocalVariableAttributeInfo localVarAttributeInfo = new LocalVariableAttributeInfo(localVarAttrNameIndex);
// TODO Read annotations attached to this callableUnit
// Add local variable indexes to the parameters and return parameters
visitInvokableNodeParams(invokableNode.symbol, callableUnitInfo, localVarAttributeInfo);
if (Symbols.isNative(invokableNode.symbol)) {
this.processWorker(invokableNode, callableUnitInfo.defaultWorkerInfo, null, localVarAttributeInfo, invokableSymbolEnv, true, null);
} else {
// Clone lvIndex structure here. This structure contain local variable indexes of the input and
// out parameters and they are common for all the workers.
VariableIndex lvIndexCopy = this.copyVarIndex(lvIndexes);
this.processWorker(invokableNode, callableUnitInfo.defaultWorkerInfo, invokableNode.body, localVarAttributeInfo, invokableSymbolEnv, true, lvIndexCopy);
for (BLangWorker worker : invokableNode.getWorkers()) {
this.processWorker(invokableNode, callableUnitInfo.getWorkerInfo(worker.name.value), worker.body, localVarAttributeInfo, invokableSymbolEnv, false, this.copyVarIndex(lvIndexCopy));
}
}
}
Aggregations