push variable later when created, to avoid self-referencing as a valid case, closes #6111
(cherry picked from commit 95f10c620d
)
This commit is contained in:
parent
b94c5a31cd
commit
f4d6e37c2f
|
@ -1678,8 +1678,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) {
|
|||
StringName n = tokenizer->get_token_identifier();
|
||||
tokenizer->advance();
|
||||
|
||||
p_block->variables.push_back(n); //line?
|
||||
p_block->variable_lines.push_back(tokenizer->get_token_line());
|
||||
int var_line = tokenizer->get_token_line();
|
||||
|
||||
//must know when the local variable is declared
|
||||
LocalVarNode *lv = alloc_node<LocalVarNode>();
|
||||
|
@ -1709,6 +1708,10 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) {
|
|||
c->value = Variant();
|
||||
assigned = c;
|
||||
}
|
||||
//must be added later, to avoid self-referencing.
|
||||
p_block->variables.push_back(n); //line?
|
||||
p_block->variable_lines.push_back(var_line);
|
||||
|
||||
IdentifierNode *id = alloc_node<IdentifierNode>();
|
||||
id->name = n;
|
||||
|
||||
|
|
Loading…
Reference in New Issue