diff options
author | George Marques <george@gmarqu.es> | 2019-03-03 11:31:27 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-03 11:31:27 -0300 |
commit | bf2c6680ac24dcb8034372e43f3e459eb1f6a169 (patch) | |
tree | 178bed9f46e538e1f6b609a0b8b7c9b84826574c | |
parent | af6217e1b127df341668b9f03f1f76f4c8c562e5 (diff) | |
parent | f207b2fe0e57b58988520e06e3201182733a2978 (diff) |
Merge pull request #26521 from bojidar-bg/25408-gdscript-constant-bug
Fix GDScript checking for assigning to a constant only in release
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 5ebf68177d..56e681ab38 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -2082,7 +2082,7 @@ GDScriptParser::PatternNode *GDScriptParser::_parse_pattern(bool p_static) { return NULL; } pattern->pt_type = GDScriptParser::PatternNode::PT_BIND; - pattern->bind = tokenizer->get_token_identifier(); + pattern->bind = tokenizer->get_token_literal(); // Check if variable name is already used BlockNode *bl = current_block; while (bl) { @@ -7842,13 +7842,16 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { return; } - if (!lh_type.has_type && check_types) { - if (op->arguments[0]->type == Node::TYPE_OPERATOR) { - _mark_line_as_unsafe(op->line); + if (check_types) { + if (!lh_type.has_type) { + if (op->arguments[0]->type == Node::TYPE_OPERATOR) { + _mark_line_as_unsafe(op->line); + } + } + if (lh_type.is_constant) { + _set_error("Cannot assign a new value to a constant.", op->line); + return; } - } else if (lh_type.is_constant) { - _set_error("Cannot assign a new value to a constant.", op->line); - return; } DataType rh_type; |