Skip to content

Commit

Permalink
Merge pull request #42855 from gabilang/fix-listener-start-8x
Browse files Browse the repository at this point in the history
[2201.8.x] Start listening phase even listeners are only in imported modules
  • Loading branch information
warunalakshitha authored Jun 5, 2024
2 parents 98516f9 + ee76f06 commit 15b94ff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.wso2.ballerinalang.compiler.diagnostic.BLangDiagnosticLog;
import org.wso2.ballerinalang.compiler.semantics.analyzer.TypeHashVisitor;
import org.wso2.ballerinalang.compiler.semantics.analyzer.Types;
import org.wso2.ballerinalang.compiler.semantics.model.Scope;
import org.wso2.ballerinalang.compiler.semantics.model.SymbolTable;
import org.wso2.ballerinalang.compiler.semantics.model.symbols.BObjectTypeSymbol;
import org.wso2.ballerinalang.compiler.semantics.model.symbols.BPackageSymbol;
Expand Down Expand Up @@ -836,14 +837,19 @@ private BIRFunction getFunction(BIRPackage module, String funcName) {
}

private boolean listenerDeclarationFound(BPackageSymbol packageSymbol) {
if (packageSymbol.bir != null && packageSymbol.bir.isListenerAvailable) {
return true;
} else {
for (BPackageSymbol importPkgSymbol : packageSymbol.imports) {
if (importPkgSymbol == null) {
continue;
if (packageSymbol.bir == null) {
for (Scope.ScopeEntry entry : packageSymbol.scope.entries.values()) {
BSymbol symbol = entry.symbol;
if (symbol != null && Symbols.isFlagOn(symbol.flags, Flags.LISTENER)) {
return true;
}
return listenerDeclarationFound(importPkgSymbol);
}
} else if (packageSymbol.bir.isListenerAvailable) {
return true;
}
for (BPackageSymbol importPkgSymbol : packageSymbol.imports) {
if (importPkgSymbol != null && listenerDeclarationFound(importPkgSymbol)) {
return true;
}
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2596,8 +2596,7 @@ private void populateConfigurableVars(BPackageSymbol pkgSymbol, Set<BVarSymbol>
if (symbol.tag == SymTag.TYPE_DEF) {
symbol = symbol.type.tsymbol;
}
if (symbol != null && symbol.tag == SymTag.VARIABLE
&& Symbols.isFlagOn(symbol.flags, Flags.CONFIGURABLE)) {
if (symbol.tag == SymTag.VARIABLE && Symbols.isFlagOn(symbol.flags, Flags.CONFIGURABLE)) {
configVars.add((BVarSymbol) symbol);
}
}
Expand Down

0 comments on commit 15b94ff

Please sign in to comment.