Skip to content

Commit

Permalink
Merge pull request godotengine#27270 from shartte/fix-generics-parsing
Browse files Browse the repository at this point in the history
Fix parsing of generic type declarations in C# source files
  • Loading branch information
neikeq authored Mar 20, 2019
2 parents b0fbefe + 34366bc commit 96abb69
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions modules/mono/editor/script_class_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@ Error ScriptClassParser::_skip_generic_type_params() {

if (tk == TK_IDENTIFIER) {
tk = get_token();
// Type specifications can end with "?" to denote nullable types, such as IList<int?>
if (tk == TK_SYMBOL) {
tk = get_token();
if (value.operator String() != "?") {
error_str = "Expected " + get_token_name(TK_IDENTIFIER) + ", found unexpected symbol '" + value + "'";
error = true;
return ERR_PARSE_ERROR;
}
if (tk != TK_OP_GREATER && tk != TK_COMMA) {
error_str = "Nullable type symbol '?' is only allowed after an identifier, but found " + get_token_name(tk) + " next.";
error = true;
return ERR_PARSE_ERROR;
}
}

if (tk == TK_PERIOD) {
while (true) {
Expand Down

0 comments on commit 96abb69

Please sign in to comment.