summaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_compiler.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-22 00:50:48 -0300
committerJuan Linietsky <reduzio@gmail.com>2014-09-22 00:50:48 -0300
commit048fdc8aeabbd80ba9cc8914ec7f7baa00ad0c3d (patch)
treeddd39a348b41cfe3927075a8c6b11aa692511518 /modules/gdscript/gd_compiler.cpp
parentf195bf673fa8f282d2508e20ca6f08260c4e1fe7 (diff)
-variables with export in script are now IMMEDIATELY AND ALWAYS visible in properties (#718)
-WorldEnvironment cleanup issues fixed (#563) -Text Editor improvement to shift-mouse selection (#648) -(Hopefully) fixed rare (but horrible) indexing bug in GDScript compiler (#652) -Some changes to PhysicsBody API, renamed property "active" to "sleeping", which makes more sense -Added add_collision_exception() API in PhysicsBody (more accessible) -ability to select and copy in the output messages panel
Diffstat (limited to 'modules/gdscript/gd_compiler.cpp')
-rw-r--r--modules/gdscript/gd_compiler.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp
index e6dd9d9ae1..45eac23450 100644
--- a/modules/gdscript/gd_compiler.cpp
+++ b/modules/gdscript/gd_compiler.cpp
@@ -724,6 +724,8 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
return prev_pos;
int retval=prev_pos;
+ //print_line("retval: "+itos(retval));
+
if (retval&GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS) {
slevel++;
codegen.alloc_stack(slevel);
@@ -732,6 +734,8 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
Vector<int> setchain;
+ int prev_key_idx=-1;
+
for(List<GDParser::OperatorNode*>::Element *E=chain.back();E;E=E->prev()) {
@@ -743,16 +747,23 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
if (named) {
- key_idx = codegen.get_name_map_pos(static_cast<const GDParser::IdentifierNode*>(E->get()->arguments[1])->name);
+ key_idx = codegen.get_name_map_pos(static_cast<const GDParser::IdentifierNode*>(E->get()->arguments[1])->name);
+ //printf("named key %x\n",key_idx);
+
} else {
- GDParser::Node *key = E->get()->arguments[1];
- key_idx = _parse_expression(codegen,key,slevel);
- if (retval&GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS) {
+ if (prev_pos&(GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS)) {
slevel++;
codegen.alloc_stack(slevel);
}
+ GDParser::Node *key = E->get()->arguments[1];
+ key_idx = _parse_expression(codegen,key,slevel);
+ //printf("expr key %x\n",key_idx);
+
+
+ //stack was raised here if retval was stack but..
+
}
if (key_idx<0)
@@ -764,6 +775,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
slevel++;
codegen.alloc_stack(slevel);
int dst_pos = (GDFunction::ADDR_TYPE_STACK<<GDFunction::ADDR_BITS)|slevel;
+
codegen.opcodes.push_back(dst_pos);
//add in reverse order, since it will be reverted
@@ -773,6 +785,7 @@ int GDCompiler::_parse_expression(CodeGen& codegen,const GDParser::Node *p_expre
setchain.push_back(named ? GDFunction::OPCODE_SET_NAMED : GDFunction::OPCODE_SET);
prev_pos=dst_pos;
+ prev_key_idx=key_idx;
}