You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 24f85e8
Browse filesBrowse the repository at this point in the historyBrowse files
// Handle typed declarations where the type token may be a keyword like THR
784
-
if ((parser->current_token.type==TOKEN_IDENT||parser->current_token.type==TOKEN_THR||parser->current_token.type==TOKEN_FUNC) &&parser->next_token.type==TOKEN_COLON) {
863
+
if (looks_like_func_definition(parser)) {
864
+
returnparse_func(parser);
865
+
}
866
+
867
+
// Handle typed declarations where the type token may be a keyword like THR.
868
+
if (starts_named_type_annotation(parser)) {
785
869
Tokentype_tok=parser->current_token;
786
-
advance(parser);
787
-
consume(parser, TOKEN_COLON, "Expected ':' after type");
788
-
if (parser->current_token.type!=TOKEN_IDENT) {
789
-
report_error(parser, "Expected identifier name");
870
+
DeclTypedtype=parse_type_name(type_tok.literal);
871
+
if (!advance_to_annotated_name(parser, k_type_name_gap_error)) {
790
872
returnNULL;
791
873
}
792
874
char*name=parser->current_token.literal;
793
875
advance(parser);
794
-
DeclTypedtype=parse_type_name(type_tok.literal);
795
876
// Support typed declaration with indexed-assignment target, e.g. `TNS: t[1-10] = ...`
796
877
if (parser->current_token.type==TOKEN_LBRACKET||parser->current_token.type==TOKEN_LANGLE) {
797
878
// construct base identifier expr and parse trailing indexers
if ((parser->current_token.type==TOKEN_IDENT||parser->current_token.type==TOKEN_THR||parser->current_token.type==TOKEN_FUNC) &&parser->next_token.type==TOKEN_COLON) {
1076
+
if (starts_named_type_annotation(parser)) {
996
1077
Tokentype_tok=parser->current_token;
997
-
advance(parser);
998
-
consume(parser, TOKEN_COLON, "Expected ':' after type");
999
-
if (parser->current_token.type!=TOKEN_IDENT) {
1000
-
report_error(parser, "Expected identifier name");
1078
+
DeclTypedtype=parse_type_name(type_tok.literal);
1079
+
if (!advance_to_annotated_name(parser, k_type_name_gap_error)) {
0 commit comments