Skip to content

Commit

Permalink
remove the weird parent thing
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Nov 18, 2024
1 parent 9f9ced9 commit e26bd9c
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions vyper/ast/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,17 +206,15 @@ def generic_visit(self, node):

for s in ("lineno", "end_lineno", "col_offset", "end_col_offset"):
# ensure fields exist
if (val := getattr(node, s, None)) is None and self._parent is not None:
val = getattr(self._parent, s)
setattr(node, s, val)
setattr(node, s, getattr(node, s, None))

self._parent = node
if node.col_offset is not None:
adj = adjustments.get((node.lineno, node.col_offset), 0)
node.col_offset += adj

adj = adjustments.get((node.lineno, node.col_offset), 0)
node.col_offset += adj

adj = adjustments.get((node.end_lineno, node.end_col_offset), 0)
node.end_col_offset += adj
if node.end_col_offset is not None:
adj = adjustments.get((node.end_lineno, node.end_col_offset), 0)
node.end_col_offset += adj

if node.lineno in self.line_offsets and node.end_lineno in self.line_offsets:
start_pos = self.line_offsets[node.lineno] + node.col_offset
Expand Down Expand Up @@ -247,6 +245,7 @@ def _visit_docstring(self, node):

return node


def visit_Module(self, node):
# TODO: is this the best place for these? maybe they can be on
# CompilerData instead.
Expand All @@ -272,6 +271,12 @@ def visit_ClassDef(self, node):
node.ast_type = self._pre_parse_result.modification_offsets[(node.lineno, node.col_offset)]
return node

def visit_Load(self, node):
return None

def visit_Store(self, node):
return None

def visit_For(self, node):
"""
Visit a For node, splicing in the loop variable annotation provided by
Expand Down

0 comments on commit e26bd9c

Please sign in to comment.