diff options
author | Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com> | 2019-03-20 18:34:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-20 18:34:28 +0100 |
commit | 96abb695f29ed4f88394f64262fd75cc9937e8fd (patch) | |
tree | 7342d3341c456e5dec9ef1b1414b9b2bae353de8 /modules | |
parent | b0fbefe9da2402110dae3d2f074703218aa9d397 (diff) | |
parent | 34366bc27fddd69539562c12579b3207b23676fe (diff) |
Merge pull request #27270 from shartte/fix-generics-parsing
Fix parsing of generic type declarations in C# source files
Diffstat (limited to 'modules')
-rw-r--r-- | modules/mono/editor/script_class_parser.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/mono/editor/script_class_parser.cpp b/modules/mono/editor/script_class_parser.cpp index 6b2ec5cc20..dfb652a7aa 100644 --- a/modules/mono/editor/script_class_parser.cpp +++ b/modules/mono/editor/script_class_parser.cpp @@ -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) { |