|
@@ -142,8 +142,9 @@ bool GDScriptParser::_parse_arguments(Node *p_parent, Vector<Node *> &p_args, bo
|
|
}
|
|
}
|
|
|
|
|
|
Node *arg = _parse_expression(p_parent, p_static);
|
|
Node *arg = _parse_expression(p_parent, p_static);
|
|
- if (!arg)
|
|
|
|
|
|
+ if (!arg) {
|
|
return false;
|
|
return false;
|
|
|
|
+ }
|
|
|
|
|
|
p_args.push_back(arg);
|
|
p_args.push_back(arg);
|
|
|
|
|
|
@@ -1000,7 +1001,7 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|
|
|
|
|
expr = dict;
|
|
expr = dict;
|
|
|
|
|
|
- } else if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD && (tokenizer->is_token_literal(1) || tokenizer->get_token(1) == GDScriptTokenizer::TK_CURSOR) && tokenizer->get_token(2) == GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
|
|
|
|
|
|
+ } else if (tokenizer->get_token() == GDScriptTokenizer::TK_PERIOD && (tokenizer->is_token_literal(1) || tokenizer->get_token(1) == GDScriptTokenizer::TK_CURSOR)) {
|
|
// We check with is_token_literal, as this allows us to use match/sync/etc. as a name
|
|
// We check with is_token_literal, as this allows us to use match/sync/etc. as a name
|
|
// parent call
|
|
// parent call
|
|
|
|
|
|
@@ -1012,17 +1013,23 @@ GDScriptParser::Node *GDScriptParser::_parse_expression(Node *p_parent, bool p_s
|
|
op->arguments.push_back(self);
|
|
op->arguments.push_back(self);
|
|
forbidden for now */
|
|
forbidden for now */
|
|
StringName identifier;
|
|
StringName identifier;
|
|
- if (_get_completable_identifier(COMPLETION_PARENT_FUNCTION, identifier)) {
|
|
|
|
- //indexing stuff
|
|
|
|
- }
|
|
|
|
|
|
+ bool is_completion = _get_completable_identifier(COMPLETION_PARENT_FUNCTION, identifier) && for_completion;
|
|
|
|
|
|
IdentifierNode *id = alloc_node<IdentifierNode>();
|
|
IdentifierNode *id = alloc_node<IdentifierNode>();
|
|
id->name = identifier;
|
|
id->name = identifier;
|
|
op->arguments.push_back(id);
|
|
op->arguments.push_back(id);
|
|
|
|
|
|
- tokenizer->advance(1);
|
|
|
|
- if (!_parse_arguments(op, op->arguments, p_static))
|
|
|
|
- return NULL;
|
|
|
|
|
|
+ if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_OPEN) {
|
|
|
|
+ if (!is_completion) {
|
|
|
|
+ _set_error("Expected '(' for parent function call.");
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ tokenizer->advance();
|
|
|
|
+ if (!_parse_arguments(op, op->arguments, p_static)) {
|
|
|
|
+ return NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
expr = op;
|
|
expr = op;
|
|
|
|
|
|
@@ -4806,13 +4813,13 @@ void GDScriptParser::_determine_inheritance(ClassNode *p_class) {
|
|
|
|
|
|
if (path.is_rel_path()) {
|
|
if (path.is_rel_path()) {
|
|
|
|
|
|
- String base = self_path;
|
|
|
|
|
|
+ String base = base_path;
|
|
|
|
|
|
if (base == "" || base.is_rel_path()) {
|
|
if (base == "" || base.is_rel_path()) {
|
|
_set_error("Could not resolve relative path for parent class: " + path, p_class->line);
|
|
_set_error("Could not resolve relative path for parent class: " + path, p_class->line);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- path = base.get_base_dir().plus_file(path).simplify_path();
|
|
|
|
|
|
+ path = base.plus_file(path).simplify_path();
|
|
}
|
|
}
|
|
script = ResourceLoader::load(path);
|
|
script = ResourceLoader::load(path);
|
|
if (script.is_null()) {
|
|
if (script.is_null()) {
|
|
@@ -7540,7 +7547,7 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
|
_set_error("Parse Error: " + tokenizer->get_token_error());
|
|
_set_error("Parse Error: " + tokenizer->get_token_error());
|
|
}
|
|
}
|
|
|
|
|
|
- if (error_set) {
|
|
|
|
|
|
+ if (error_set && !for_completion) {
|
|
return ERR_PARSE_ERROR;
|
|
return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -7559,13 +7566,11 @@ Error GDScriptParser::_parse(const String &p_base_path) {
|
|
check_types = false;
|
|
check_types = false;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- if (check_types) {
|
|
|
|
- // Resolve all class-level stuff before getting into function blocks
|
|
|
|
- _check_class_level_types(main_class);
|
|
|
|
|
|
+ // Resolve all class-level stuff before getting into function blocks
|
|
|
|
+ _check_class_level_types(main_class);
|
|
|
|
|
|
- if (error_set) {
|
|
|
|
- return ERR_PARSE_ERROR;
|
|
|
|
- }
|
|
|
|
|
|
+ if (error_set) {
|
|
|
|
+ return ERR_PARSE_ERROR;
|
|
}
|
|
}
|
|
|
|
|
|
// Resolve the function blocks
|
|
// Resolve the function blocks
|