diff options
Diffstat (limited to 'src/ast')
| -rw-r--r-- | src/ast/ast.c | 1 | ||||
| -rw-r--r-- | src/ast/ast.h | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/ast/ast.c b/src/ast/ast.c index dee2eed..712f6e3 100644 --- a/src/ast/ast.c +++ b/src/ast/ast.c @@ -52,6 +52,7 @@ void ast_free(ASTNode *node) Type *type_new(TypeKind kind) { Type *t = xmalloc(sizeof(Type)); + memset(t, 0, sizeof(Type)); t->kind = kind; t->name = NULL; t->inner = NULL; diff --git a/src/ast/ast.h b/src/ast/ast.h index cef68c6..2233b09 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -54,13 +54,17 @@ typedef struct Type struct Type **args; // For GENERIC args. int arg_count; int is_const; - int is_explicit_struct; // e.g. "struct Foo" vs "Foo" + int is_explicit_struct; // for example, "struct Foo" vs "Foo" union { int array_size; // For fixed-size arrays [T; N]. int is_varargs; // For function types (...). int is_restrict; // For restrict pointers. - int has_drop; // For RAII: does this type implement Drop? + struct + { + int has_drop; // For RAII: does this type implement Drop? + int has_iterable; // For the for iterator: does the type implement Iterable? + } traits; }; } Type; @@ -404,6 +408,8 @@ struct ASTNode { char *name; ASTNode *methods; + char **generic_params; + int generic_param_count; } trait; struct |
