]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Fix parsing of multi-dot field types
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 25 Nov 2012 16:43:13 +0000 (17:43 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 25 Nov 2012 16:43:13 +0000 (17:43 +0100)
parser.c

index 650de169a18b5a132d5bdc81c54ea5106b01a9b9..5e727605ca740ce7a0b991103ecca4918e968999 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -3210,6 +3210,18 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase, ast_va
             parseerror(parser, "expected typename for field definition");
             return NULL;
         }
+
+        /* Further dots are handled seperately because they won't be part of the
+         * basetype
+         */
+        while (parser->tok == '.') {
+            ++morefields;
+            if (!parser_next(parser)) {
+                parseerror(parser, "expected typename for field definition");
+                return NULL;
+            }
+        }
+
         if (parser->tok == TOKEN_IDENT)
             cached_typedef = parser_find_typedef(parser, parser_tokval(parser), 0);
         if (!cached_typedef && parser->tok != TOKEN_TYPENAME) {
@@ -3218,17 +3230,6 @@ static ast_value *parse_typename(parser_t *parser, ast_value **storebase, ast_va
         }
     }
 
-    /* Further dots are handled seperately because they won't be part of the
-     * basetype
-     */
-    while (parser->tok == '.') {
-        ++morefields;
-        if (!parser_next(parser)) {
-            parseerror(parser, "expected typename for field definition");
-            return NULL;
-        }
-    }
-
     /* generate the basic type value */
     if (cached_typedef) {
         var = ast_value_copy(cached_typedef);