diff options
Diffstat (limited to 'modules/gdscript/gdscript_disassembler.cpp')
-rw-r--r-- | modules/gdscript/gdscript_disassembler.cpp | 76 |
1 files changed, 56 insertions, 20 deletions
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp index 4edabdcb40..0acc03be3d 100644 --- a/modules/gdscript/gdscript_disassembler.cpp +++ b/modules/gdscript/gdscript_disassembler.cpp @@ -128,28 +128,63 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += DADDR(3); text += " = "; text += DADDR(1); - text += " <operator function> "; + text += " "; + text += operator_names[_code_ptr[ip + 4]]; + text += " "; text += DADDR(2); incr += 5; } break; - case OPCODE_EXTENDS_TEST: { - text += "is object "; - text += DADDR(3); - text += " = "; + case OPCODE_TYPE_TEST_BUILTIN: { + text += "type test "; text += DADDR(1); - text += " is "; + text += " = "; text += DADDR(2); + text += " is "; + text += Variant::get_type_name(Variant::Type(_code_ptr[ip + 3])); incr += 4; } break; - case OPCODE_IS_BUILTIN: { - text += "is builtin "; + case OPCODE_TYPE_TEST_ARRAY: { + text += "type test "; + text += DADDR(1); + text += " = "; text += DADDR(2); + text += " is Array["; + + Ref<Script> script_type = get_constant(_code_ptr[ip + 3] & GDScriptFunction::ADDR_MASK); + Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + 4]; + StringName native_type = get_global_name(_code_ptr[ip + 5]); + + if (script_type.is_valid() && script_type->is_valid()) { + text += script_type->get_path(); + } else if (native_type != StringName()) { + text += native_type; + } else { + text += Variant::get_type_name(builtin_type); + } + + text += "]"; + + incr += 6; + } break; + case OPCODE_TYPE_TEST_NATIVE: { + text += "type test "; + text += DADDR(1); text += " = "; + text += DADDR(2); + text += " is "; + text += get_global_name(_code_ptr[ip + 3]); + + incr += 4; + } break; + case OPCODE_TYPE_TEST_SCRIPT: { + text += "type test "; text += DADDR(1); + text += " = "; + text += DADDR(2); text += " is "; - text += Variant::get_type_name(Variant::Type(_code_ptr[ip + 3])); + text += DADDR(3); incr += 4; } break; @@ -230,7 +265,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "set_named validated "; text += DADDR(1); text += "[\""; - text += "<unknown name>"; + text += setter_names[_code_ptr[ip + 3]]; text += "\"] = "; text += DADDR(2); @@ -253,7 +288,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += " = "; text += DADDR(1); text += "[\""; - text += "<unknown name>"; + text += getter_names[_code_ptr[ip + 3]]; text += "\"]"; incr += 4; @@ -315,7 +350,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += " = "; text += DADDR(2); - incr += 3; + incr += 6; } break; case OPCODE_ASSIGN_TYPED_NATIVE: { text += "assign typed native ("; @@ -398,7 +433,8 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += DADDR(1 + argc); text += " = "; - text += "<unknown type>("; + text += constructors_names[_code_ptr[ip + 3 + argc]]; + text += "("; for (int i = 0; i < argc; i++) { if (i > 0) { text += ", "; @@ -431,7 +467,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { int instr_var_args = _code_ptr[++ip]; int argc = _code_ptr[ip + 1 + instr_var_args]; - Ref<Script> script_type = get_constant(_code_ptr[ip + argc + 2]); + Ref<Script> script_type = get_constant(_code_ptr[ip + argc + 2] & GDScriptFunction::ADDR_MASK); Variant::Type builtin_type = (Variant::Type)_code_ptr[ip + argc + 4]; StringName native_type = get_global_name(_code_ptr[ip + argc + 5]); @@ -460,7 +496,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += "]"; - incr += 3 + argc; + incr += 6 + argc; } break; case OPCODE_CONSTRUCT_DICTIONARY: { int instr_var_args = _code_ptr[++ip]; @@ -687,7 +723,7 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { text += DADDR(2 + argc) + " = "; text += DADDR(1) + "."; - text += "<unknown method>"; + text += builtin_methods_names[_code_ptr[ip + 4 + argc]]; text += "("; @@ -725,12 +761,12 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { case OPCODE_CALL_UTILITY_VALIDATED: { int instr_var_args = _code_ptr[++ip]; - text += "call-utility "; + text += "call-utility validated "; int argc = _code_ptr[ip + 1 + instr_var_args]; text += DADDR(1 + argc) + " = "; - text += "<unknown function>"; + text += utilities_names[_code_ptr[ip + 3 + argc]]; text += "("; for (int i = 0; i < argc; i++) { @@ -746,12 +782,12 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { case OPCODE_CALL_GDSCRIPT_UTILITY: { int instr_var_args = _code_ptr[++ip]; - text += "call-gscript-utility "; + text += "call-gdscript-utility "; int argc = _code_ptr[ip + 1 + instr_var_args]; text += DADDR(1 + argc) + " = "; - text += "<unknown function>"; + text += gds_utilities_names[_code_ptr[ip + 3 + argc]]; text += "("; for (int i = 0; i < argc; i++) { |