瀏覽代碼

logic error in gdscript_parser.cpp for-loop-range

there was a logic error in for loop range argument that
check if all of the argument were constants, fixed

(cherry picked from commit bcbcf0f1eae73638e8f76e5acc2b2f3267973483)
Thakee Nathees 5 年之前
父節點
當前提交
5798c8135f
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      modules/gdscript/gdscript_parser.cpp

+ 3 - 3
modules/gdscript/gdscript_parser.cpp

@@ -3103,18 +3103,18 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
 						Vector<Node *> args;
 						Vector<double> constants;
 
-						bool constant = false;
+						bool constant = true;
 
 						for (int i = 1; i < op->arguments.size(); i++) {
 							args.push_back(op->arguments[i]);
-							if (constant && op->arguments[i]->type == Node::TYPE_CONSTANT) {
+							if (op->arguments[i]->type == Node::TYPE_CONSTANT) {
 								ConstantNode *c = static_cast<ConstantNode *>(op->arguments[i]);
 								if (c->value.get_type() == Variant::REAL || c->value.get_type() == Variant::INT) {
 									constants.push_back(c->value);
-									constant = true;
 								}
 							} else {
 								constant = false;
+								break;
 							}
 						}