Skip to content

Commit

Permalink
alex fixed some stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
maximiliankaul committed Oct 17, 2023
1 parent f05b33e commit c3a3fc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@ class StatementHandler(frontend: PythonLanguageFrontend) :
private fun handleArgument(node: PythonAST.arg) {
val currentFunction = frontend.scopeManager.currentFunction
val arg = newParameterDeclaration(name = node.arg, rawNode = node)
// frontend.scopeManager.addDeclaration(arg) // TODO why not?
currentFunction?.addParameter(arg)
frontend.scopeManager.addDeclaration(arg)
// TODO type hints?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,16 @@ class PythonAddDeclarationsPass(ctx: TranslationContext) : ComponentPass(ctx), N

decl.isImplicit = true

decl.scope = scopeManager.currentScope // TODO why do we need this?
scopeManager.addDeclaration(decl)
if (decl is FieldDeclaration) {
decl.scope = scopeManager.currentRecord?.scope
scopeManager.currentRecord?.addField(decl)
scopeManager.withScope(scopeManager.currentRecord?.scope) {
scopeManager.addDeclaration(decl)
}
} else {
decl.scope = scopeManager.currentScope // TODO why do we need this?
scopeManager.addDeclaration(decl)
}
return decl
} else {
return null
Expand Down

0 comments on commit c3a3fc0

Please sign in to comment.