mirror of
https://github.com/davidhalter/jedi.git
synced 2026-10-18 03:51:42 +08:00
Fix DEDENT issues in _remove_newline.
This commit is contained in:
1 parent
61e2bba380
commit
07c60d7ff6
2 files changed
+9
-1
No files matched your search
@@ -318,4 +318,11 @@ class Parser(object):
|
|||||||
endmarker.prefix = endmarker.prefix[:-1]
|
endmarker.prefix = endmarker.prefix[:-1]
|
||||||
else:
|
else:
|
||||||
newline = endmarker.get_previous()
|
newline = endmarker.get_previous()
|
||||||
newline.value = ''
|
while True:
|
||||||
|
if newline.value == '':
|
||||||
|
# Must be a DEDENT, just continue.
|
||||||
|
newline = newline.get_previous()
|
||||||
|
else:
|
||||||
|
assert newline.value == '\n'
|
||||||
|
newline.value = ''
|
||||||
|
break
|
||||||
@@ -101,3 +101,4 @@ def test_end_newlines():
|
|||||||
test('a\n')
|
test('a\n')
|
||||||
test('a\n\n')
|
test('a\n\n')
|
||||||
test('a\n#comment')
|
test('a\n#comment')
|
||||||
|
test('def a():\n pass')
|
||||||
Reference in new issue
Block a user