]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
var const / const var - both need to be allowed
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 23:32:18 +0000 (00:32 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 30 Nov 2012 23:32:18 +0000 (00:32 +0100)
parser.c

index 6c126c69c871eaabac2e03b591f7ba5ed2c0d598..01e3691e31ca8a4279dd42a846a1965605b84c70 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -4175,6 +4175,13 @@ static bool parser_global_statement(parser_t *parser)
                 parseerror(parser, "expected variable declaration after 'var'");
                 return false;
             }
+            if (parser->tok == TOKEN_IDENT && !strcmp(parser_tokval(parser), "const")) {
+                (void)!parsewarning(parser, WARN_CONST_VAR, "ignoring `const` after 'var' qualifier");
+                if (!parser_next(parser)) {
+                    parseerror(parser, "expected variable declaration after 'const var'");
+                    return false;
+                }
+            }
             return parse_variable(parser, NULL, true, CV_VAR, NULL);
         }
     }