GDScript: Infer variable types on release
Otherwise this creates an inconsistency between debug and release builds, potentially leading to crashes.
This commit is contained in:
parent
a2ee2bdd90
commit
a3fe028809
1 changed files with 0 additions and 6 deletions
|
@ -2943,9 +2943,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) {
|
||||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
||||||
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
||||||
lv->datatype = DataType();
|
lv->datatype = DataType();
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
lv->datatype.infer_type = true;
|
lv->datatype.infer_type = true;
|
||||||
#endif
|
|
||||||
tokenizer->advance();
|
tokenizer->advance();
|
||||||
} else if (!_parse_type(lv->datatype)) {
|
} else if (!_parse_type(lv->datatype)) {
|
||||||
_set_error("Expected a type for the variable.");
|
_set_error("Expected a type for the variable.");
|
||||||
|
@ -4905,9 +4903,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
||||||
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
||||||
member.data_type = DataType();
|
member.data_type = DataType();
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
member.data_type.infer_type = true;
|
member.data_type.infer_type = true;
|
||||||
#endif
|
|
||||||
tokenizer->advance();
|
tokenizer->advance();
|
||||||
} else if (!_parse_type(member.data_type)) {
|
} else if (!_parse_type(member.data_type)) {
|
||||||
_set_error("Expected a type for the class variable.");
|
_set_error("Expected a type for the class variable.");
|
||||||
|
@ -5149,9 +5145,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
if (tokenizer->get_token() == GDScriptTokenizer::TK_COLON) {
|
||||||
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
if (tokenizer->get_token(1) == GDScriptTokenizer::TK_OP_ASSIGN) {
|
||||||
constant.type = DataType();
|
constant.type = DataType();
|
||||||
#ifdef DEBUG_ENABLED
|
|
||||||
constant.type.infer_type = true;
|
constant.type.infer_type = true;
|
||||||
#endif
|
|
||||||
tokenizer->advance();
|
tokenizer->advance();
|
||||||
} else if (!_parse_type(constant.type)) {
|
} else if (!_parse_type(constant.type)) {
|
||||||
_set_error("Expected a type for the class constant.");
|
_set_error("Expected a type for the class constant.");
|
||||||
|
|
Loading…
Reference in a new issue