mirror of
https://github.com/davidhalter/parso.git
synced 2026-10-01 07:23:46 +08:00
Fix: Make the NodesStack to a NodesTree
This fixes an issue with positions that were doubled if the stack was closed too early.
This commit is contained in:
1 parent
0ef4809377
commit
e5fb1927bb
2 files changed
+104
-79
No files matched your search
@@ -530,3 +530,33 @@ def test_end_newline_with_decorator(differ):
|
||||
newline, first_stmt, second_stmt = suite.children
|
||||
assert first_stmt.get_code() == ' import json\n'
|
||||
assert second_stmt.get_code() == ' json.l\n'
|
||||
|
||||
|
||||
def test_invalid_to_valid_nodes(differ):
|
||||
code1 = dedent('''\
|
||||
def a():
|
||||
foo = 3
|
||||
def b():
|
||||
la = 3
|
||||
else:
|
||||
la
|
||||
return
|
||||
foo
|
||||
base
|
||||
''')
|
||||
code2 = dedent('''\
|
||||
def a():
|
||||
foo = 3
|
||||
def b():
|
||||
la = 3
|
||||
if foo:
|
||||
latte = 3
|
||||
else:
|
||||
la
|
||||
return
|
||||
foo
|
||||
base
|
||||
''')
|
||||
|
||||
differ.initialize(code1)
|
||||
differ.parse(code2, parsers=2, copies=3)
|
||||
Reference in new issue
Block a user