From b64f9f03f825bd3267c71ee8392d4e8e801010d4 Mon Sep 17 00:00:00 2001 From: Bojidar Marinov Date: Thu, 14 Mar 2019 18:38:07 +0200 Subject: Fix duplicated lines in GDScript bytecode Fixes #26789 --- main/tests/test_gdscript.cpp | 2 +- modules/gdscript/gdscript_compiler.cpp | 5 ----- modules/gdscript/gdscript_parser.cpp | 4 +++- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 55e31a18c3..27180f84aa 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -563,7 +563,7 @@ static void _disassemble_class(const Ref &p_class, const Vectorline); - codegen.current_line = cf->line; -#endif int ret2 = _parse_expression(codegen, cf->arguments[0], p_stack_level, false); if (ret2 < 0) return ERR_PARSE_ERROR; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index f005f88d2e..da69181a43 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2741,6 +2741,8 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { } break; case GDScriptTokenizer::TK_NEWLINE: { + int line = tokenizer->get_token_line(); + if (!_parse_newline()) { if (!error_set) { p_block->end_line = tokenizer->get_token_line(); @@ -2750,7 +2752,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { } NewLineNode *nl2 = alloc_node(); - nl2->line = tokenizer->get_token_line(); + nl2->line = line; p_block->statements.push_back(nl2); } break; -- cgit v1.2.3