Skip to content

Commit

Permalink
slotworks: Fix AST becoming cyclic in an temporary table constructor …
Browse files Browse the repository at this point in the history
…access

foo({
   magic,
   stuff,
   here
}[2])
  • Loading branch information
Andrian Nord authored and Andrian Nord committed Jan 25, 2014
1 parent 062c6a3 commit cb6e1ac
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ljd/ast/slotworks.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,19 @@ def _fill_simple_refs(info, simple, tables):

is_element = isinstance(holder, nodes.TableElement)

path_index = ref.path.index(holder)

statement = _get_holder(ref.path[:path_index])

statement_is_assignment = isinstance(statement, nodes.Assignment)

if statement_is_assignment:
is_dst = statement.destinations.contents[0] == holder
else:
is_dst = False

# Could be more then one reference here
if src_is_table and is_element:
if src_is_table and is_element and is_dst:
assert holder.table == ref.identifier
tables.append((info, ref))
else:
Expand Down

0 comments on commit cb6e1ac

Please sign in to comment.