use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SymbolEnter method defineConnectorMembers.
private void defineConnectorMembers(List<BLangConnector> connectors, SymbolEnv pkgEnv) {
connectors.forEach(connector -> {
SymbolEnv conEnv = SymbolEnv.createConnectorEnv(connector, connector.symbol.scope, pkgEnv);
connector.varDefs.forEach(varDef -> defineNode(varDef.var, conEnv));
defineConnectorInitFunction(connector, conEnv);
connector.actions.stream().peek(action -> action.flagSet.add(Flag.PUBLIC)).forEach(action -> defineNode(action, conEnv));
});
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SymbolEnter method visit.
@Override
public void visit(BLangFunction funcNode) {
boolean validAttachedFunc = validateFuncReceiver(funcNode);
BInvokableSymbol funcSymbol = Symbols.createFunctionSymbol(Flags.asMask(funcNode.flagSet), getFuncSymbolName(funcNode), env.enclPkg.symbol.pkgID, null, env.scope.owner);
SymbolEnv invokableEnv = SymbolEnv.createFunctionEnv(funcNode, funcSymbol.scope, env);
defineInvokableSymbol(funcNode, funcSymbol, invokableEnv);
// Define function receiver if any.
if (funcNode.receiver != null) {
defineAttachedFunctions(funcNode, funcSymbol, invokableEnv, validAttachedFunc);
}
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SymbolEnter method defineServiceMembers.
private void defineServiceMembers(List<BLangService> services, SymbolEnv pkgEnv) {
services.forEach(service -> {
SymbolEnv serviceEnv = SymbolEnv.createServiceEnv(service, service.symbol.scope, pkgEnv);
service.vars.forEach(varDef -> defineNode(varDef.var, serviceEnv));
defineServiceInitFunction(service, serviceEnv);
service.resources.stream().peek(action -> action.flagSet.add(Flag.PUBLIC)).forEach(resource -> defineNode(resource, serviceEnv));
});
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SymbolEnter method defineServiceInitFunction.
private void defineServiceInitFunction(BLangService service, SymbolEnv conEnv) {
BLangFunction initFunction = createInitFunction(service.pos, service.getName().getValue(), Names.INIT_FUNCTION_SUFFIX);
// Add service level variables to the init function
service.vars.stream().filter(f -> f.var.expr != null).forEachOrdered(v -> initFunction.body.addStatement(createAssignmentStmt(v.var)));
addInitReturnStatement(initFunction.body);
service.initFunction = initFunction;
defineNode(service.initFunction, conEnv);
// service.symbol.initFunctionSymbol = service.initFunction.symbol;
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class SymbolResolver method resolveObject.
public BSymbol resolveObject(DiagnosticPos pos, DiagnosticCode code, SymbolEnv env, Name pkgAlias, Name objectName) {
BSymbol pkgSymbol = resolvePkgSymbol(pos, env, pkgAlias);
if (pkgSymbol == symTable.notFoundSymbol) {
return pkgSymbol;
}
BSymbol symbol = lookupMemberSymbol(pos, pkgSymbol.scope, env, objectName, SymTag.OBJECT);
if (symbol == symTable.notFoundSymbol) {
dlog.error(pos, code, objectName);
}
return symbol;
}
Aggregations