Explorar el Código

Merge pull request #9015 from mcanders/mcanders/ParseObjectVariantFix

Fix Variant::OBJECT token parsing
Rémi Verschelde hace 8 años
padre
commit
71ada5bc2c
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      core/variant_parser.cpp

+ 6 - 2
core/variant_parser.cpp

@@ -744,7 +744,12 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
 						return err;
 
 					if (token.type == TK_PARENTHESIS_CLOSE) {
-
+						Reference *reference = obj->cast_to<Reference>();
+						if (reference) {
+							value = REF(reference);
+						} else {
+							value = obj;
+						}
 						return OK;
 					}
 
@@ -760,7 +765,6 @@ Error VariantParser::parse_value(Token &token, Variant &value, Stream *p_stream,
 						}
 					}
 
-					get_token(p_stream, token, line, r_err_str);
 					if (token.type != TK_STRING) {
 						r_err_str = "Expected property name as string";
 						return ERR_PARSE_ERROR;