use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv 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.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class TaintAnalyzer method visit.
public void visit(BLangForeach foreach) {
SymbolEnv blockEnv = SymbolEnv.createBlockEnv(foreach.body, env);
// Propagate the tainted status of collection to foreach variables.
foreach.collection.accept(this);
if (getObservedTaintedStatus()) {
foreach.varRefs.forEach(varRef -> setTaintedStatus((BLangVariableReference) varRef, getObservedTaintedStatus()));
}
analyzeNode(foreach.body, blockEnv);
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class CodeAnalyzer method analyzeNode.
private void analyzeNode(BLangNode node, SymbolEnv env) {
SymbolEnv prevEnv = this.env;
this.env = env;
node.accept(this);
this.env = prevEnv;
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class CompilerPluginRunner method getAnnotationSymbols.
private List<BAnnotationSymbol> getAnnotationSymbols(String annPackage) {
List<BAnnotationSymbol> annotationSymbols = new ArrayList<>();
BLangPackage pkgNode = this.packageCache.get(annPackage);
if (pkgNode == null) {
return annotationSymbols;
}
SymbolEnv pkgEnv = symTable.pkgEnvMap.get(pkgNode.symbol);
if (pkgEnv != null) {
for (BLangAnnotation annotationNode : pkgEnv.enclPkg.annotations) {
annotationSymbols.add((BAnnotationSymbol) annotationNode.symbol);
}
}
return annotationSymbols;
}
use of org.wso2.ballerinalang.compiler.semantics.model.SymbolEnv in project ballerina by ballerina-lang.
the class IterableAnalyzer method handlerIterableOperation.
public void handlerIterableOperation(BLangInvocation iExpr, BType expectedType, SymbolEnv env) {
final IterableContext context;
if (iExpr.expr.type.tag != TypeTags.INTERMEDIATE_COLLECTION) {
// This is a new iteration chain.
context = new IterableContext(iExpr.expr, env);
} else {
// Get context from previous invocation.
context = ((BLangInvocation) iExpr.expr).iContext;
}
iExpr.iContext = context;
final IterableKind iterableKind = IterableKind.getFromString(iExpr.name.value);
final Operation iOperation = new Operation(iterableKind, iExpr, expectedType);
iExpr.iContext.addOperation(iOperation);
if (iterableKind.isLambdaRequired()) {
handleLambdaBasedIterableOperation(context, iOperation);
} else {
handleSimpleTerminalOperations(iOperation);
}
validateIterableContext(context);
if (iOperation.resultType != symTable.errType && context.foreachTypes.isEmpty()) {
calculateForeachTypes(context);
}
}
Aggregations