Skip to content

Commit

Permalink
Remove unnecessary fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
malthe committed Dec 22, 2024
1 parent 2b14af4 commit c6ec5aa
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/chameleon/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from ast import Module
from ast import NodeTransformer
from ast import alias
from ast import copy_location
from ast import fix_missing_locations
from ast import unparse
from typing import TYPE_CHECKING
from typing import Any
Expand Down Expand Up @@ -85,8 +83,6 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> AST:
decorator_list=node.decorator_list,
returns=node.returns,
)
copy_location(funcdef, node)
fix_missing_locations(funcdef)
return funcdef

def visit_Name(self, node: ast.Name) -> AST:
Expand Down Expand Up @@ -192,9 +188,7 @@ def visit_Module(self, module: Module) -> AST:
preamble: list[ast.stmt] = []

for name, node in self.defines.items():
assignment = Assign(targets=[store(name)], value=node)
copy_location(assignment, node)
fix_missing_locations(assignment)
assignment = Assign(targets=[store(name)], value=node, lineno=-1)
preamble.append(self.visit(assignment))

imports: list[ast.stmt] = []
Expand Down

0 comments on commit c6ec5aa

Please sign in to comment.