|
@@ -1639,23 +1639,29 @@ GDScriptParser::AnnotationNode *GDScriptParser::parse_annotation(uint32_t p_vali
|
|
advance();
|
|
advance();
|
|
// Arguments.
|
|
// Arguments.
|
|
push_completion_call(annotation);
|
|
push_completion_call(annotation);
|
|
- make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, 0);
|
|
|
|
int argument_index = 0;
|
|
int argument_index = 0;
|
|
do {
|
|
do {
|
|
|
|
+ make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index);
|
|
|
|
+ set_last_completion_call_arg(argument_index);
|
|
if (check(GDScriptTokenizer::Token::PARENTHESIS_CLOSE)) {
|
|
if (check(GDScriptTokenizer::Token::PARENTHESIS_CLOSE)) {
|
|
// Allow for trailing comma.
|
|
// Allow for trailing comma.
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- make_completion_context(COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index);
|
|
|
|
- set_last_completion_call_arg(argument_index++);
|
|
|
|
ExpressionNode *argument = parse_expression(false);
|
|
ExpressionNode *argument = parse_expression(false);
|
|
|
|
+
|
|
if (argument == nullptr) {
|
|
if (argument == nullptr) {
|
|
push_error("Expected expression as the annotation argument.");
|
|
push_error("Expected expression as the annotation argument.");
|
|
valid = false;
|
|
valid = false;
|
|
- continue;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ annotation->arguments.push_back(argument);
|
|
|
|
+
|
|
|
|
+ if (argument->type == Node::LITERAL) {
|
|
|
|
+ override_completion_context(argument, COMPLETION_ANNOTATION_ARGUMENTS, annotation, argument_index);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- annotation->arguments.push_back(argument);
|
|
|
|
|
|
+
|
|
|
|
+ argument_index++;
|
|
} while (match(GDScriptTokenizer::Token::COMMA) && !is_at_end());
|
|
} while (match(GDScriptTokenizer::Token::COMMA) && !is_at_end());
|
|
|
|
|
|
pop_multiline();
|
|
pop_multiline();
|