Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an analyzer crash with multiple list comprehensions in py3
The crash was caused by selecting the wrong child symbol table for the list comprehension. Previously we were always selecting the first one in the list of subtables. This is wrong if there is more than 1 list comprehension, since each one gets its own subtable. This is works fine if the list comprehension only uses symbols defined within itself or symbols that are shared between it and the first list comprehension in the enclosing scope, since that will resolve to the same value. The specific error case we are fixing is when there is a list comprehension that is not the first one that references a symbol from the enclosing function scope that the first list comprehension does not reference. Both the symbol tables and the ListComp node are annotated with a line number attribute, by matching these up we can select the correct subtable to go with our list comprehension. This is still naive, but is better than what we had before. fixes aws#412
- Loading branch information