]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.c
allowing inexing of array-fields
[xonotic/gmqcc.git] / ast.c
diff --git a/ast.c b/ast.c
index bfdcf621c80eb4a8d1c2a77bd8109589c15e4140..aa65da207af53f4e31e9b19e4e656cd4319ef422 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -588,6 +588,15 @@ ast_array_index* ast_array_index_new(lex_ctx ctx, ast_expression *array, ast_exp
         ast_array_index_delete(self);
         return NULL;
     }
+    if (array->expression.vtype == TYPE_FIELD && outtype->expression.vtype == TYPE_ARRAY) {
+        if (self->expression.vtype != TYPE_ARRAY) {
+            asterror(ast_ctx(self), "array_index node on type");
+            ast_array_index_delete(self);
+            return NULL;
+        }
+        self->array = outtype;
+        self->expression.vtype = TYPE_FIELD;
+    }
 
     return self;
 }