mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
compiler.transformer: correct lineno attribute when possible
SF patch #1015989 The basic idea of this patch is to compute lineno attributes for all AST nodes. The actual implementation lead to a lot of restructing and code cleanup. The generated AST nodes now have an optional lineno argument to constructor. Remove the top-level asList(), since it didn't seem to serve any purpose. Add an __iter__ to ast nodes. Use isinstance() instead of explicit type tests. Change transformer to use the new lineno attribute, which replaces three lines of code with one. Use universal newlines so that we can get rid of special-case code for line endings. Use lookup_node() in a few more frequently called, but simple com_xxx methods(). Change string exception to class exception.
This commit is contained in:
parent
2ad68e69b9
commit
566d934745
6 changed files with 407 additions and 447 deletions
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue