diff options
Diffstat (limited to 'modules/gdscript/gdscript_compiler.cpp')
-rw-r--r-- | modules/gdscript/gdscript_compiler.cpp | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/modules/gdscript/gdscript_compiler.cpp b/modules/gdscript/gdscript_compiler.cpp index 1daf8ff7a9..af8e4b3746 100644 --- a/modules/gdscript/gdscript_compiler.cpp +++ b/modules/gdscript/gdscript_compiler.cpp @@ -1059,22 +1059,22 @@ GDScriptCodeGenerator::Address GDScriptCompiler::_parse_expression(CodeGen &code bool known_type = assigned.type.has_type; bool is_shared = Variant::is_type_shared(assigned.type.builtin_type); - if (!known_type) { - // Jump shared values since they are already updated in-place. - gen->write_jump_if_shared(assigned); - } - if (known_type && !is_shared) { + if (!known_type || !is_shared) { + if (!known_type) { + // Jump shared values since they are already updated in-place. + gen->write_jump_if_shared(assigned); + } if (!info.is_named) { gen->write_set(info.base, info.key, assigned); - if (info.key.mode == GDScriptCodeGenerator::Address::TEMPORARY) { - gen->pop_temporary(); - } } else { gen->write_set_named(info.base, info.name, assigned); } + if (!known_type) { + gen->write_end_jump_if_shared(); + } } - if (!known_type) { - gen->write_end_jump_if_shared(); + if (!info.is_named && info.key.mode == GDScriptCodeGenerator::Address::TEMPORARY) { + gen->pop_temporary(); } if (assigned.mode == GDScriptCodeGenerator::Address::TEMPORARY) { gen->pop_temporary(); @@ -2452,6 +2452,25 @@ Error GDScriptCompiler::_parse_class_level(GDScript *p_script, const GDScriptPar } #endif } break; + + case GDScriptParser::ClassNode::Member::GROUP: { + const GDScriptParser::AnnotationNode *annotation = member.annotation; + StringName name = annotation->export_info.name; + + // This is not a normal member, but we need this to keep indices in order. + GDScript::MemberInfo minfo; + minfo.index = p_script->member_indices.size(); + + PropertyInfo prop_info; + prop_info.name = name; + prop_info.usage = annotation->export_info.usage; + prop_info.hint_string = annotation->export_info.hint_string; + + p_script->member_info[name] = prop_info; + p_script->member_indices[name] = minfo; + p_script->members.insert(name); + } break; + default: break; // Nothing to do here. } |