Skip to content

Commit

Permalink
Fixed testNonLocal
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Jan 26, 2025
1 parent 1cc3122 commit 4511db7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import de.fraunhofer.aisec.cpg.frontends.python.PythonLanguage.Companion.MODIFIE
import de.fraunhofer.aisec.cpg.graph.*
import de.fraunhofer.aisec.cpg.graph.Annotation
import de.fraunhofer.aisec.cpg.graph.declarations.*
import de.fraunhofer.aisec.cpg.graph.scopes.LocalScope
import de.fraunhofer.aisec.cpg.graph.scopes.FunctionScope
import de.fraunhofer.aisec.cpg.graph.scopes.NameScope
import de.fraunhofer.aisec.cpg.graph.scopes.NamespaceScope
import de.fraunhofer.aisec.cpg.graph.statements.*
Expand Down Expand Up @@ -928,11 +928,10 @@ class StatementHandler(frontend: PythonLanguageFrontend) :
* into a [LookupScopeStatement].
*/
private fun handleNonLocal(global: Python.AST.Nonlocal): LookupScopeStatement {
// We need to find the first outer function scope, or rather the block scope belonging to
// the function
// We need to find the first outer function scope
var outerFunctionScope =
frontend.scopeManager.firstScopeOrNull {
it is LocalScope && it != frontend.scopeManager.currentScope
it is FunctionScope && it != frontend.scopeManager.currentScope
}

return newLookupScopeStatement(
Expand Down

0 comments on commit 4511db7

Please sign in to comment.