Code review comment: @pubudu91 yes, In that case, the `symbolEnvScopeOwner` node shall be passed down to the `addToCompiledSymbols()` method instead of the `isChildOfEnclosingNode` flag. 

Code before review:
public List<Symbol> visibleSymbols(Document sourceFile, LinePosition position, DiagnosticState... states) {
BLangCompilationUnit compilationUnit = getCompilationUnit(sourceFile);
BPackageSymbol moduleSymbol = getModuleSymbol(compilationUnit);
SymbolTable symbolTable = SymbolTable.getInstance(this.compilerContext);
SymbolEnv pkgEnv = symbolTable.pkgEnvMap.get(moduleSymbol);
EnvironmentResolver envResolver = new EnvironmentResolver(pkgEnv);
SymbolResolver symbolResolver = SymbolResolver.getInstance(this.compilerContext);
SymbolEnv symbolEnv = envResolver.lookUp(compilationUnit, position);
Map<Name, List<Scope.ScopeEntry>> scopeSymbols = symbolResolver.getAllVisibleInScopeSymbols(symbolEnv);
Location cursorPos = new BLangDiagnosticLocation(compilationUnit.name,
position.line(), position.line(),
position.offset(), position.offset());
Set<DiagnosticState> statesSet = new HashSet<>(Arrays.asList(states));
Set<Symbol> compiledSymbols = new HashSet<>();
for (Map.Entry<Name, List<Scope.ScopeEntry>> entry : scopeSymbols.entrySet()) {
Name name = entry.getKey();
List<Scope.ScopeEntry> scopeEntries = entry.getValue();
for (Scope.ScopeEntry scopeEntry : scopeEntries) {
BSymbol symbolEnvScopeOwner = symbolEnv.scope.owner;
BSymbol scopeEntryOwner = scopeEntry.symbol.owner;
boolean isChildOfEnclosingNode = symbolEnvScopeOwner.getName().equals(scopeEntryOwner.getName())
&& symbolEnvScopeOwner.pkgID.equals(scopeEntryOwner.pkgID)
&& symbolEnvScopeOwner.getPosition().equals(scopeEntryOwner.getPosition());
addToCompiledSymbols(compiledSymbols, scopeEntry, cursorPos, name, isChildOfEnclosingNode, statesSet);
}
}
return new ArrayList<>(compiledSymbols);
}

Line under review: && symbolEnvScopeOwner.getPosition().equals(scopeEntryOwner.getPosition());

Code after addressing the review:
public List<Symbol> visibleSymbols(Document sourceFile, LinePosition position, DiagnosticState... states) {
BLangCompilationUnit compilationUnit = getCompilationUnit(sourceFile);
BPackageSymbol moduleSymbol = getModuleSymbol(compilationUnit);
SymbolTable symbolTable = SymbolTable.getInstance(this.compilerContext);
SymbolEnv pkgEnv = symbolTable.pkgEnvMap.get(moduleSymbol);
EnvironmentResolver envResolver = new EnvironmentResolver(pkgEnv);
SymbolResolver symbolResolver = SymbolResolver.getInstance(this.compilerContext);
SymbolEnv symbolEnv = envResolver.lookUp(compilationUnit, position);
Map<Name, List<Scope.ScopeEntry>> scopeSymbols = symbolResolver.getAllVisibleInScopeSymbols(symbolEnv);
Location cursorPos = new BLangDiagnosticLocation(compilationUnit.name,
position.line(), position.line(),
position.offset(), position.offset());
Set<DiagnosticState> statesSet = new HashSet<>(Arrays.asList(states));
Set<Symbol> compiledSymbols = new HashSet<>();
for (Map.Entry<Name, List<Scope.ScopeEntry>> entry : scopeSymbols.entrySet()) {
Name name = entry.getKey();
List<Scope.ScopeEntry> scopeEntries = entry.getValue();
for (Scope.ScopeEntry scopeEntry : scopeEntries) {
addToCompiledSymbols(compiledSymbols, scopeEntry, cursorPos, name, symbolEnv.scope.owner, statesSet);
}
}
return new ArrayList<>(compiledSymbols);
}