diff options
author | George Marques <george@gmarqu.es> | 2020-08-19 14:08:52 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2020-08-19 14:09:45 -0300 |
commit | 846856728b2d1b2ccce3b013adef13a3fd238e82 (patch) | |
tree | d7354c58cfe163cc799fb7fc96b8aca4c298adce /modules/gdscript | |
parent | 15b16ec0cee44a16789662670d66a174b097abdb (diff) |
GDScript: Show error when function return type is missing
Diffstat (limited to 'modules/gdscript')
-rw-r--r-- | modules/gdscript/gdscript_parser.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 02c80b79c1..aeec1c0379 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -1149,6 +1149,9 @@ GDScriptParser::FunctionNode *GDScriptParser::parse_function() { if (match(GDScriptTokenizer::Token::FORWARD_ARROW)) { make_completion_context(COMPLETION_TYPE_NAME_OR_VOID, function); function->return_type = parse_type(true); + if (function->return_type == nullptr) { + push_error(R"(Expected return type or "void" after "->".)"); + } } // TODO: Improve token consumption so it synchronizes to a statement boundary. This way we can get into the function body with unrecognized tokens. |