From 85e316a5d58a1866ff4c8738f1703b01629abc32 Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 9 Mar 2021 12:32:35 -0300 Subject: Add typed arrays to GDScript - Use `Array[type]` for type-hints. e.g.: `var array: Array[int] = [1, 2, 3]` - Array literals are typed if their storage is typed (variable asssignment of as argument in function all). Otherwise they are untyped. --- modules/gdscript/gdscript_disassembler.cpp | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'modules/gdscript/gdscript_disassembler.cpp') diff --git a/modules/gdscript/gdscript_disassembler.cpp b/modules/gdscript/gdscript_disassembler.cpp index 17cb5e3c96..32adca29ed 100644 --- a/modules/gdscript/gdscript_disassembler.cpp +++ b/modules/gdscript/gdscript_disassembler.cpp @@ -322,6 +322,14 @@ void GDScriptFunction::disassemble(const Vector &p_code_lines) const { incr += 4; } break; + case OPCODE_ASSIGN_TYPED_ARRAY: { + text += "assign typed array "; + text += DADDR(1); + text += " = "; + text += DADDR(2); + + incr += 3; + } break; case OPCODE_ASSIGN_TYPED_NATIVE: { text += "assign typed native ("; text += DADDR(3); @@ -426,6 +434,39 @@ void GDScriptFunction::disassemble(const Vector &p_code_lines) const { incr += 3 + argc; } break; + case OPCODE_CONSTRUCT_TYPED_ARRAY: { + int argc = _code_ptr[ip + 1 + instr_var_args]; + + Ref