use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SignatureTreeVisitor method visit.
@Override
public void visit(BLangService serviceNode) {
BSymbol serviceSymbol = serviceNode.symbol;
SymbolEnv serviceEnv = SymbolEnv.createPkgLevelSymbolEnv(serviceNode, serviceSymbol.scope, symbolEnv);
serviceNode.resources.forEach(r -> this.acceptNode(r, serviceEnv));
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SignatureTreeVisitor method visit.
@Override
public void visit(BLangFunction funcNode) {
BSymbol funcSymbol = funcNode.symbol;
if (Symbols.isNative(funcSymbol)) {
return;
}
SymbolEnv funcEnv = SymbolEnv.createFunctionEnv(funcNode, funcSymbol.scope, symbolEnv);
blockOwnerStack.push(funcNode);
this.acceptNode(funcNode.body, funcEnv);
blockOwnerStack.pop();
// Process workers
if (terminateVisitor && !funcNode.workers.isEmpty()) {
terminateVisitor = false;
}
funcNode.workers.forEach(e -> this.symbolEnter.defineNode(e, funcEnv));
funcNode.workers.forEach(e -> this.acceptNode(e, funcEnv));
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SignatureTreeVisitor method visit.
@Override
public void visit(BLangAction actionNode) {
BSymbol actionSymbol = actionNode.symbol;
SymbolEnv actionEnv = SymbolEnv.createResourceActionSymbolEnv(actionNode, actionSymbol.scope, symbolEnv);
actionNode.workers.forEach(w -> this.acceptNode(w, actionEnv));
this.blockOwnerStack.push(actionNode);
acceptNode(actionNode.body, actionEnv);
this.blockOwnerStack.pop();
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class PositionTreeVisitor method visit.
public void visit(BLangImportPackage importPkgNode) {
BPackageSymbol pkgSymbol = importPkgNode.symbol;
SymbolEnv pkgEnv = this.symTable.pkgEnvMap.get(pkgSymbol);
acceptNode(pkgEnv.node);
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SymbolEnter method visit.
@Override
public void visit(BLangTransformer transformerNode) {
validateTransformerMappingTypes(transformerNode);
boolean safeConversion = transformerNode.retParams.size() == 1;
Name name = getTransformerSymbolName(transformerNode);
BTransformerSymbol transformerSymbol = Symbols.createTransformerSymbol(Flags.asMask(transformerNode.flagSet), name, env.enclPkg.symbol.pkgID, null, safeConversion, env.scope.owner);
transformerNode.symbol = transformerSymbol;
// If this is a default transformer, check whether this transformer conflicts with a built-in conversion
if (transformerNode.name.value.isEmpty()) {
BType targetType = transformerNode.retParams.get(0).type;
BSymbol symbol = symResolver.resolveConversionOperator(transformerNode.source.type, targetType);
if (symbol != symTable.notFoundSymbol) {
dlog.error(transformerNode.pos, DiagnosticCode.TRANSFORMER_CONFLICTS_WITH_CONVERSION, transformerNode.source.type, targetType);
return;
}
}
// Define the transformer
SymbolEnv transformerEnv = SymbolEnv.createTransformerEnv(transformerNode, transformerSymbol.scope, env);
transformerNode.symbol = transformerSymbol;
defineSymbol(transformerNode.pos, transformerSymbol);
transformerEnv.scope = transformerSymbol.scope;
// Define transformer source.
defineNode(transformerNode.source, transformerEnv);
}
Aggregations