diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-20 15:41:36 +0100 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-20 15:41:36 +0100 |
| commit | 561d9497399db6136a6cbac17d7736222039cf6a (patch) | |
| tree | 062aa96da270791e295b3dc1e7e710287e16affb /modules/gdscript/gdscript_disassembler.cpp | |
| parent | 6bf63a3542f77443f3453bd02ac316d6c9de6f98 (diff) | |
| parent | 8fe023ad93119061cda4730d1b0ba1946f15c515 (diff) | |
| download | redot-engine-561d9497399db6136a6cbac17d7736222039cf6a.tar.gz | |
Merge pull request #73489 from vonagam/type-check-node
GDScript: Rework type check
Diffstat (limited to 'modules/gdscript/gdscript_disassembler.cpp')
| -rw-r--r-- | modules/gdscript/gdscript_disassembler.cpp | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp index d4f4358ac1..0acc03be3d 100644 --- a/modules/gdscript/gdscript_disassembler.cpp +++ b/modules/gdscript/gdscript_disassembler.cpp @@ -135,23 +135,56 @@ void GDScriptFunction::disassemble(const Vector<String> &p_code_lines) const { 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; |
