diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-04-11 23:23:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-11 23:23:35 +0200 |
commit | da65d546491f11aebf0427f08c826eea3c9e7efb (patch) | |
tree | 5429767b137ef39334273cff5d0a10a3e5eb45c9 /main/tests/test_gdscript.cpp | |
parent | c1dcdf6109dbe29549517d683d85b81c0ade8611 (diff) | |
parent | f04f127680fff6f1a04e26f776d1f7d0ec87ece8 (diff) |
Merge pull request #27867 from bojidar-bg/27489-as-self-fail
Fix as operator generating opcode 38 errors
Diffstat (limited to 'main/tests/test_gdscript.cpp')
-rw-r--r-- | main/tests/test_gdscript.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp index 8c60b79200..87bd640001 100644 --- a/main/tests/test_gdscript.cpp +++ b/main/tests/test_gdscript.cpp @@ -289,6 +289,11 @@ static String _parser_expr(const GDScriptParser::Node *p_expr) { } } break; + case GDScriptParser::Node::TYPE_CAST: { + const GDScriptParser::CastNode *cast_node = static_cast<const GDScriptParser::CastNode *>(p_expr); + txt = _parser_expr(cast_node->source_node) + " as " + cast_node->cast_type.to_string(); + + } break; case GDScriptParser::Node::TYPE_NEWLINE: { //skippie @@ -669,6 +674,17 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String incr += 2; } break; + case GDScriptFunction::OPCODE_CAST_TO_SCRIPT: { + + txt += " cast "; + txt += DADDR(3); + txt += "="; + txt += DADDR(1); + txt += " as "; + txt += DADDR(2); + incr += 4; + + } break; case GDScriptFunction::OPCODE_CONSTRUCT: { Variant::Type t = Variant::Type(code[ip + 1]); @@ -1018,19 +1034,17 @@ MainLoop *test(TestType p_type) { return NULL; } - GDScript *script = memnew(GDScript); + Ref<GDScript> gds; + gds.instance(); GDScriptCompiler gdc; - err = gdc.compile(&parser, script); + err = gdc.compile(&parser, gds.ptr()); if (err) { print_line("Compile Error:\n" + itos(gdc.get_error_line()) + ":" + itos(gdc.get_error_column()) + ":" + gdc.get_error()); - memdelete(script); return NULL; } - Ref<GDScript> gds = Ref<GDScript>(script); - Ref<GDScript> current = gds; while (current.is_valid()) { |