use of org.wso2.ballerinalang.compiler.tree.BLangImportPackage 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.tree.BLangImportPackage in project ballerina by ballerina-lang.
the class SymbolEnter method createInitFuncInvocationStmt.
private BLangExpressionStmt createInitFuncInvocationStmt(BLangImportPackage importPackage, BInvokableSymbol initFunctionSymbol) {
BLangInvocation invocationNode = (BLangInvocation) TreeBuilder.createInvocationNode();
invocationNode.pos = importPackage.pos;
invocationNode.addWS(importPackage.getWS());
BLangIdentifier funcName = (BLangIdentifier) TreeBuilder.createIdentifierNode();
funcName.value = initFunctionSymbol.name.value;
invocationNode.name = funcName;
invocationNode.pkgAlias = importPackage.alias;
BLangExpressionStmt exprStmt = (BLangExpressionStmt) TreeBuilder.createExpressionStatementNode();
exprStmt.pos = importPackage.pos;
exprStmt.addWS(importPackage.getWS());
exprStmt.expr = invocationNode;
return exprStmt;
}
use of org.wso2.ballerinalang.compiler.tree.BLangImportPackage in project ballerina by ballerina-lang.
the class TaintAnalyzer method visit.
public void visit(BLangImportPackage importPkgNode) {
BPackageSymbol pkgSymbol = importPkgNode.symbol;
SymbolEnv pkgEnv = symTable.pkgEnvMap.get(pkgSymbol);
if (pkgEnv == null) {
return;
}
this.env = pkgEnv;
pkgEnv.node.accept(this);
}
use of org.wso2.ballerinalang.compiler.tree.BLangImportPackage in project ballerina by ballerina-lang.
the class SemanticAnalyzer method visit.
public void visit(BLangImportPackage importPkgNode) {
BPackageSymbol pkgSymbol = importPkgNode.symbol;
SymbolEnv pkgEnv = this.symTable.pkgEnvMap.get(pkgSymbol);
if (pkgEnv == null) {
return;
}
analyzeDef(pkgEnv.node, pkgEnv);
}
use of org.wso2.ballerinalang.compiler.tree.BLangImportPackage in project ballerina by ballerina-lang.
the class BLangPackageBuilder method addImportPackageDeclaration.
public void addImportPackageDeclaration(DiagnosticPos pos, Set<Whitespace> ws, String orgName, List<String> nameComps, String version, String alias) {
List<BLangIdentifier> pkgNameComps = new ArrayList<>();
nameComps.forEach(e -> pkgNameComps.add((BLangIdentifier) this.createIdentifier(e)));
BLangIdentifier versionNode = (BLangIdentifier) this.createIdentifier(version);
BLangIdentifier aliasNode = (alias != null && !alias.isEmpty()) ? (BLangIdentifier) this.createIdentifier(alias) : pkgNameComps.get(pkgNameComps.size() - 1);
BLangImportPackage importDcl = (BLangImportPackage) TreeBuilder.createImportPackageNode();
importDcl.pos = pos;
importDcl.addWS(ws);
importDcl.pkgNameComps = pkgNameComps;
importDcl.version = versionNode;
importDcl.orgName = (BLangIdentifier) this.createIdentifier(orgName);
importDcl.alias = aliasNode;
this.compUnit.addTopLevelNode(importDcl);
if (this.imports.contains(importDcl)) {
this.dlog.warning(pos, DiagnosticCode.REDECLARED_IMPORT_PACKAGE, importDcl.getQualifiedPackageName());
} else {
this.imports.add(importDcl);
}
}
Aggregations