ソースを参照

Fixes #6487, GDscript compiler ignores OPCODE_LINE and OPCODE_BREAKPOINT in Release mode

When godot is in release mode, GDscript compiler does not generate
bytecodes for OPCODE_LINE and OPCODE_BREAKPOINT anymore.

This optimizes GDscript execution speed when the script contains a lot
of comments in blocs executed in loops.

Fixes #6487

(cherry picked from commit 217e09c79da008e15bd789260e8b2513689c90bd)
yg2f 9 年 前
コミット
caf42f77d2
1 ファイル変更4 行追加2 行削除
  1. 4 2
      modules/gdscript/gd_compiler.cpp

+ 4 - 2
modules/gdscript/gd_compiler.cpp

@@ -965,12 +965,12 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
 
 		switch(s->type) {
 			case GDParser::Node::TYPE_NEWLINE: {
-
+#ifdef DEBUG_ENABLED
 				const GDParser::NewLineNode *nl = static_cast<const GDParser::NewLineNode*>(s);
 				codegen.opcodes.push_back(GDFunction::OPCODE_LINE);
 				codegen.opcodes.push_back(nl->line);
 				codegen.current_line=nl->line;
-
+#endif
 			} break;
 			case GDParser::Node::TYPE_CONTROL_FLOW: {
 				// try subblocks
@@ -1161,8 +1161,10 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo
 				codegen.opcodes.push_back(ret);
 			} break;
 			case GDParser::Node::TYPE_BREAKPOINT: {
+#ifdef DEBUG_ENABLED
 				// try subblocks
 				codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT);
+#endif
 			} break;
 			case GDParser::Node::TYPE_LOCAL_VAR: {