properly handle typed array constructors in VariantParser, closes #3054

This commit is contained in:
Juan Linietsky 2016-01-10 23:22:48 -03:00
parent 1a9c3a134d
commit 725b61bb6c

View file

@ -448,7 +448,7 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in
if (!first) { if (!first) {
get_token(p_stream,token,line,r_err_str); get_token(p_stream,token,line,r_err_str);
if (token.type==TK_COMMA) { if (token.type==TK_COMMA) {
//do none //do none
} else if (token.type==TK_PARENTHESIS_CLOSE) { } else if (token.type==TK_PARENTHESIS_CLOSE) {
break; break;
} else { } else {
@ -458,7 +458,10 @@ Error VariantParser::_parse_construct(Stream *p_stream,Vector<T>& r_construct,in
} }
} }
get_token(p_stream,token,line,r_err_str); get_token(p_stream,token,line,r_err_str);
if (token.type!=TK_NUMBER) {
if (first && token.type==TK_PARENTHESIS_CLOSE) {
break;
} else if (token.type!=TK_NUMBER) {
r_err_str="Expected float in constructor"; r_err_str="Expected float in constructor";
return ERR_PARSE_ERROR; return ERR_PARSE_ERROR;
} }