From 0dbedd18fc62f700e92a4cf581e505d849bc47ad Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Wed, 5 Nov 2014 21:20:42 -0300 Subject: SceneMainLoop -> SceneTree -=-=-=-=-=-=-=-=-=-=-=-=-=- *YOUR SOURCE MIGHT NOT WORK* For mor information on fix: https://github.com/okamstudio/godot/wiki/devel_scene_tree Other stuff: -Shower of bullets demo -Fixes all around --- modules/gdscript/gd_parser.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'modules/gdscript') diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index dc6b0ff962..de2b5219a9 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -1158,7 +1158,7 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) { cn->value=v; return cn; - } else if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + } /*else if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { ConstantNode *ca = static_cast(op->arguments[0]); IdentifierNode *ib = static_cast(op->arguments[1]); @@ -1173,10 +1173,31 @@ GDParser::Node* GDParser::_reduce_expression(Node *p_node,bool p_to_const) { ConstantNode *cn = alloc_node(); cn->value=v; return cn; + }*/ + return op; + + } else if (op->op==OperatorNode::OP_INDEX_NAMED) { + + if (op->arguments[0]->type==Node::TYPE_CONSTANT && op->arguments[1]->type==Node::TYPE_IDENTIFIER) { + + ConstantNode *ca = static_cast(op->arguments[0]); + IdentifierNode *ib = static_cast(op->arguments[1]); + + bool valid; + Variant v = ca->value.get_named(ib->name,&valid); + if (!valid) { + _set_error("invalid index '"+String(ib->name)+"' in constant expression"); + return op; + } + + ConstantNode *cn = alloc_node(); + cn->value=v; + return cn; } return op; + } //validate assignment (don't assign to cosntant expression -- cgit v1.2.3