Browse Source

Big renaming: `AstNode` to `Ast`

gingerBill 7 years ago
parent
commit
c2ca24a486
14 changed files with 1216 additions and 1216 deletions
  1. 35 35
      src/check_decl.cpp
  2. 154 154
      src/check_expr.cpp
  3. 95 95
      src/check_stmt.cpp
  4. 89 89
      src/check_type.cpp
  5. 125 125
      src/checker.cpp
  6. 40 40
      src/checker.hpp
  7. 7 7
      src/docs.cpp
  8. 6 6
      src/entity.cpp
  9. 5 5
      src/exact_value.cpp
  10. 131 131
      src/ir.cpp
  11. 4 4
      src/ir_print.cpp
  12. 253 253
      src/parser.cpp
  13. 267 267
      src/parser.hpp
  14. 5 5
      src/types.cpp

+ 35 - 35
src/check_decl.cpp

@@ -1,5 +1,5 @@
-bool check_is_terminating(AstNode *node);
-void check_stmt          (CheckerContext *ctx, AstNode *node, u32 flags);
+bool check_is_terminating(Ast *node);
+void check_stmt          (CheckerContext *ctx, Ast *node, u32 flags);
 
 
 // NOTE(bill): 'content_name' is for debugging and error messages
 // NOTE(bill): 'content_name' is for debugging and error messages
 Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *operand, String context_name) {
 Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *operand, String context_name) {
@@ -89,7 +89,7 @@ Type *check_init_variable(CheckerContext *ctx, Entity *e, Operand *operand, Stri
 	return e->type;
 	return e->type;
 }
 }
 
 
-void check_init_variables(CheckerContext *ctx, Entity **lhs, isize lhs_count, Array<AstNode *> const &inits, String context_name) {
+void check_init_variables(CheckerContext *ctx, Entity **lhs, isize lhs_count, Array<Ast *> const &inits, String context_name) {
 	if ((lhs == nullptr || lhs_count == 0) && inits.count == 0) {
 	if ((lhs == nullptr || lhs_count == 0) && inits.count == 0) {
 		return;
 		return;
 	}
 	}
@@ -168,14 +168,14 @@ void check_init_constant(CheckerContext *ctx, Entity *e, Operand *operand) {
 }
 }
 
 
 
 
-bool is_type_distinct(AstNode *node) {
+bool is_type_distinct(Ast *node) {
 	for (;;) {
 	for (;;) {
 		if (node == nullptr) {
 		if (node == nullptr) {
 			return false;
 			return false;
 		}
 		}
-		if (node->kind == AstNode_ParenExpr) {
+		if (node->kind == Ast_ParenExpr) {
 			node = node->ParenExpr.expr;
 			node = node->ParenExpr.expr;
-		} else if (node->kind == AstNode_HelperType) {
+		} else if (node->kind == Ast_HelperType) {
 			node = node->HelperType.type;
 			node = node->HelperType.type;
 		} else {
 		} else {
 			break;
 			break;
@@ -183,33 +183,33 @@ bool is_type_distinct(AstNode *node) {
 	}
 	}
 
 
 	switch (node->kind) {
 	switch (node->kind) {
-	case AstNode_DistinctType:
+	case Ast_DistinctType:
 		return true;
 		return true;
 
 
-	case AstNode_StructType:
-	case AstNode_UnionType:
-	case AstNode_EnumType:
-	case AstNode_BitFieldType:
-	case AstNode_ProcType:
+	case Ast_StructType:
+	case Ast_UnionType:
+	case Ast_EnumType:
+	case Ast_BitFieldType:
+	case Ast_ProcType:
 		return true;
 		return true;
 
 
-	case AstNode_PointerType:
-	case AstNode_ArrayType:
-	case AstNode_DynamicArrayType:
-	case AstNode_MapType:
+	case Ast_PointerType:
+	case Ast_ArrayType:
+	case Ast_DynamicArrayType:
+	case Ast_MapType:
 		return false;
 		return false;
 	}
 	}
 	return false;
 	return false;
 }
 }
 
 
-AstNode *remove_type_alias_clutter(AstNode *node) {
+Ast *remove_type_alias_clutter(Ast *node) {
 	for (;;) {
 	for (;;) {
 		if (node == nullptr) {
 		if (node == nullptr) {
 			return nullptr;
 			return nullptr;
 		}
 		}
-		if (node->kind == AstNode_ParenExpr) {
+		if (node->kind == Ast_ParenExpr) {
 			node = node->ParenExpr.expr;
 			node = node->ParenExpr.expr;
-		} else if (node->kind == AstNode_DistinctType) {
+		} else if (node->kind == Ast_DistinctType) {
 			node = node->DistinctType.type;
 			node = node->DistinctType.type;
 		} else {
 		} else {
 			return node;
 			return node;
@@ -217,7 +217,7 @@ AstNode *remove_type_alias_clutter(AstNode *node) {
 	}
 	}
 }
 }
 
 
-void check_type_decl(CheckerContext *ctx, Entity *e, AstNode *type_expr, Type *def) {
+void check_type_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Type *def) {
 	GB_ASSERT(e->type == nullptr);
 	GB_ASSERT(e->type == nullptr);
 
 
 	DeclInfo *decl = decl_info_of_entity(e);
 	DeclInfo *decl = decl_info_of_entity(e);
@@ -228,7 +228,7 @@ void check_type_decl(CheckerContext *ctx, Entity *e, AstNode *type_expr, Type *d
 
 
 
 
 	bool is_distinct = is_type_distinct(type_expr);
 	bool is_distinct = is_type_distinct(type_expr);
-	AstNode *te = remove_type_alias_clutter(type_expr);
+	Ast *te = remove_type_alias_clutter(type_expr);
 	e->type = t_invalid;
 	e->type = t_invalid;
 	String name = e->token.string;
 	String name = e->token.string;
 	Type *named = alloc_type_named(name, nullptr, e);
 	Type *named = alloc_type_named(name, nullptr, e);
@@ -263,7 +263,7 @@ void override_entity_in_scope(Entity *original_entity, Entity *new_entity) {
 	map_set(&found_scope->elements, hash_string(original_name), new_entity);
 	map_set(&found_scope->elements, hash_string(original_name), new_entity);
 }
 }
 
 
-void check_const_decl(CheckerContext *ctx, Entity *e, AstNode *type_expr, AstNode *init, Type *named_type) {
+void check_const_decl(CheckerContext *ctx, Entity *e, Ast *type_expr, Ast *init, Type *named_type) {
 	GB_ASSERT(e->type == nullptr);
 	GB_ASSERT(e->type == nullptr);
 	GB_ASSERT(e->kind == Entity_Constant);
 	GB_ASSERT(e->kind == Entity_Constant);
 
 
@@ -289,9 +289,9 @@ void check_const_decl(CheckerContext *ctx, Entity *e, AstNode *type_expr, AstNod
 
 
 	if (init != nullptr) {
 	if (init != nullptr) {
 		Entity *entity = nullptr;
 		Entity *entity = nullptr;
-		if (init->kind == AstNode_Ident) {
+		if (init->kind == Ast_Ident) {
 			entity = check_ident(ctx, &operand, init, nullptr, e->type, true);
 			entity = check_ident(ctx, &operand, init, nullptr, e->type, true);
-		} else if (init->kind == AstNode_SelectorExpr) {
+		} else if (init->kind == Ast_SelectorExpr) {
 			entity = check_selector(ctx, &operand, init, e->type);
 			entity = check_selector(ctx, &operand, init, e->type);
 		} else {
 		} else {
 			check_expr_or_type(ctx, &operand, init, e->type);
 			check_expr_or_type(ctx, &operand, init, e->type);
@@ -413,7 +413,7 @@ bool are_signatures_similar_enough(Type *a_, Type *b_) {
 }
 }
 
 
 void init_entity_foreign_library(CheckerContext *ctx, Entity *e) {
 void init_entity_foreign_library(CheckerContext *ctx, Entity *e) {
-	AstNode *ident = nullptr;
+	Ast *ident = nullptr;
 	Entity **foreign_library = nullptr;
 	Entity **foreign_library = nullptr;
 
 
 	switch (e->kind) {
 	switch (e->kind) {
@@ -431,7 +431,7 @@ void init_entity_foreign_library(CheckerContext *ctx, Entity *e) {
 
 
 	if (ident == nullptr) {
 	if (ident == nullptr) {
 		error(e->token, "foreign entiies must declare which library they are from");
 		error(e->token, "foreign entiies must declare which library they are from");
-	} else if (ident->kind != AstNode_Ident) {
+	} else if (ident->kind != Ast_Ident) {
 		error(ident, "foreign library names must be an identifier");
 		error(ident, "foreign library names must be an identifier");
 	} else {
 	} else {
 		String name = ident->Ident.token.string;
 		String name = ident->Ident.token.string;
@@ -472,7 +472,7 @@ String handle_link_name(CheckerContext *ctx, Token token, String link_name, Stri
 
 
 void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
 void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
 	GB_ASSERT(e->type == nullptr);
 	GB_ASSERT(e->type == nullptr);
-	if (d->proc_lit->kind != AstNode_ProcLit) {
+	if (d->proc_lit->kind != Ast_ProcLit) {
 		// TOOD(bill): Better error message
 		// TOOD(bill): Better error message
 		error(d->proc_lit, "Expected a procedure to check");
 		error(d->proc_lit, "Expected a procedure to check");
 		return;
 		return;
@@ -556,7 +556,7 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
 
 
 		d->scope = ctx->scope;
 		d->scope = ctx->scope;
 
 
-		GB_ASSERT(pl->body->kind == AstNode_BlockStmt);
+		GB_ASSERT(pl->body->kind == Ast_BlockStmt);
 		if (!pt->is_polymorphic) {
 		if (!pt->is_polymorphic) {
 			check_procedure_later(ctx->checker, ctx->file, e->token, d, proc_type, pl->body, pl->tags);
 			check_procedure_later(ctx->checker, ctx->file, e->token, d, proc_type, pl->body, pl->tags);
 		}
 		}
@@ -640,7 +640,7 @@ void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
 	}
 	}
 }
 }
 
 
-void check_var_decl(CheckerContext *ctx, Entity *e, Entity **entities, isize entity_count, AstNode *type_expr, Array<AstNode *> const &init_expr_list) {
+void check_var_decl(CheckerContext *ctx, Entity *e, Entity **entities, isize entity_count, Ast *type_expr, Array<Ast *> const &init_expr_list) {
 	GB_ASSERT(e->type == nullptr);
 	GB_ASSERT(e->type == nullptr);
 	GB_ASSERT(e->kind == Entity_Variable);
 	GB_ASSERT(e->kind == Entity_Variable);
 
 
@@ -749,16 +749,16 @@ void check_proc_group_decl(CheckerContext *ctx, Entity *pg_entity, DeclInfo *d)
 	ptr_set_init(&entity_set, heap_allocator(), 2*pg->args.count);
 	ptr_set_init(&entity_set, heap_allocator(), 2*pg->args.count);
 
 
 	for_array(i, pg->args) {
 	for_array(i, pg->args) {
-		AstNode *arg = pg->args[i];
+		Ast *arg = pg->args[i];
 		Entity *e = nullptr;
 		Entity *e = nullptr;
 		Operand o = {};
 		Operand o = {};
-		if (arg->kind == AstNode_Ident) {
+		if (arg->kind == Ast_Ident) {
 			e = check_ident(ctx, &o, arg, nullptr, nullptr, true);
 			e = check_ident(ctx, &o, arg, nullptr, nullptr, true);
-		} else if (arg->kind == AstNode_SelectorExpr) {
+		} else if (arg->kind == Ast_SelectorExpr) {
 			e = check_selector(ctx, &o, arg, nullptr);
 			e = check_selector(ctx, &o, arg, nullptr);
 		}
 		}
 		if (e == nullptr) {
 		if (e == nullptr) {
-			error(arg, "Expected a valid entity name in procedure group, got %.*s", LIT(ast_node_strings[arg->kind]));
+			error(arg, "Expected a valid entity name in procedure group, got %.*s", LIT(ast_strings[arg->kind]));
 			continue;
 			continue;
 		}
 		}
 		if (e->kind == Entity_Variable) {
 		if (e->kind == Entity_Variable) {
@@ -919,11 +919,11 @@ void check_entity_decl(CheckerContext *ctx, Entity *e, DeclInfo *d, Type *named_
 
 
 
 
 
 
-void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *type, AstNode *body) {
+void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *type, Ast *body) {
 	if (body == nullptr) {
 	if (body == nullptr) {
 		return;
 		return;
 	}
 	}
-	GB_ASSERT(body->kind == AstNode_BlockStmt);
+	GB_ASSERT(body->kind == Ast_BlockStmt);
 
 
 	String proc_name = {};
 	String proc_name = {};
 	if (token.kind == Token_Ident) {
 	if (token.kind == Token_Ident) {

+ 154 - 154
src/check_expr.cpp

@@ -45,40 +45,40 @@ int valid_index_and_score_cmp(void const *a, void const *b) {
 
 
 
 
 
 
-#define CALL_ARGUMENT_CHECKER(name) CallArgumentError name(CheckerContext *c, AstNode *call, Type *proc_type, Entity *entity, Array<Operand> operands, CallArgumentErrorMode show_error_mode, CallArgumentData *data)
+#define CALL_ARGUMENT_CHECKER(name) CallArgumentError name(CheckerContext *c, Ast *call, Type *proc_type, Entity *entity, Array<Operand> operands, CallArgumentErrorMode show_error_mode, CallArgumentData *data)
 typedef CALL_ARGUMENT_CHECKER(CallArgumentCheckerType);
 typedef CALL_ARGUMENT_CHECKER(CallArgumentCheckerType);
 
 
 
 
 
 
-void     check_expr                     (CheckerContext *c, Operand *operand, AstNode *expression);
-void     check_multi_expr               (CheckerContext *c, Operand *operand, AstNode *expression);
-void     check_expr_or_type             (CheckerContext *c, Operand *operand, AstNode *expression, Type *type_hint = nullptr);
-ExprKind check_expr_base                (CheckerContext *c, Operand *operand, AstNode *expression, Type *type_hint);
-void     check_expr_with_type_hint      (CheckerContext *c, Operand *o, AstNode *e, Type *t);
-Type *   check_type                     (CheckerContext *c, AstNode *expression);
-Type *   check_type_expr                (CheckerContext *c, AstNode *expression, Type *named_type);
+void     check_expr                     (CheckerContext *c, Operand *operand, Ast *expression);
+void     check_multi_expr               (CheckerContext *c, Operand *operand, Ast *expression);
+void     check_expr_or_type             (CheckerContext *c, Operand *operand, Ast *expression, Type *type_hint = nullptr);
+ExprKind check_expr_base                (CheckerContext *c, Operand *operand, Ast *expression, Type *type_hint);
+void     check_expr_with_type_hint      (CheckerContext *c, Operand *o, Ast *e, Type *t);
+Type *   check_type                     (CheckerContext *c, Ast *expression);
+Type *   check_type_expr                (CheckerContext *c, Ast *expression, Type *named_type);
 Type *   make_optional_ok_type          (Type *value);
 Type *   make_optional_ok_type          (Type *value);
-void     check_type_decl                (CheckerContext *c, Entity *e, AstNode *type_expr, Type *def);
-Entity * check_selector                 (CheckerContext *c, Operand *operand, AstNode *node, Type *type_hint);
-Entity * check_ident                    (CheckerContext *c, Operand *o, AstNode *n, Type *named_type, Type *type_hint, bool allow_import_name);
+void     check_type_decl                (CheckerContext *c, Entity *e, Ast *type_expr, Type *def);
+Entity * check_selector                 (CheckerContext *c, Operand *operand, Ast *node, Type *type_hint);
+Entity * check_ident                    (CheckerContext *c, Operand *o, Ast *n, Type *named_type, Type *type_hint, bool allow_import_name);
 Entity * find_polymorphic_struct_entity (CheckerContext *c, Type *original_type, isize param_count, Array<Operand> ordered_operands);
 Entity * find_polymorphic_struct_entity (CheckerContext *c, Type *original_type, isize param_count, Array<Operand> ordered_operands);
 void     check_not_tuple                (CheckerContext *c, Operand *operand);
 void     check_not_tuple                (CheckerContext *c, Operand *operand);
 void     convert_to_typed               (CheckerContext *c, Operand *operand, Type *target_type);
 void     convert_to_typed               (CheckerContext *c, Operand *operand, Type *target_type);
-gbString expr_to_string                 (AstNode *expression);
+gbString expr_to_string                 (Ast *expression);
 void     check_entity_decl              (CheckerContext *c, Entity *e, DeclInfo *decl, Type *named_type);
 void     check_entity_decl              (CheckerContext *c, Entity *e, DeclInfo *decl, Type *named_type);
-void     check_const_decl               (CheckerContext *c, Entity *e, AstNode *type_expr, AstNode *init_expr, Type *named_type);
-void     check_proc_body                (CheckerContext *c, Token token, DeclInfo *decl, Type *type, AstNode *body);
-void     update_expr_type               (CheckerContext *c, AstNode *e, Type *type, bool final);
-bool     check_is_terminating           (AstNode *node);
-bool     check_has_break                (AstNode *stmt, bool implicit);
-void     check_stmt                     (CheckerContext *c, AstNode *node, u32 flags);
-void     check_stmt_list                (CheckerContext *c, Array<AstNode *> const &stmts, u32 flags);
+void     check_const_decl               (CheckerContext *c, Entity *e, Ast *type_expr, Ast *init_expr, Type *named_type);
+void     check_proc_body                (CheckerContext *c, Token token, DeclInfo *decl, Type *type, Ast *body);
+void     update_expr_type               (CheckerContext *c, Ast *e, Type *type, bool final);
+bool     check_is_terminating           (Ast *node);
+bool     check_has_break                (Ast *stmt, bool implicit);
+void     check_stmt                     (CheckerContext *c, Ast *node, u32 flags);
+void     check_stmt_list                (CheckerContext *c, Array<Ast *> const &stmts, u32 flags);
 void     check_init_constant            (CheckerContext *c, Entity *e, Operand *operand);
 void     check_init_constant            (CheckerContext *c, Entity *e, Operand *operand);
 bool     check_representable_as_constant(CheckerContext *c, ExactValue in_value, Type *type, ExactValue *out_value);
 bool     check_representable_as_constant(CheckerContext *c, ExactValue in_value, Type *type, ExactValue *out_value);
-bool     check_procedure_type           (CheckerContext *c, Type *type, AstNode *proc_type_node, Array<Operand> *operands = nullptr);
-void     check_struct_type              (CheckerContext *c, Type *struct_type, AstNode *node, Array<Operand> *poly_operands,
+bool     check_procedure_type           (CheckerContext *c, Type *type, Ast *proc_type_node, Array<Operand> *operands = nullptr);
+void     check_struct_type              (CheckerContext *c, Type *struct_type, Ast *node, Array<Operand> *poly_operands,
                                          Type *named_type = nullptr, Type *original_type_for_poly = nullptr);
                                          Type *named_type = nullptr, Type *original_type_for_poly = nullptr);
-CallArgumentData check_call_arguments   (CheckerContext *c, Operand *operand, Type *proc_type, AstNode *call);
+CallArgumentData check_call_arguments   (CheckerContext *c, Operand *operand, Type *proc_type, Ast *call);
 Type *           check_init_variable    (CheckerContext *c, Entity *e, Operand *operand, String context_name);
 Type *           check_init_variable    (CheckerContext *c, Entity *e, Operand *operand, String context_name);
 
 
 
 
@@ -95,8 +95,8 @@ void error_operand_not_expression(Operand *o) {
 void error_operand_no_value(Operand *o) {
 void error_operand_no_value(Operand *o) {
 	if (o->mode == Addressing_NoValue) {
 	if (o->mode == Addressing_NoValue) {
 		gbString err = expr_to_string(o->expr);
 		gbString err = expr_to_string(o->expr);
-		AstNode *x = unparen_expr(o->expr);
-		if (x->kind == AstNode_CallExpr) {
+		Ast *x = unparen_expr(o->expr);
+		if (x->kind == Ast_CallExpr) {
 			error(o->expr, "'%s' call does not return a value and cannot be used as a value", err);
 			error(o->expr, "'%s' call does not return a value and cannot be used as a value", err);
 		} else {
 		} else {
 			error(o->expr, "'%s' used as a value", err);
 			error(o->expr, "'%s' used as a value", err);
@@ -107,7 +107,7 @@ void error_operand_no_value(Operand *o) {
 }
 }
 
 
 
 
-void check_scope_decls(CheckerContext *c, Array<AstNode *> const &nodes, isize reserve_size) {
+void check_scope_decls(CheckerContext *c, Array<Ast *> const &nodes, isize reserve_size) {
 	Scope *s = c->scope;
 	Scope *s = c->scope;
 	GB_ASSERT(s->package == nullptr);
 	GB_ASSERT(s->package == nullptr);
 
 
@@ -166,7 +166,7 @@ bool check_is_assignable_to_using_subtype(Type *src, Type *dst) {
 }
 }
 
 
 bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_entity, Type *type,
 bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_entity, Type *type,
-                                            Array<Operand> *param_operands, AstNode *poly_def_node, PolyProcData *poly_proc_data) {
+                                            Array<Operand> *param_operands, Ast *poly_def_node, PolyProcData *poly_proc_data) {
 	///////////////////////////////////////////////////////////////////////////////
 	///////////////////////////////////////////////////////////////////////////////
 	//                                                                           //
 	//                                                                           //
 	// TODO CLEANUP(bill): This procedure is very messy and hacky. Clean this!!! //
 	// TODO CLEANUP(bill): This procedure is very messy and hacky. Clean this!!! //
@@ -316,7 +316,7 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
 
 
 
 
 
 
-	AstNode *proc_lit = clone_ast_node(a, old_decl->proc_lit);
+	Ast *proc_lit = clone_ast_node(a, old_decl->proc_lit);
 	ast_node(pl, ProcLit, proc_lit);
 	ast_node(pl, ProcLit, proc_lit);
 	// NOTE(bill): Associate the scope declared above withinth this procedure declaration's type
 	// NOTE(bill): Associate the scope declared above withinth this procedure declaration's type
 	add_scope(&nctx, pl->type, final_proc_type->Proc.scope);
 	add_scope(&nctx, pl->type, final_proc_type->Proc.scope);
@@ -335,7 +335,7 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
 	}
 	}
 
 
 	u64 tags = base_entity->Procedure.tags;
 	u64 tags = base_entity->Procedure.tags;
-	AstNode *ident = clone_ast_node(a, base_entity->identifier);
+	Ast *ident = clone_ast_node(a, base_entity->identifier);
 	Token token = ident->Ident.token;
 	Token token = ident->Ident.token;
 	DeclInfo *d = make_decl_info(nctx.allocator, scope, old_decl->parent);
 	DeclInfo *d = make_decl_info(nctx.allocator, scope, old_decl->parent);
 	d->gen_proc_type = final_proc_type;
 	d->gen_proc_type = final_proc_type;
@@ -390,14 +390,14 @@ bool find_or_generate_polymorphic_procedure(CheckerContext *c, Entity *base_enti
 	return true;
 	return true;
 }
 }
 
 
-bool check_polymorphic_procedure_assignment(CheckerContext *c, Operand *operand, Type *type, AstNode *poly_def_node, PolyProcData *poly_proc_data) {
+bool check_polymorphic_procedure_assignment(CheckerContext *c, Operand *operand, Type *type, Ast *poly_def_node, PolyProcData *poly_proc_data) {
 	if (operand->expr == nullptr) return false;
 	if (operand->expr == nullptr) return false;
 	Entity *base_entity = entity_of_ident(operand->expr);
 	Entity *base_entity = entity_of_ident(operand->expr);
 	if (base_entity == nullptr) return false;
 	if (base_entity == nullptr) return false;
 	return find_or_generate_polymorphic_procedure(c, base_entity, type, nullptr, poly_def_node, poly_proc_data);
 	return find_or_generate_polymorphic_procedure(c, base_entity, type, nullptr, poly_def_node, poly_proc_data);
 }
 }
 
 
-bool find_or_generate_polymorphic_procedure_from_parameters(CheckerContext *c, Entity *base_entity, Array<Operand> *operands, AstNode *poly_def_node, PolyProcData *poly_proc_data) {
+bool find_or_generate_polymorphic_procedure_from_parameters(CheckerContext *c, Entity *base_entity, Array<Operand> *operands, Ast *poly_def_node, PolyProcData *poly_proc_data) {
 	return find_or_generate_polymorphic_procedure(c, base_entity, nullptr, operands, poly_def_node, poly_proc_data);
 	return find_or_generate_polymorphic_procedure(c, base_entity, nullptr, operands, poly_def_node, poly_proc_data);
 }
 }
 
 
@@ -590,8 +590,8 @@ i64 check_distance_between_types(CheckerContext *c, Operand *operand, Type *type
 		}
 		}
 	}
 	}
 
 
-	AstNode *expr = unparen_expr(operand->expr);
-	if (expr != nullptr && expr->kind == AstNode_AutoCast) {
+	Ast *expr = unparen_expr(operand->expr);
+	if (expr != nullptr && expr->kind == Ast_AutoCast) {
 		Operand x = *operand;
 		Operand x = *operand;
 		x.expr = expr->AutoCast.expr;
 		x.expr = expr->AutoCast.expr;
 		bool ok = check_cast_internal(c, &x, type);
 		bool ok = check_cast_internal(c, &x, type);
@@ -940,8 +940,8 @@ bool check_cycle(CheckerContext *c, Entity *curr, bool report) {
 }
 }
 
 
 
 
-Entity *check_ident(CheckerContext *c, Operand *o, AstNode *n, Type *named_type, Type *type_hint, bool allow_import_name) {
-	GB_ASSERT(n->kind == AstNode_Ident);
+Entity *check_ident(CheckerContext *c, Operand *o, Ast *n, Type *named_type, Type *type_hint, bool allow_import_name) {
+	GB_ASSERT(n->kind == Ast_Ident);
 	o->mode = Addressing_Invalid;
 	o->mode = Addressing_Invalid;
 	o->expr = n;
 	o->expr = n;
 	String name = n->Ident.token.string;
 	String name = n->Ident.token.string;
@@ -1381,8 +1381,8 @@ void check_is_expressible(CheckerContext *c, Operand *o, Type *type) {
 
 
 bool check_is_not_addressable(CheckerContext *c, Operand *o) {
 bool check_is_not_addressable(CheckerContext *c, Operand *o) {
 	if (o->mode == Addressing_OptionalOk) {
 	if (o->mode == Addressing_OptionalOk) {
-		AstNode *expr = unselector_expr(o->expr);
-		if (expr->kind != AstNode_TypeAssertion) {
+		Ast *expr = unselector_expr(o->expr);
+		if (expr->kind != Ast_TypeAssertion) {
 			return true;
 			return true;
 		}
 		}
 		ast_node(ta, TypeAssertion, expr);
 		ast_node(ta, TypeAssertion, expr);
@@ -1409,11 +1409,11 @@ bool check_is_not_addressable(CheckerContext *c, Operand *o) {
 	return false;
 	return false;
 }
 }
 
 
-void check_unary_expr(CheckerContext *c, Operand *o, Token op, AstNode *node) {
+void check_unary_expr(CheckerContext *c, Operand *o, Token op, Ast *node) {
 	switch (op.kind) {
 	switch (op.kind) {
 	case Token_And: { // Pointer address
 	case Token_And: { // Pointer address
 		if (check_is_not_addressable(c, o)) {
 		if (check_is_not_addressable(c, o)) {
-			if (ast_node_expect(node, AstNode_UnaryExpr)) {
+			if (ast_node_expect(node, Ast_UnaryExpr)) {
 				ast_node(ue, UnaryExpr, node);
 				ast_node(ue, UnaryExpr, node);
 				gbString str = expr_to_string(ue->expr);
 				gbString str = expr_to_string(ue->expr);
 				error(op, "Cannot take the pointer address of '%s'", str);
 				error(op, "Cannot take the pointer address of '%s'", str);
@@ -1594,8 +1594,8 @@ void check_comparison(CheckerContext *c, Operand *x, Operand *y, TokenKind op) {
 
 
 }
 }
 
 
-void check_shift(CheckerContext *c, Operand *x, Operand *y, AstNode *node) {
-	GB_ASSERT(node->kind == AstNode_BinaryExpr);
+void check_shift(CheckerContext *c, Operand *x, Operand *y, Ast *node) {
+	GB_ASSERT(node->kind == Ast_BinaryExpr);
 	ast_node(be, BinaryExpr, node);
 	ast_node(be, BinaryExpr, node);
 
 
 	ExactValue x_val = {};
 	ExactValue x_val = {};
@@ -1663,7 +1663,7 @@ void check_shift(CheckerContext *c, Operand *x, Operand *y, AstNode *node) {
 			return;
 			return;
 		}
 		}
 
 
-		TokenPos pos = ast_node_token(x->expr).pos;
+		TokenPos pos = ast_token(x->expr).pos;
 		if (x_is_untyped) {
 		if (x_is_untyped) {
 			ExprInfo *info = check_get_expr_info(&c->checker->info, x->expr);
 			ExprInfo *info = check_get_expr_info(&c->checker->info, x->expr);
 			if (info != nullptr) {
 			if (info != nullptr) {
@@ -1693,8 +1693,8 @@ void check_shift(CheckerContext *c, Operand *x, Operand *y, AstNode *node) {
 }
 }
 
 
 
 
-Operand check_ptr_addition(CheckerContext *c, TokenKind op, Operand *ptr, Operand *offset, AstNode *node) {
-	GB_ASSERT(node->kind == AstNode_BinaryExpr);
+Operand check_ptr_addition(CheckerContext *c, TokenKind op, Operand *ptr, Operand *offset, Ast *node) {
+	GB_ASSERT(node->kind == Ast_BinaryExpr);
 	ast_node(be, BinaryExpr, node);
 	ast_node(be, BinaryExpr, node);
 	GB_ASSERT(is_type_pointer(ptr->type));
 	GB_ASSERT(is_type_pointer(ptr->type));
 	GB_ASSERT(is_type_integer(offset->type));
 	GB_ASSERT(is_type_integer(offset->type));
@@ -1933,7 +1933,7 @@ void check_cast(CheckerContext *c, Operand *x, Type *type) {
 	x->type = type;
 	x->type = type;
 }
 }
 
 
-bool check_transmute(CheckerContext *c, AstNode *node, Operand *o, Type *t) {
+bool check_transmute(CheckerContext *c, Ast *node, Operand *o, Type *t) {
 	if (!is_operand_value(*o)) {
 	if (!is_operand_value(*o)) {
 		error(o->expr, "'transmute' can only be applied to values");
 		error(o->expr, "'transmute' can only be applied to values");
 		o->mode = Addressing_Invalid;
 		o->mode = Addressing_Invalid;
@@ -1988,8 +1988,8 @@ bool check_binary_array_expr(CheckerContext *c, Token op, Operand *x, Operand *y
 }
 }
 
 
 
 
-void check_binary_expr(CheckerContext *c, Operand *x, AstNode *node) {
-	GB_ASSERT(node->kind == AstNode_BinaryExpr);
+void check_binary_expr(CheckerContext *c, Operand *x, Ast *node) {
+	GB_ASSERT(node->kind == Ast_BinaryExpr);
 	Operand y_ = {}, *y = &y_;
 	Operand y_ = {}, *y = &y_;
 
 
 	ast_node(be, BinaryExpr, node);
 	ast_node(be, BinaryExpr, node);
@@ -2176,7 +2176,7 @@ void check_binary_expr(CheckerContext *c, Operand *x, AstNode *node) {
 }
 }
 
 
 
 
-void update_expr_type(CheckerContext *c, AstNode *e, Type *type, bool final) {
+void update_expr_type(CheckerContext *c, Ast *e, Type *type, bool final) {
 	ExprInfo *found = check_get_expr_info(&c->checker->info, e);
 	ExprInfo *found = check_get_expr_info(&c->checker->info, e);
 	if (found == nullptr) {
 	if (found == nullptr) {
 		return;
 		return;
@@ -2235,7 +2235,7 @@ void update_expr_type(CheckerContext *c, AstNode *e, Type *type, bool final) {
 	add_type_and_value(&c->checker->info, e, old.mode, type, old.value);
 	add_type_and_value(&c->checker->info, e, old.mode, type, old.value);
 }
 }
 
 
-void update_expr_value(CheckerContext *c, AstNode *e, ExactValue value) {
+void update_expr_value(CheckerContext *c, Ast *e, ExactValue value) {
 	ExprInfo *found = check_get_expr_info(&c->checker->info, e);
 	ExprInfo *found = check_get_expr_info(&c->checker->info, e);
 	if (found) {
 	if (found) {
 		found->value = value;
 		found->value = value;
@@ -2473,7 +2473,7 @@ void convert_to_typed(CheckerContext *c, Operand *operand, Type *target_type) {
 	update_expr_type(c, operand->expr, target_type, true);
 	update_expr_type(c, operand->expr, target_type, true);
 }
 }
 
 
-bool check_index_value(CheckerContext *c, bool open_range, AstNode *index_value, i64 max_count, i64 *value) {
+bool check_index_value(CheckerContext *c, bool open_range, Ast *index_value, i64 max_count, i64 *value) {
 	Operand operand = {Addressing_Invalid};
 	Operand operand = {Addressing_Invalid};
 	check_expr(c, &operand, index_value);
 	check_expr(c, &operand, index_value);
 	if (operand.mode == Addressing_Invalid) {
 	if (operand.mode == Addressing_Invalid) {
@@ -2531,7 +2531,7 @@ bool check_index_value(CheckerContext *c, bool open_range, AstNode *index_value,
 	return true;
 	return true;
 }
 }
 
 
-Entity *check_selector(CheckerContext *c, Operand *operand, AstNode *node, Type *type_hint) {
+Entity *check_selector(CheckerContext *c, Operand *operand, Ast *node, Type *type_hint) {
 	ast_node(se, SelectorExpr, node);
 	ast_node(se, SelectorExpr, node);
 
 
 	bool check_op_expr = true;
 	bool check_op_expr = true;
@@ -2541,30 +2541,30 @@ Entity *check_selector(CheckerContext *c, Operand *operand, AstNode *node, Type
 
 
 	operand->expr = node;
 	operand->expr = node;
 
 
-	AstNode *op_expr  = se->expr;
-	AstNode *selector = unparen_expr(se->selector);
+	Ast *op_expr  = se->expr;
+	Ast *selector = unparen_expr(se->selector);
 	if (selector == nullptr) {
 	if (selector == nullptr) {
 		operand->mode = Addressing_Invalid;
 		operand->mode = Addressing_Invalid;
 		operand->expr = node;
 		operand->expr = node;
 		return nullptr;
 		return nullptr;
 	}
 	}
 
 
-	if (selector->kind != AstNode_Ident) {
-	// if (selector->kind != AstNode_Ident) {
-		error(selector, "Illegal selector kind: '%.*s'", LIT(ast_node_strings[selector->kind]));
+	if (selector->kind != Ast_Ident) {
+	// if (selector->kind != Ast_Ident) {
+		error(selector, "Illegal selector kind: '%.*s'", LIT(ast_strings[selector->kind]));
 		operand->mode = Addressing_Invalid;
 		operand->mode = Addressing_Invalid;
 		operand->expr = node;
 		operand->expr = node;
 		return nullptr;
 		return nullptr;
 	}
 	}
 
 
-	if (op_expr->kind == AstNode_Ident) {
+	if (op_expr->kind == Ast_Ident) {
 		String op_name = op_expr->Ident.token.string;
 		String op_name = op_expr->Ident.token.string;
 		Entity *e = scope_lookup(c->scope, op_name);
 		Entity *e = scope_lookup(c->scope, op_name);
 		add_entity_use(c, op_expr, e);
 		add_entity_use(c, op_expr, e);
 		expr_entity = e;
 		expr_entity = e;
 
 
 		Entity *original_e = e;
 		Entity *original_e = e;
-		if (e != nullptr && e->kind == Entity_ImportName && selector->kind == AstNode_Ident) {
+		if (e != nullptr && e->kind == Entity_ImportName && selector->kind == Ast_Ident) {
 			// IMPORTANT NOTE(bill): This is very sloppy code but it's also very fragile
 			// IMPORTANT NOTE(bill): This is very sloppy code but it's also very fragile
 			// It pretty much needs to be in this order and this way
 			// It pretty much needs to be in this order and this way
 			// If you can clean this up, please do but be really careful
 			// If you can clean this up, please do but be really careful
@@ -2659,7 +2659,7 @@ Entity *check_selector(CheckerContext *c, Operand *operand, AstNode *node, Type
 	}
 	}
 
 
 
 
-	if (entity == nullptr && selector->kind == AstNode_Ident) {
+	if (entity == nullptr && selector->kind == Ast_Ident) {
 		String field_name = selector->Ident.token.string;
 		String field_name = selector->Ident.token.string;
 		if (is_type_dynamic_array(type_deref(operand->type))) {
 		if (is_type_dynamic_array(type_deref(operand->type))) {
 			init_mem_allocator(c->checker);
 			init_mem_allocator(c->checker);
@@ -2749,8 +2749,8 @@ Entity *check_selector(CheckerContext *c, Operand *operand, AstNode *node, Type
 	return entity;
 	return entity;
 }
 }
 
 
-bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call, i32 id) {
-	GB_ASSERT(call->kind == AstNode_CallExpr);
+bool check_builtin_procedure(CheckerContext *c, Operand *operand, Ast *call, i32 id) {
+	GB_ASSERT(call->kind == Ast_CallExpr);
 	ast_node(ce, CallExpr, call);
 	ast_node(ce, CallExpr, call);
 	BuiltinProc *bp = &builtin_procs[id];
 	BuiltinProc *bp = &builtin_procs[id];
 	{
 	{
@@ -2772,7 +2772,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 	}
 	}
 
 
 	if (ce->args.count > 0) {
 	if (ce->args.count > 0) {
-		if (ce->args[0]->kind == AstNode_FieldValue) {
+		if (ce->args[0]->kind == Ast_FieldValue) {
 			error(call, "'field = value' calling is not allowed on built-in procedures");
 			error(call, "'field = value' calling is not allowed on built-in procedures");
 			return false;
 			return false;
 		}
 		}
@@ -2816,12 +2816,12 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 				error(ce->args[0], "'#location' expects either 0 or 1 arguments, got %td", ce->args.count);
 				error(ce->args[0], "'#location' expects either 0 or 1 arguments, got %td", ce->args.count);
 			}
 			}
 			if (ce->args.count > 0) {
 			if (ce->args.count > 0) {
-				AstNode *arg = ce->args[0];
+				Ast *arg = ce->args[0];
 				Entity *e = nullptr;
 				Entity *e = nullptr;
 				Operand o = {};
 				Operand o = {};
-				if (arg->kind == AstNode_Ident) {
+				if (arg->kind == Ast_Ident) {
 					e = check_ident(c, &o, arg, nullptr, nullptr, true);
 					e = check_ident(c, &o, arg, nullptr, nullptr, true);
-				} else if (arg->kind == AstNode_SelectorExpr) {
+				} else if (arg->kind == Ast_SelectorExpr) {
 					e = check_selector(c, &o, arg, nullptr);
 					e = check_selector(c, &o, arg, nullptr);
 				}
 				}
 				if (e == nullptr) {
 				if (e == nullptr) {
@@ -3069,7 +3069,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 			return false;
 			return false;
 		}
 		}
 
 
-		AstNode *capacity = ce->args[1];
+		Ast *capacity = ce->args[1];
 		Operand op = {};
 		Operand op = {};
 		check_expr(c, &op, capacity);
 		check_expr(c, &op, capacity);
 		if (op.mode == Addressing_Invalid) {
 		if (op.mode == Addressing_Invalid) {
@@ -3169,7 +3169,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 
 
 		Type *key = base_type(type)->Map.key;
 		Type *key = base_type(type)->Map.key;
 		Operand x = {Addressing_Invalid};
 		Operand x = {Addressing_Invalid};
-		AstNode *key_node = ce->args[1];
+		Ast *key_node = ce->args[1];
 		Operand op = {};
 		Operand op = {};
 		check_expr(c, &op, key_node);
 		check_expr(c, &op, key_node);
 		if (op.mode == Addressing_Invalid) {
 		if (op.mode == Addressing_Invalid) {
@@ -3245,9 +3245,9 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 			return false;
 			return false;
 		}
 		}
 
 
-		AstNode *field_arg = unparen_expr(ce->args[1]);
+		Ast *field_arg = unparen_expr(ce->args[1]);
 		if (field_arg == nullptr ||
 		if (field_arg == nullptr ||
-		    field_arg->kind != AstNode_Ident) {
+		    field_arg->kind != Ast_Ident) {
 			error(field_arg, "Expected an identifier for field argument");
 			error(field_arg, "Expected an identifier for field argument");
 			return false;
 			return false;
 		}
 		}
@@ -3284,7 +3284,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 
 
 	case BuiltinProc_type_of: {
 	case BuiltinProc_type_of: {
 		// proc type_of(val: Type) -> type(Type)
 		// proc type_of(val: Type) -> type(Type)
-		AstNode *expr = ce->args[0];
+		Ast *expr = ce->args[0];
 		Operand o = {};
 		Operand o = {};
 		check_expr_or_type(c, &o, expr);
 		check_expr_or_type(c, &o, expr);
 
 
@@ -3325,7 +3325,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 
 
 		// NOTE(bill): The type information may not be setup yet
 		// NOTE(bill): The type information may not be setup yet
 		init_core_type_info(c->checker);
 		init_core_type_info(c->checker);
-		AstNode *expr = ce->args[0];
+		Ast *expr = ce->args[0];
 		Operand o = {};
 		Operand o = {};
 		check_expr_or_type(c, &o, expr);
 		check_expr_or_type(c, &o, expr);
 		if (o.mode == Addressing_Invalid) {
 		if (o.mode == Addressing_Invalid) {
@@ -3360,7 +3360,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 
 
 		// NOTE(bill): The type information may not be setup yet
 		// NOTE(bill): The type information may not be setup yet
 		init_core_type_info(c->checker);
 		init_core_type_info(c->checker);
-		AstNode *expr = ce->args[0];
+		Ast *expr = ce->args[0];
 		Operand o = {};
 		Operand o = {};
 		check_expr_or_type(c, &o, expr);
 		check_expr_or_type(c, &o, expr);
 		if (o.mode == Addressing_Invalid) {
 		if (o.mode == Addressing_Invalid) {
@@ -3408,7 +3408,7 @@ bool check_builtin_procedure(CheckerContext *c, Operand *operand, AstNode *call,
 			if (i == 0) {
 			if (i == 0) {
 				continue;
 				continue;
 			}
 			}
-			AstNode *arg = ce->args[i];
+			Ast *arg = ce->args[i];
 			Operand op = {};
 			Operand op = {};
 			check_expr(c, &op, arg);
 			check_expr(c, &op, arg);
 			if (op.mode == Addressing_Invalid) {
 			if (op.mode == Addressing_Invalid) {
@@ -3672,7 +3672,7 @@ break;
 			return false;
 			return false;
 		}
 		}
 
 
-		AstNode *other_arg = ce->args[1];
+		Ast *other_arg = ce->args[1];
 		Operand a = *operand;
 		Operand a = *operand;
 		Operand b = {};
 		Operand b = {};
 		check_expr(c, &b, other_arg);
 		check_expr(c, &b, other_arg);
@@ -3749,7 +3749,7 @@ break;
 			return false;
 			return false;
 		}
 		}
 
 
-		AstNode *other_arg = ce->args[1];
+		Ast *other_arg = ce->args[1];
 		Operand a = *operand;
 		Operand a = *operand;
 		Operand b = {};
 		Operand b = {};
 		check_expr(c, &b, other_arg);
 		check_expr(c, &b, other_arg);
@@ -3871,8 +3871,8 @@ break;
 			return false;
 			return false;
 		}
 		}
 
 
-		AstNode *min_arg = ce->args[1];
-		AstNode *max_arg = ce->args[2];
+		Ast *min_arg = ce->args[1];
+		Ast *max_arg = ce->args[2];
 		Operand x = *operand;
 		Operand x = *operand;
 		Operand y = {};
 		Operand y = {};
 		Operand z = {};
 		Operand z = {};
@@ -3972,7 +3972,7 @@ break;
 			error(ce->args[0], "Expected a type for 'transmute'");
 			error(ce->args[0], "Expected a type for 'transmute'");
 			return false;
 			return false;
 		}
 		}
-		AstNode *expr = ce->args[1];
+		Ast *expr = ce->args[1];
 		Operand *o = operand;
 		Operand *o = operand;
 		check_expr(c, o, expr);
 		check_expr(c, o, expr);
 		if (o->mode == Addressing_Invalid) {
 		if (o->mode == Addressing_Invalid) {
@@ -4040,7 +4040,7 @@ isize add_dependencies_from_unpacking(CheckerContext *c, Entity **lhs, isize lhs
 }
 }
 
 
 
 
-void check_unpack_arguments(CheckerContext *ctx, Entity **lhs, isize lhs_count, Array<Operand> *operands, Array<AstNode *> const &rhs, bool allow_ok, bool *optional_ok_ = nullptr) {
+void check_unpack_arguments(CheckerContext *ctx, Entity **lhs, isize lhs_count, Array<Operand> *operands, Array<Ast *> const &rhs, bool allow_ok, bool *optional_ok_ = nullptr) {
 	bool optional_ok = false;
 	bool optional_ok = false;
 	isize tuple_index = 0;
 	isize tuple_index = 0;
 	for_array(i, rhs) {
 	for_array(i, rhs) {
@@ -4304,13 +4304,13 @@ CALL_ARGUMENT_CHECKER(check_call_arguments_internal) {
 	return err;
 	return err;
 }
 }
 
 
-bool is_call_expr_field_value(AstNodeCallExpr *ce) {
+bool is_call_expr_field_value(AstCallExpr *ce) {
 	GB_ASSERT(ce != nullptr);
 	GB_ASSERT(ce != nullptr);
 
 
 	if (ce->args.count == 0) {
 	if (ce->args.count == 0) {
 		return false;
 		return false;
 	}
 	}
-	return ce->args[0]->kind == AstNode_FieldValue;
+	return ce->args[0]->kind == Ast_FieldValue;
 }
 }
 
 
 isize lookup_procedure_parameter(TypeProc *pt, String parameter_name) {
 isize lookup_procedure_parameter(TypeProc *pt, String parameter_name) {
@@ -4359,9 +4359,9 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
 	defer (array_free(&ordered_operands));
 	defer (array_free(&ordered_operands));
 
 
 	for_array(i, ce->args) {
 	for_array(i, ce->args) {
-		AstNode *arg = ce->args[i];
+		Ast *arg = ce->args[i];
 		ast_node(fv, FieldValue, arg);
 		ast_node(fv, FieldValue, arg);
-		if (fv->field->kind != AstNode_Ident) {
+		if (fv->field->kind != Ast_Ident) {
 			if (show_error) {
 			if (show_error) {
 				gbString expr_str = expr_to_string(fv->field);
 				gbString expr_str = expr_to_string(fv->field);
 				error(arg, "Invalid parameter name '%s' in procedure call", expr_str);
 				error(arg, "Invalid parameter name '%s' in procedure call", expr_str);
@@ -4483,7 +4483,7 @@ CALL_ARGUMENT_CHECKER(check_named_call_arguments) {
 	return err;
 	return err;
 }
 }
 
 
-CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type *proc_type, AstNode *call) {
+CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type *proc_type, Ast *call) {
 	ast_node(ce, CallExpr, call);
 	ast_node(ce, CallExpr, call);
 
 
 	CallArgumentCheckerType *call_checker = check_call_arguments_internal;
 	CallArgumentCheckerType *call_checker = check_call_arguments_internal;
@@ -4497,7 +4497,7 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
 
 
 		operands = array_make<Operand>(heap_allocator(), ce->args.count);
 		operands = array_make<Operand>(heap_allocator(), ce->args.count);
 		for_array(i, ce->args) {
 		for_array(i, ce->args) {
-			AstNode *arg = ce->args[i];
+			Ast *arg = ce->args[i];
 			ast_node(fv, FieldValue, arg);
 			ast_node(fv, FieldValue, arg);
 			check_expr_or_type(c, &operands[i], fv->value);
 			check_expr_or_type(c, &operands[i], fv->value);
 		}
 		}
@@ -4637,9 +4637,9 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
 			}
 			}
 			result_type = t_invalid;
 			result_type = t_invalid;
 		} else {
 		} else {
-			AstNode *ident = operand->expr;
-			while (ident->kind == AstNode_SelectorExpr) {
-				AstNode *s = ident->SelectorExpr.selector;
+			Ast *ident = operand->expr;
+			while (ident->kind == Ast_SelectorExpr) {
+				Ast *s = ident->SelectorExpr.selector;
 				ident = s;
 				ident = s;
 			}
 			}
 
 
@@ -4654,9 +4654,9 @@ CallArgumentData check_call_arguments(CheckerContext *c, Operand *operand, Type
 			return data;
 			return data;
 		}
 		}
 	} else {
 	} else {
-		AstNode *ident = operand->expr;
-		while (ident->kind == AstNode_SelectorExpr) {
-			AstNode *s = ident->SelectorExpr.selector;
+		Ast *ident = operand->expr;
+		while (ident->kind == Ast_SelectorExpr) {
+			Ast *s = ident->SelectorExpr.selector;
 			ident = s;
 			ident = s;
 		}
 		}
 
 
@@ -4694,7 +4694,7 @@ isize lookup_polymorphic_struct_parameter(TypeStruct *st, String parameter_name)
 }
 }
 
 
 
 
-CallArgumentError check_polymorphic_struct_type(CheckerContext *c, Operand *operand, AstNode *call) {
+CallArgumentError check_polymorphic_struct_type(CheckerContext *c, Operand *operand, Ast *call) {
 	ast_node(ce, CallExpr, call);
 	ast_node(ce, CallExpr, call);
 
 
 	Type *original_type = operand->type;
 	Type *original_type = operand->type;
@@ -4714,7 +4714,7 @@ CallArgumentError check_polymorphic_struct_type(CheckerContext *c, Operand *oper
 		named_fields = true;
 		named_fields = true;
 		operands = array_make<Operand>(heap_allocator(), ce->args.count);
 		operands = array_make<Operand>(heap_allocator(), ce->args.count);
 		for_array(i, ce->args) {
 		for_array(i, ce->args) {
-			AstNode *arg = ce->args[i];
+			Ast *arg = ce->args[i];
 			ast_node(fv, FieldValue, arg);
 			ast_node(fv, FieldValue, arg);
 			check_expr_or_type(c, &operands[i], fv->value);
 			check_expr_or_type(c, &operands[i], fv->value);
 		}
 		}
@@ -4742,9 +4742,9 @@ CallArgumentError check_polymorphic_struct_type(CheckerContext *c, Operand *oper
 		ordered_operands = array_make<Operand>(c->allocator, param_count);
 		ordered_operands = array_make<Operand>(c->allocator, param_count);
 
 
 		for_array(i, ce->args) {
 		for_array(i, ce->args) {
-			AstNode *arg = ce->args[i];
+			Ast *arg = ce->args[i];
 			ast_node(fv, FieldValue, arg);
 			ast_node(fv, FieldValue, arg);
-			if (fv->field->kind != AstNode_Ident) {
+			if (fv->field->kind != Ast_Ident) {
 				if (show_error) {
 				if (show_error) {
 					gbString expr_str = expr_to_string(fv->field);
 					gbString expr_str = expr_to_string(fv->field);
 					error(arg, "Invalid parameter name '%s' in polymorphic type call", expr_str);
 					error(arg, "Invalid parameter name '%s' in polymorphic type call", expr_str);
@@ -4867,7 +4867,7 @@ CallArgumentError check_polymorphic_struct_type(CheckerContext *c, Operand *oper
 		String generated_name = make_string_c(expr_to_string(call));
 		String generated_name = make_string_c(expr_to_string(call));
 
 
 		Type *named_type = alloc_type_named(generated_name, nullptr, nullptr);
 		Type *named_type = alloc_type_named(generated_name, nullptr, nullptr);
-		AstNode *node = clone_ast_node(a, st->node);
+		Ast *node = clone_ast_node(a, st->node);
 		Type *struct_type = alloc_type_struct();
 		Type *struct_type = alloc_type_struct();
 		struct_type->Struct.node = node;
 		struct_type->Struct.node = node;
 		struct_type->Struct.polymorphic_parent = original_type;
 		struct_type->Struct.polymorphic_parent = original_type;
@@ -4884,10 +4884,10 @@ CallArgumentError check_polymorphic_struct_type(CheckerContext *c, Operand *oper
 }
 }
 
 
 
 
-ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
+ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *call) {
 	ast_node(ce, CallExpr, call);
 	ast_node(ce, CallExpr, call);
 	if (ce->proc != nullptr &&
 	if (ce->proc != nullptr &&
-	    ce->proc->kind == AstNode_BasicDirective) {
+	    ce->proc->kind == Ast_BasicDirective) {
 		ast_node(bd, BasicDirective, ce->proc);
 		ast_node(bd, BasicDirective, ce->proc);
 		String name = bd->name;
 		String name = bd->name;
 		if (name == "location" || name == "assert") {
 		if (name == "location" || name == "assert") {
@@ -4905,14 +4905,14 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
 
 
 	if (ce->args.count > 0) {
 	if (ce->args.count > 0) {
 		bool fail = false;
 		bool fail = false;
-		bool first_is_field_value = (ce->args[0]->kind == AstNode_FieldValue);
+		bool first_is_field_value = (ce->args[0]->kind == Ast_FieldValue);
 		for_array(i, ce->args) {
 		for_array(i, ce->args) {
-			AstNode *arg = ce->args[i];
+			Ast *arg = ce->args[i];
 			bool mix = false;
 			bool mix = false;
 			if (first_is_field_value) {
 			if (first_is_field_value) {
-				mix = arg->kind != AstNode_FieldValue;
+				mix = arg->kind != Ast_FieldValue;
 			} else {
 			} else {
-				mix = arg->kind == AstNode_FieldValue;
+				mix = arg->kind == Ast_FieldValue;
 			}
 			}
 			if (mix) {
 			if (mix) {
 				error(arg, "Mixture of 'field = value' and value elements in a procedure all is not allowed");
 				error(arg, "Mixture of 'field = value' and value elements in a procedure all is not allowed");
@@ -4929,8 +4929,8 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
 
 
 	if (operand->mode == Addressing_Invalid) {
 	if (operand->mode == Addressing_Invalid) {
 		for_array(i, ce->args) {
 		for_array(i, ce->args) {
-			AstNode *arg = ce->args[i];
-			if (arg->kind == AstNode_FieldValue) {
+			Ast *arg = ce->args[i];
+			if (arg->kind == Ast_FieldValue) {
 				arg = arg->FieldValue.value;
 				arg = arg->FieldValue.value;
 			}
 			}
 			check_expr_base(c, operand, arg, nullptr);
 			check_expr_base(c, operand, arg, nullptr);
@@ -4945,9 +4945,9 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
 		if (is_type_polymorphic_struct(t)) {
 		if (is_type_polymorphic_struct(t)) {
 			auto err = check_polymorphic_struct_type(c, operand, call);
 			auto err = check_polymorphic_struct_type(c, operand, call);
 			if (err == 0) {
 			if (err == 0) {
-				AstNode *ident = operand->expr;
-				while (ident->kind == AstNode_SelectorExpr) {
-					AstNode *s = ident->SelectorExpr.selector;
+				Ast *ident = operand->expr;
+				while (ident->kind == Ast_SelectorExpr) {
+					Ast *s = ident->SelectorExpr.selector;
 					ident = s;
 					ident = s;
 				}
 				}
 				Type *ot = operand->type; GB_ASSERT(ot->kind == Type_Named);
 				Type *ot = operand->type; GB_ASSERT(ot->kind == Type_Named);
@@ -4968,8 +4968,8 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
 			case 0:  error(call, "Missing argument in conversion to '%s'", str);   break;
 			case 0:  error(call, "Missing argument in conversion to '%s'", str);   break;
 			default: error(call, "Too many arguments in conversion to '%s'", str); break;
 			default: error(call, "Too many arguments in conversion to '%s'", str); break;
 			case 1: {
 			case 1: {
-				AstNode *arg = ce->args[0];
-				if (arg->kind == AstNode_FieldValue) {
+				Ast *arg = ce->args[0];
+				if (arg->kind == Ast_FieldValue) {
 					error(call, "'field = value' cannot be used in a type conversion");
 					error(call, "'field = value' cannot be used in a type conversion");
 					arg = arg->FieldValue.value;
 					arg = arg->FieldValue.value;
 					// NOTE(bill): Carry on the cast regardless
 					// NOTE(bill): Carry on the cast regardless
@@ -5000,7 +5000,7 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
 		bool valid_type = (proc_type != nullptr) && is_type_proc(proc_type);
 		bool valid_type = (proc_type != nullptr) && is_type_proc(proc_type);
 		bool valid_mode = is_operand_value(*operand);
 		bool valid_mode = is_operand_value(*operand);
 		if (!valid_type || !valid_mode) {
 		if (!valid_type || !valid_mode) {
-			AstNode *e = operand->expr;
+			Ast *e = operand->expr;
 			gbString str = expr_to_string(e);
 			gbString str = expr_to_string(e);
 			gbString type_str = type_to_string(operand->type);
 			gbString type_str = type_to_string(operand->type);
 			error(e, "Cannot call a non-procedure: '%s' of type '%s'", str, type_str);
 			error(e, "Cannot call a non-procedure: '%s' of type '%s'", str, type_str);
@@ -5061,7 +5061,7 @@ ExprKind check_call_expr(CheckerContext *c, Operand *operand, AstNode *call) {
 }
 }
 
 
 
 
-void check_expr_with_type_hint(CheckerContext *c, Operand *o, AstNode *e, Type *t) {
+void check_expr_with_type_hint(CheckerContext *c, Operand *o, Ast *e, Type *t) {
 	check_expr_base(c, o, e, t);
 	check_expr_base(c, o, e, t);
 	check_not_tuple(c, o);
 	check_not_tuple(c, o);
 	char *err_str = nullptr;
 	char *err_str = nullptr;
@@ -5145,7 +5145,7 @@ bool ternary_compare_types(Type *x, Type *y) {
 	return are_types_identical(x, y);
 	return are_types_identical(x, y);
 }
 }
 
 
-ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node, Type *type_hint) {
+ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type *type_hint) {
 	ExprKind kind = Expr_Stmt;
 	ExprKind kind = Expr_Stmt;
 
 
 	o->mode = Addressing_Invalid;
 	o->mode = Addressing_Invalid;
@@ -5387,9 +5387,9 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 			type = nullptr;
 			type = nullptr;
 
 
 			// [?]Type
 			// [?]Type
-			if (cl->type->kind == AstNode_ArrayType && cl->type->ArrayType.count != nullptr) {
-				AstNode *count = cl->type->ArrayType.count;
-				if (count->kind == AstNode_UnaryExpr &&
+			if (cl->type->kind == Ast_ArrayType && cl->type->ArrayType.count != nullptr) {
+				Ast *count = cl->type->ArrayType.count;
+				if (count->kind == Ast_UnaryExpr &&
 				    count->UnaryExpr.op.kind == Token_Question) {
 				    count->UnaryExpr.op.kind == Token_Question) {
 					type = alloc_type_array(check_type(c, cl->type->ArrayType.elem), -1);
 					type = alloc_type_array(check_type(c, cl->type->ArrayType.elem), -1);
 					is_to_be_determined_array_count = true;
 					is_to_be_determined_array_count = true;
@@ -5452,17 +5452,17 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 					}
 					}
 				}
 				}
 
 
-				if (cl->elems[0]->kind == AstNode_FieldValue) {
+				if (cl->elems[0]->kind == Ast_FieldValue) {
 					bool *fields_visited = gb_alloc_array(c->allocator, bool, field_count);
 					bool *fields_visited = gb_alloc_array(c->allocator, bool, field_count);
 
 
 					for_array(i, cl->elems) {
 					for_array(i, cl->elems) {
-						AstNode *elem = cl->elems[i];
-						if (elem->kind != AstNode_FieldValue) {
+						Ast *elem = cl->elems[i];
+						if (elem->kind != Ast_FieldValue) {
 							error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
 							error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
 							continue;
 							continue;
 						}
 						}
 						ast_node(fv, FieldValue, elem);
 						ast_node(fv, FieldValue, elem);
-						if (fv->field->kind != AstNode_Ident) {
+						if (fv->field->kind != Ast_Ident) {
 							gbString expr_str = expr_to_string(fv->field);
 							gbString expr_str = expr_to_string(fv->field);
 							error(elem, "Invalid field name '%s' in structure literal", expr_str);
 							error(elem, "Invalid field name '%s' in structure literal", expr_str);
 							gb_string_free(expr_str);
 							gb_string_free(expr_str);
@@ -5508,8 +5508,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 
 
 					for_array(index, cl->elems) {
 					for_array(index, cl->elems) {
 						Entity *field = nullptr;
 						Entity *field = nullptr;
-						AstNode *elem = cl->elems[index];
-						if (elem->kind == AstNode_FieldValue) {
+						Ast *elem = cl->elems[index];
+						if (elem->kind == Ast_FieldValue) {
 							seen_field_value = true;
 							seen_field_value = true;
 							// error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
 							// error(elem, "Mixture of 'field = value' and value elements in a literal is not allowed");
 							// continue;
 							// continue;
@@ -5592,13 +5592,13 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 			}
 			}
 
 
 			for (; index < cl->elems.count; index++) {
 			for (; index < cl->elems.count; index++) {
-				AstNode *e = cl->elems[index];
+				Ast *e = cl->elems[index];
 				if (e == nullptr) {
 				if (e == nullptr) {
 					error(node, "Invalid literal element");
 					error(node, "Invalid literal element");
 					continue;
 					continue;
 				}
 				}
 
 
-				if (e->kind == AstNode_FieldValue) {
+				if (e->kind == Ast_FieldValue) {
 					error(e, "'field = value' is only allowed in struct literals");
 					error(e, "'field = value' is only allowed in struct literals");
 					continue;
 					continue;
 				}
 				}
@@ -5640,17 +5640,17 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 			{ // Checker values
 			{ // Checker values
 				Type *field_types[2] = {t_rawptr, t_typeid};
 				Type *field_types[2] = {t_rawptr, t_typeid};
 				isize field_count = 2;
 				isize field_count = 2;
-				if (cl->elems[0]->kind == AstNode_FieldValue) {
+				if (cl->elems[0]->kind == Ast_FieldValue) {
 					bool fields_visited[2] = {};
 					bool fields_visited[2] = {};
 
 
 					for_array(i, cl->elems) {
 					for_array(i, cl->elems) {
-						AstNode *elem = cl->elems[i];
-						if (elem->kind != AstNode_FieldValue) {
+						Ast *elem = cl->elems[i];
+						if (elem->kind != Ast_FieldValue) {
 							error(elem, "Mixture of 'field = value' and value elements in a 'any' literal is not allowed");
 							error(elem, "Mixture of 'field = value' and value elements in a 'any' literal is not allowed");
 							continue;
 							continue;
 						}
 						}
 						ast_node(fv, FieldValue, elem);
 						ast_node(fv, FieldValue, elem);
-						if (fv->field->kind != AstNode_Ident) {
+						if (fv->field->kind != Ast_Ident) {
 							gbString expr_str = expr_to_string(fv->field);
 							gbString expr_str = expr_to_string(fv->field);
 							error(elem, "Invalid field name '%s' in 'any' literal", expr_str);
 							error(elem, "Invalid field name '%s' in 'any' literal", expr_str);
 							gb_string_free(expr_str);
 							gb_string_free(expr_str);
@@ -5681,8 +5681,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 					}
 					}
 				} else {
 				} else {
 					for_array(index, cl->elems) {
 					for_array(index, cl->elems) {
-						AstNode *elem = cl->elems[index];
-						if (elem->kind == AstNode_FieldValue) {
+						Ast *elem = cl->elems[index];
+						if (elem->kind == Ast_FieldValue) {
 							error(elem, "Mixture of 'field = value' and value elements in a 'any' literal is not allowed");
 							error(elem, "Mixture of 'field = value' and value elements in a 'any' literal is not allowed");
 							continue;
 							continue;
 						}
 						}
@@ -5715,8 +5715,8 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 			is_constant = false;
 			is_constant = false;
 			{ // Checker values
 			{ // Checker values
 				for_array(i, cl->elems) {
 				for_array(i, cl->elems) {
-					AstNode *elem = cl->elems[i];
-					if (elem->kind != AstNode_FieldValue) {
+					Ast *elem = cl->elems[i];
+					if (elem->kind != Ast_FieldValue) {
 						error(elem, "Only 'field = value' elements are allowed in a map literal");
 						error(elem, "Only 'field = value' elements are allowed in a map literal");
 						continue;
 						continue;
 					}
 					}
@@ -6067,7 +6067,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 		TokenKind interval_kind = se->interval.kind;
 		TokenKind interval_kind = se->interval.kind;
 
 
 		i64 indices[2] = {};
 		i64 indices[2] = {};
-		AstNode *nodes[2] = {se->low, se->high};
+		Ast *nodes[2] = {se->low, se->high};
 		for (isize i = 0; i < gb_count_of(nodes); i++) {
 		for (isize i = 0; i < gb_count_of(nodes); i++) {
 			i64 index = max_count;
 			i64 index = max_count;
 			if (nodes[i] != nullptr) {
 			if (nodes[i] != nullptr) {
@@ -6128,17 +6128,17 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 		}
 		}
 	case_end;
 	case_end;
 
 
-	case AstNode_TypeType:
-	case AstNode_PolyType:
-	case AstNode_ProcType:
-	case AstNode_PointerType:
-	case AstNode_ArrayType:
-	case AstNode_DynamicArrayType:
-	case AstNode_StructType:
-	case AstNode_UnionType:
-	// case AstNode_RawUnionType:
-	case AstNode_EnumType:
-	case AstNode_MapType:
+	case Ast_TypeType:
+	case Ast_PolyType:
+	case Ast_ProcType:
+	case Ast_PointerType:
+	case Ast_ArrayType:
+	case Ast_DynamicArrayType:
+	case Ast_StructType:
+	case Ast_UnionType:
+	// case Ast_RawUnionType:
+	case Ast_EnumType:
+	case Ast_MapType:
 		o->mode = Addressing_Type;
 		o->mode = Addressing_Type;
 		o->type = check_type(c, node);
 		o->type = check_type(c, node);
 		break;
 		break;
@@ -6149,7 +6149,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, AstNode *node,
 	return kind;
 	return kind;
 }
 }
 
 
-ExprKind check_expr_base(CheckerContext *c, Operand *o, AstNode *node, Type *type_hint) {
+ExprKind check_expr_base(CheckerContext *c, Operand *o, Ast *node, Type *type_hint) {
 	ExprKind kind = check_expr_base_internal(c, o, node, type_hint);
 	ExprKind kind = check_expr_base_internal(c, o, node, type_hint);
 	Type *type = nullptr;
 	Type *type = nullptr;
 	ExactValue value = {ExactValue_Invalid};
 	ExactValue value = {ExactValue_Invalid};
@@ -6179,7 +6179,7 @@ ExprKind check_expr_base(CheckerContext *c, Operand *o, AstNode *node, Type *typ
 
 
 
 
 
 
-void check_multi_expr(CheckerContext *c, Operand *o, AstNode *e) {
+void check_multi_expr(CheckerContext *c, Operand *o, Ast *e) {
 	check_expr_base(c, o, e, nullptr);
 	check_expr_base(c, o, e, nullptr);
 	switch (o->mode) {
 	switch (o->mode) {
 	default:
 	default:
@@ -6207,22 +6207,22 @@ void check_not_tuple(CheckerContext *c, Operand *o) {
 	}
 	}
 }
 }
 
 
-void check_expr(CheckerContext *c, Operand *o, AstNode *e) {
+void check_expr(CheckerContext *c, Operand *o, Ast *e) {
 	check_multi_expr(c, o, e);
 	check_multi_expr(c, o, e);
 	check_not_tuple(c, o);
 	check_not_tuple(c, o);
 }
 }
 
 
 
 
-void check_expr_or_type(CheckerContext *c, Operand *o, AstNode *e, Type *type_hint) {
+void check_expr_or_type(CheckerContext *c, Operand *o, Ast *e, Type *type_hint) {
 	check_expr_base(c, o, e, type_hint);
 	check_expr_base(c, o, e, type_hint);
 	check_not_tuple(c, o);
 	check_not_tuple(c, o);
 	error_operand_no_value(o);
 	error_operand_no_value(o);
 }
 }
 
 
 
 
-gbString write_expr_to_string(gbString str, AstNode *node);
+gbString write_expr_to_string(gbString str, Ast *node);
 
 
-gbString write_struct_fields_to_string(gbString str, Array<AstNode *> const &params) {
+gbString write_struct_fields_to_string(gbString str, Array<Ast *> const &params) {
 	for_array(i, params) {
 	for_array(i, params) {
 		if (i > 0) {
 		if (i > 0) {
 			str = gb_string_appendc(str, ", ");
 			str = gb_string_appendc(str, ", ");
@@ -6245,11 +6245,11 @@ gbString string_append_token(gbString str, Token token) {
 }
 }
 
 
 
 
-gbString write_expr_to_string(gbString str, AstNode *node) {
+gbString write_expr_to_string(gbString str, Ast *node) {
 	if (node == nullptr)
 	if (node == nullptr)
 		return str;
 		return str;
 
 
-	if (is_ast_node_stmt(node)) {
+	if (is_ast_stmt(node)) {
 		GB_ASSERT("stmt passed to write_expr_to_string");
 		GB_ASSERT("stmt passed to write_expr_to_string");
 	}
 	}
 
 
@@ -6423,7 +6423,7 @@ gbString write_expr_to_string(gbString str, AstNode *node) {
 	case_ast_node(at, ArrayType, node);
 	case_ast_node(at, ArrayType, node);
 		str = gb_string_append_rune(str, '[');
 		str = gb_string_append_rune(str, '[');
 		if (at->count != nullptr &&
 		if (at->count != nullptr &&
-		    at->count->kind == AstNode_UnaryExpr &&
+		    at->count->kind == Ast_UnaryExpr &&
 		    at->count->UnaryExpr.op.kind == Token_Question) {
 		    at->count->UnaryExpr.op.kind == Token_Question) {
 			str = gb_string_appendc(str, "?");
 			str = gb_string_appendc(str, "?");
 		} else {
 		} else {
@@ -6457,7 +6457,7 @@ gbString write_expr_to_string(gbString str, AstNode *node) {
 		}
 		}
 
 
 		for_array(i, f->names) {
 		for_array(i, f->names) {
-			AstNode *name = f->names[i];
+			Ast *name = f->names[i];
 			if (i > 0) str = gb_string_appendc(str, ", ");
 			if (i > 0) str = gb_string_appendc(str, ", ");
 			str = write_expr_to_string(str, name);
 			str = write_expr_to_string(str, name);
 		}
 		}
@@ -6533,7 +6533,7 @@ gbString write_expr_to_string(gbString str, AstNode *node) {
 		str = gb_string_appendc(str, "(");
 		str = gb_string_appendc(str, "(");
 
 
 		for_array(i, ce->args) {
 		for_array(i, ce->args) {
-			AstNode *arg = ce->args[i];
+			Ast *arg = ce->args[i];
 			if (i > 0) {
 			if (i > 0) {
 				str = gb_string_appendc(str, ", ");
 				str = gb_string_appendc(str, ", ");
 			}
 			}
@@ -6598,6 +6598,6 @@ gbString write_expr_to_string(gbString str, AstNode *node) {
 	return str;
 	return str;
 }
 }
 
 
-gbString expr_to_string(AstNode *expression) {
+gbString expr_to_string(Ast *expression) {
 	return write_expr_to_string(gb_string_make(heap_allocator(), ""), expression);
 	return write_expr_to_string(gb_string_make(heap_allocator(), ""), expression);
 }
 }

+ 95 - 95
src/check_stmt.cpp

@@ -1,4 +1,4 @@
-void check_stmt_list(CheckerContext *ctx, Array<AstNode *> const &stmts, u32 flags) {
+void check_stmt_list(CheckerContext *ctx, Array<Ast *> const &stmts, u32 flags) {
 	if (stmts.count == 0) {
 	if (stmts.count == 0) {
 		return;
 		return;
 	}
 	}
@@ -12,14 +12,14 @@ void check_stmt_list(CheckerContext *ctx, Array<AstNode *> const &stmts, u32 fla
 
 
 	isize max = stmts.count;
 	isize max = stmts.count;
 	for (isize i = stmts.count-1; i >= 0; i--) {
 	for (isize i = stmts.count-1; i >= 0; i--) {
-		if (stmts[i]->kind != AstNode_EmptyStmt) {
+		if (stmts[i]->kind != Ast_EmptyStmt) {
 			break;
 			break;
 		}
 		}
 		max--;
 		max--;
 	}
 	}
 	for (isize i = 0; i < max; i++) {
 	for (isize i = 0; i < max; i++) {
-		AstNode *n = stmts[i];
-		if (n->kind == AstNode_EmptyStmt) {
+		Ast *n = stmts[i];
+		if (n->kind == Ast_EmptyStmt) {
 			continue;
 			continue;
 		}
 		}
 		u32 new_flags = flags;
 		u32 new_flags = flags;
@@ -29,11 +29,11 @@ void check_stmt_list(CheckerContext *ctx, Array<AstNode *> const &stmts, u32 fla
 
 
 		if (i+1 < max) {
 		if (i+1 < max) {
 			switch (n->kind) {
 			switch (n->kind) {
-			case AstNode_ReturnStmt:
+			case Ast_ReturnStmt:
 				error(n, "Statements after this 'return' are never execu");
 				error(n, "Statements after this 'return' are never execu");
 				break;
 				break;
 
 
-			case AstNode_BranchStmt:
+			case Ast_BranchStmt:
 				error(n, "Statements after this '%.*s' are never executed", LIT(n->BranchStmt.token.string));
 				error(n, "Statements after this '%.*s' are never executed", LIT(n->BranchStmt.token.string));
 				break;
 				break;
 			}
 			}
@@ -43,11 +43,11 @@ void check_stmt_list(CheckerContext *ctx, Array<AstNode *> const &stmts, u32 fla
 	}
 	}
 }
 }
 
 
-bool check_is_terminating_list(Array<AstNode *> const &stmts) {
+bool check_is_terminating_list(Array<Ast *> const &stmts) {
 	// Iterate backwards
 	// Iterate backwards
 	for (isize n = stmts.count-1; n >= 0; n--) {
 	for (isize n = stmts.count-1; n >= 0; n--) {
-		AstNode *stmt = stmts[n];
-		if (stmt->kind != AstNode_EmptyStmt) {
+		Ast *stmt = stmts[n];
+		if (stmt->kind != Ast_EmptyStmt) {
 			return check_is_terminating(stmt);
 			return check_is_terminating(stmt);
 		}
 		}
 	}
 	}
@@ -55,9 +55,9 @@ bool check_is_terminating_list(Array<AstNode *> const &stmts) {
 	return false;
 	return false;
 }
 }
 
 
-bool check_has_break_list(Array<AstNode *> const &stmts, bool implicit) {
+bool check_has_break_list(Array<Ast *> const &stmts, bool implicit) {
 	for_array(i, stmts) {
 	for_array(i, stmts) {
-		AstNode *stmt = stmts[i];
+		Ast *stmt = stmts[i];
 		if (check_has_break(stmt, implicit)) {
 		if (check_has_break(stmt, implicit)) {
 			return true;
 			return true;
 		}
 		}
@@ -66,24 +66,24 @@ bool check_has_break_list(Array<AstNode *> const &stmts, bool implicit) {
 }
 }
 
 
 
 
-bool check_has_break(AstNode *stmt, bool implicit) {
+bool check_has_break(Ast *stmt, bool implicit) {
 	switch (stmt->kind) {
 	switch (stmt->kind) {
-	case AstNode_BranchStmt:
+	case Ast_BranchStmt:
 		if (stmt->BranchStmt.token.kind == Token_break) {
 		if (stmt->BranchStmt.token.kind == Token_break) {
 			return implicit;
 			return implicit;
 		}
 		}
 		break;
 		break;
-	case AstNode_BlockStmt:
+	case Ast_BlockStmt:
 		return check_has_break_list(stmt->BlockStmt.stmts, implicit);
 		return check_has_break_list(stmt->BlockStmt.stmts, implicit);
 
 
-	case AstNode_IfStmt:
+	case Ast_IfStmt:
 		if (check_has_break(stmt->IfStmt.body, implicit) ||
 		if (check_has_break(stmt->IfStmt.body, implicit) ||
 		    (stmt->IfStmt.else_stmt != nullptr && check_has_break(stmt->IfStmt.else_stmt, implicit))) {
 		    (stmt->IfStmt.else_stmt != nullptr && check_has_break(stmt->IfStmt.else_stmt, implicit))) {
 			return true;
 			return true;
 		}
 		}
 		break;
 		break;
 
 
-	case AstNode_CaseClause:
+	case Ast_CaseClause:
 		return check_has_break_list(stmt->CaseClause.stmts, implicit);
 		return check_has_break_list(stmt->CaseClause.stmts, implicit);
 	}
 	}
 
 
@@ -94,7 +94,7 @@ bool check_has_break(AstNode *stmt, bool implicit) {
 
 
 // NOTE(bill): The last expression has to be a 'return' statement
 // NOTE(bill): The last expression has to be a 'return' statement
 // TODO(bill): This is a mild hack and should be probably handled properly
 // TODO(bill): This is a mild hack and should be probably handled properly
-bool check_is_terminating(AstNode *node) {
+bool check_is_terminating(Ast *node) {
 	switch (node->kind) {
 	switch (node->kind) {
 	case_ast_node(rs, ReturnStmt, node);
 	case_ast_node(rs, ReturnStmt, node);
 		return true;
 		return true;
@@ -139,7 +139,7 @@ bool check_is_terminating(AstNode *node) {
 	case_ast_node(ss, SwitchStmt, node);
 	case_ast_node(ss, SwitchStmt, node);
 		bool has_default = false;
 		bool has_default = false;
 		for_array(i, ss->body->BlockStmt.stmts) {
 		for_array(i, ss->body->BlockStmt.stmts) {
-			AstNode *clause = ss->body->BlockStmt.stmts[i];
+			Ast *clause = ss->body->BlockStmt.stmts[i];
 			ast_node(cc, CaseClause, clause);
 			ast_node(cc, CaseClause, clause);
 			if (cc->list.count == 0) {
 			if (cc->list.count == 0) {
 				has_default = true;
 				has_default = true;
@@ -155,7 +155,7 @@ bool check_is_terminating(AstNode *node) {
 	case_ast_node(ss, TypeSwitchStmt, node);
 	case_ast_node(ss, TypeSwitchStmt, node);
 		bool has_default = false;
 		bool has_default = false;
 		for_array(i, ss->body->BlockStmt.stmts) {
 		for_array(i, ss->body->BlockStmt.stmts) {
-			AstNode *clause = ss->body->BlockStmt.stmts[i];
+			Ast *clause = ss->body->BlockStmt.stmts[i];
 			ast_node(cc, CaseClause, clause);
 			ast_node(cc, CaseClause, clause);
 			if (cc->list.count == 0) {
 			if (cc->list.count == 0) {
 				has_default = true;
 				has_default = true;
@@ -186,7 +186,7 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs)
 		return nullptr;
 		return nullptr;
 	}
 	}
 
 
-	AstNode *node = unparen_expr(lhs->expr);
+	Ast *node = unparen_expr(lhs->expr);
 
 
 	// NOTE(bill): Ignore assignments to '_'
 	// NOTE(bill): Ignore assignments to '_'
 	if (is_blank_ident(node)) {
 	if (is_blank_ident(node)) {
@@ -234,7 +234,7 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs)
 			rhs->proc_group = nullptr;
 			rhs->proc_group = nullptr;
 		}
 		}
 	} else {
 	} else {
-		if (node->kind == AstNode_Ident) {
+		if (node->kind == Ast_Ident) {
 			ast_node(i, Ident, node);
 			ast_node(i, Ident, node);
 			e = scope_lookup(ctx->scope, i->token.string);
 			e = scope_lookup(ctx->scope, i->token.string);
 			if (e != nullptr && e->kind == Entity_Variable) {
 			if (e != nullptr && e->kind == Entity_Variable) {
@@ -289,9 +289,9 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs)
 	}
 	}
 
 
 	case Addressing_MapIndex: {
 	case Addressing_MapIndex: {
-		AstNode *ln = unparen_expr(lhs->expr);
-		if (ln->kind == AstNode_IndexExpr) {
-			AstNode *x = ln->IndexExpr.expr;
+		Ast *ln = unparen_expr(lhs->expr);
+		if (ln->kind == Ast_IndexExpr) {
+			Ast *x = ln->IndexExpr.expr;
 			TypeAndValue tav = type_and_value_of_expr(&ctx->checker->info, x);
 			TypeAndValue tav = type_and_value_of_expr(&ctx->checker->info, x);
 			GB_ASSERT(tav.mode != Addressing_Invalid);
 			GB_ASSERT(tav.mode != Addressing_Invalid);
 			if (tav.mode != Addressing_Variable) {
 			if (tav.mode != Addressing_Variable) {
@@ -308,7 +308,7 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs)
 	}
 	}
 
 
 	default: {
 	default: {
-		if (lhs->expr->kind == AstNode_SelectorExpr) {
+		if (lhs->expr->kind == Ast_SelectorExpr) {
 			// NOTE(bill): Extra error checks
 			// NOTE(bill): Extra error checks
 			Operand op_c = {Addressing_Invalid};
 			Operand op_c = {Addressing_Invalid};
 			ast_node(se, SelectorExpr, lhs->expr);
 			ast_node(se, SelectorExpr, lhs->expr);
@@ -342,8 +342,8 @@ Type *check_assignment_variable(CheckerContext *ctx, Operand *lhs, Operand *rhs)
 }
 }
 
 
 
 
-void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags);
-void check_stmt(CheckerContext *ctx, AstNode *node, u32 flags) {
+void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags);
+void check_stmt(CheckerContext *ctx, Ast *node, u32 flags) {
 	u32 prev_stmt_state_flags = ctx->stmt_state_flags;
 	u32 prev_stmt_state_flags = ctx->stmt_state_flags;
 
 
 	if (node->stmt_state_flags != 0) {
 	if (node->stmt_state_flags != 0) {
@@ -368,14 +368,14 @@ void check_stmt(CheckerContext *ctx, AstNode *node, u32 flags) {
 }
 }
 
 
 
 
-void check_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws, u32 flags) {
+void check_when_stmt(CheckerContext *ctx, AstWhenStmt *ws, u32 flags) {
 	Operand operand = {Addressing_Invalid};
 	Operand operand = {Addressing_Invalid};
 	check_expr(ctx, &operand, ws->cond);
 	check_expr(ctx, &operand, ws->cond);
 	if (operand.mode != Addressing_Constant || !is_type_boolean(operand.type)) {
 	if (operand.mode != Addressing_Constant || !is_type_boolean(operand.type)) {
 		error(ws->cond, "Non-constant boolean 'when' condition");
 		error(ws->cond, "Non-constant boolean 'when' condition");
 		return;
 		return;
 	}
 	}
-	if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
+	if (ws->body == nullptr || ws->body->kind != Ast_BlockStmt) {
 		error(ws->cond, "Invalid body for 'when' statement");
 		error(ws->cond, "Invalid body for 'when' statement");
 		return;
 		return;
 	}
 	}
@@ -384,10 +384,10 @@ void check_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws, u32 flags) {
 		check_stmt_list(ctx, ws->body->BlockStmt.stmts, flags);
 		check_stmt_list(ctx, ws->body->BlockStmt.stmts, flags);
 	} else if (ws->else_stmt) {
 	} else if (ws->else_stmt) {
 		switch (ws->else_stmt->kind) {
 		switch (ws->else_stmt->kind) {
-		case AstNode_BlockStmt:
+		case Ast_BlockStmt:
 			check_stmt_list(ctx, ws->else_stmt->BlockStmt.stmts, flags);
 			check_stmt_list(ctx, ws->else_stmt->BlockStmt.stmts, flags);
 			break;
 			break;
-		case AstNode_WhenStmt:
+		case Ast_WhenStmt:
 			check_when_stmt(ctx, &ws->else_stmt->WhenStmt, flags);
 			check_when_stmt(ctx, &ws->else_stmt->WhenStmt, flags);
 			break;
 			break;
 		default:
 		default:
@@ -397,12 +397,12 @@ void check_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws, u32 flags) {
 	}
 	}
 }
 }
 
 
-void check_label(CheckerContext *ctx, AstNode *label) {
+void check_label(CheckerContext *ctx, Ast *label) {
 	if (label == nullptr) {
 	if (label == nullptr) {
 		return;
 		return;
 	}
 	}
 	ast_node(l, Label, label);
 	ast_node(l, Label, label);
-	if (l->name->kind != AstNode_Ident) {
+	if (l->name->kind != Ast_Ident) {
 		error(l->name, "A label's name must be an identifier");
 		error(l->name, "A label's name must be an identifier");
 		return;
 		return;
 	}
 	}
@@ -440,7 +440,7 @@ void check_label(CheckerContext *ctx, AstNode *label) {
 }
 }
 
 
 // Returns 'true' for 'continue', 'false' for 'return'
 // Returns 'true' for 'continue', 'false' for 'return'
-bool check_using_stmt_entity(CheckerContext *ctx, AstNodeUsingStmt *us, AstNode *expr, bool is_selector, Entity *e) {
+bool check_using_stmt_entity(CheckerContext *ctx, AstUsingStmt *us, Ast *expr, bool is_selector, Entity *e) {
 	if (e == nullptr) {
 	if (e == nullptr) {
 		error(us->token, "'using' applied to an unknown entity");
 		error(us->token, "'using' applied to an unknown entity");
 		return true;
 		return true;
@@ -596,11 +596,11 @@ void add_constant_switch_case(CheckerContext *ctx, Map<TypeAndToken> *seen, Oper
 		}
 		}
 	}
 	}
 
 
-	TypeAndToken tap = {operand.type, ast_node_token(operand.expr)};
+	TypeAndToken tap = {operand.type, ast_token(operand.expr)};
 	multi_map_insert(seen, key, tap);
 	multi_map_insert(seen, key, tap);
 }
 }
 
 
-void check_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
+void check_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
 	ast_node(ss, SwitchStmt, node);
 	ast_node(ss, SwitchStmt, node);
 
 
 	Operand x = {};
 	Operand x = {};
@@ -623,21 +623,21 @@ void check_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 		x.value = exact_value_bool(true);
 		x.value = exact_value_bool(true);
 
 
 		Token token  = {};
 		Token token  = {};
-		token.pos    = ast_node_token(ss->body).pos;
+		token.pos    = ast_token(ss->body).pos;
 		token.string = str_lit("true");
 		token.string = str_lit("true");
 
 
-		x.expr = gb_alloc_item(ctx->allocator, AstNode);
-		x.expr->kind = AstNode_Ident;
+		x.expr = gb_alloc_item(ctx->allocator, Ast);
+		x.expr->kind = Ast_Ident;
 		x.expr->Ident.token = token;
 		x.expr->Ident.token = token;
 	}
 	}
 
 
 	// NOTE(bill): Check for multiple defaults
 	// NOTE(bill): Check for multiple defaults
-	AstNode *first_default = nullptr;
+	Ast *first_default = nullptr;
 	ast_node(bs, BlockStmt, ss->body);
 	ast_node(bs, BlockStmt, ss->body);
 	for_array(i, bs->stmts) {
 	for_array(i, bs->stmts) {
-		AstNode *stmt = bs->stmts[i];
-		AstNode *default_stmt = nullptr;
-		if (stmt->kind == AstNode_CaseClause) {
+		Ast *stmt = bs->stmts[i];
+		Ast *default_stmt = nullptr;
+		if (stmt->kind == Ast_CaseClause) {
 			ast_node(cc, CaseClause, stmt);
 			ast_node(cc, CaseClause, stmt);
 			if (cc->list.count == 0) {
 			if (cc->list.count == 0) {
 				default_stmt = stmt;
 				default_stmt = stmt;
@@ -648,7 +648,7 @@ void check_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 
 
 		if (default_stmt != nullptr) {
 		if (default_stmt != nullptr) {
 			if (first_default != nullptr) {
 			if (first_default != nullptr) {
-				TokenPos pos = ast_node_token(first_default).pos;
+				TokenPos pos = ast_token(first_default).pos;
 				error(stmt,
 				error(stmt,
 				           "multiple default clauses\n"
 				           "multiple default clauses\n"
 				           "\tfirst at %.*s(%td:%td)",
 				           "\tfirst at %.*s(%td:%td)",
@@ -673,17 +673,17 @@ void check_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 	defer (map_destroy(&seen));
 	defer (map_destroy(&seen));
 
 
 	for_array(stmt_index, bs->stmts) {
 	for_array(stmt_index, bs->stmts) {
-		AstNode *stmt = bs->stmts[stmt_index];
-		if (stmt->kind != AstNode_CaseClause) {
+		Ast *stmt = bs->stmts[stmt_index];
+		if (stmt->kind != Ast_CaseClause) {
 			// NOTE(bill): error handled by above multiple default checker
 			// NOTE(bill): error handled by above multiple default checker
 			continue;
 			continue;
 		}
 		}
 		ast_node(cc, CaseClause, stmt);
 		ast_node(cc, CaseClause, stmt);
 
 
 		for_array(j, cc->list) {
 		for_array(j, cc->list) {
-			AstNode *expr = unparen_expr(cc->list[j]);
+			Ast *expr = unparen_expr(cc->list[j]);
 
 
-			if (is_ast_node_a_range(expr)) {
+			if (is_ast_range(expr)) {
 				ast_node(ie, BinaryExpr, expr);
 				ast_node(ie, BinaryExpr, expr);
 				Operand lhs = {};
 				Operand lhs = {};
 				Operand rhs = {};
 				Operand rhs = {};
@@ -838,7 +838,7 @@ TypeSwitchKind check_valid_type_switch_type(Type *type) {
 	return TypeSwitch_Invalid;
 	return TypeSwitch_Invalid;
 }
 }
 
 
-void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
+void check_type_switch_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags) {
 	ast_node(ss, TypeSwitchStmt, node);
 	ast_node(ss, TypeSwitchStmt, node);
 	Operand x = {};
 	Operand x = {};
 
 
@@ -848,13 +848,13 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 
 
 	check_label(ctx, ss->label); // TODO(bill): What should the label's "scope" be?
 	check_label(ctx, ss->label); // TODO(bill): What should the label's "scope" be?
 
 
-	if (ss->tag->kind != AstNode_AssignStmt) {
+	if (ss->tag->kind != Ast_AssignStmt) {
 		error(ss->tag, "Expected an 'in' assignment for this type switch statement");
 		error(ss->tag, "Expected an 'in' assignment for this type switch statement");
 		return;
 		return;
 	}
 	}
 
 
 	ast_node(as, AssignStmt, ss->tag);
 	ast_node(as, AssignStmt, ss->tag);
-	Token as_token = ast_node_token(ss->tag);
+	Token as_token = ast_token(ss->tag);
 	if (as->lhs.count != 1) {
 	if (as->lhs.count != 1) {
 		syntax_error(as_token, "Expected 1 name before 'in'");
 		syntax_error(as_token, "Expected 1 name before 'in'");
 		return;
 		return;
@@ -863,8 +863,8 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 		syntax_error(as_token, "Expected 1 expression after 'in'");
 		syntax_error(as_token, "Expected 1 expression after 'in'");
 		return;
 		return;
 	}
 	}
-	AstNode *lhs = as->lhs[0];
-	AstNode *rhs = as->rhs[0];
+	Ast *lhs = as->lhs[0];
+	Ast *rhs = as->rhs[0];
 
 
 	check_expr(ctx, &x, rhs);
 	check_expr(ctx, &x, rhs);
 	check_assignment(ctx, &x, nullptr, str_lit("type switch expression"));
 	check_assignment(ctx, &x, nullptr, str_lit("type switch expression"));
@@ -889,12 +889,12 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 	bool is_ptr = is_type_pointer(x.type);
 	bool is_ptr = is_type_pointer(x.type);
 
 
 	// NOTE(bill): Check for multiple defaults
 	// NOTE(bill): Check for multiple defaults
-	AstNode *first_default = nullptr;
+	Ast *first_default = nullptr;
 	ast_node(bs, BlockStmt, ss->body);
 	ast_node(bs, BlockStmt, ss->body);
 	for_array(i, bs->stmts) {
 	for_array(i, bs->stmts) {
-		AstNode *stmt = bs->stmts[i];
-		AstNode *default_stmt = nullptr;
-		if (stmt->kind == AstNode_CaseClause) {
+		Ast *stmt = bs->stmts[i];
+		Ast *default_stmt = nullptr;
+		if (stmt->kind == Ast_CaseClause) {
 			ast_node(cc, CaseClause, stmt);
 			ast_node(cc, CaseClause, stmt);
 			if (cc->list.count == 0) {
 			if (cc->list.count == 0) {
 				default_stmt = stmt;
 				default_stmt = stmt;
@@ -905,7 +905,7 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 
 
 		if (default_stmt != nullptr) {
 		if (default_stmt != nullptr) {
 			if (first_default != nullptr) {
 			if (first_default != nullptr) {
-				TokenPos pos = ast_node_token(first_default).pos;
+				TokenPos pos = ast_token(first_default).pos;
 				error(stmt,
 				error(stmt,
 				      "Multiple default clauses\n"
 				      "Multiple default clauses\n"
 				      "\tfirst at %.*s(%td:%td)",
 				      "\tfirst at %.*s(%td:%td)",
@@ -916,8 +916,8 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 		}
 		}
 	}
 	}
 
 
-	if (lhs->kind != AstNode_Ident) {
-		error(rhs, "Expected an identifier, got '%.*s'", LIT(ast_node_strings[rhs->kind]));
+	if (lhs->kind != Ast_Ident) {
+		error(rhs, "Expected an identifier, got '%.*s'", LIT(ast_strings[rhs->kind]));
 		return;
 		return;
 	}
 	}
 
 
@@ -926,8 +926,8 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 	defer (ptr_set_destroy(&seen));
 	defer (ptr_set_destroy(&seen));
 
 
 	for_array(i, bs->stmts) {
 	for_array(i, bs->stmts) {
-		AstNode *stmt = bs->stmts[i];
-		if (stmt->kind != AstNode_CaseClause) {
+		Ast *stmt = bs->stmts[i];
+		if (stmt->kind != Ast_CaseClause) {
 			// NOTE(bill): error handled by above multiple default checker
 			// NOTE(bill): error handled by above multiple default checker
 			continue;
 			continue;
 		}
 		}
@@ -938,7 +938,7 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 
 
 		Type *case_type = nullptr;
 		Type *case_type = nullptr;
 		for_array(type_index, cc->list) {
 		for_array(type_index, cc->list) {
-			AstNode *type_expr = cc->list[type_index];
+			Ast *type_expr = cc->list[type_index];
 			if (type_expr != nullptr) { // Otherwise it's a default expression
 			if (type_expr != nullptr) { // Otherwise it's a default expression
 				Operand y = {};
 				Operand y = {};
 				check_expr_or_type(ctx, &y, type_expr);
 				check_expr_or_type(ctx, &y, type_expr);
@@ -1046,7 +1046,7 @@ void check_type_switch_stmt(CheckerContext *ctx, AstNode *node, u32 mod_flags) {
 	}
 	}
 }
 }
 
 
-void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
+void check_stmt_internal(CheckerContext *ctx, Ast *node, u32 flags) {
 	u32 mod_flags = flags & (~Stmt_FallthroughAllowed);
 	u32 mod_flags = flags & (~Stmt_FallthroughAllowed);
 	switch (node->kind) {
 	switch (node->kind) {
 	case_ast_node(_, EmptyStmt, node); case_end;
 	case_ast_node(_, EmptyStmt, node); case_end;
@@ -1070,8 +1070,8 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 			if (kind == Expr_Stmt) {
 			if (kind == Expr_Stmt) {
 				return;
 				return;
 			}
 			}
-			if (operand.expr->kind == AstNode_CallExpr) {
-				AstNodeCallExpr *ce = &operand.expr->CallExpr;
+			if (operand.expr->kind == Ast_CallExpr) {
+				AstCallExpr *ce = &operand.expr->CallExpr;
 				Type *t = type_of_expr(&ctx->checker->info, ce->proc);
 				Type *t = type_of_expr(&ctx->checker->info, ce->proc);
 				if (is_type_proc(t)) {
 				if (is_type_proc(t)) {
 					if (t->Proc.require_results) {
 					if (t->Proc.require_results) {
@@ -1157,7 +1157,7 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 			}
 			}
 			Operand lhs = {Addressing_Invalid};
 			Operand lhs = {Addressing_Invalid};
 			Operand rhs = {Addressing_Invalid};
 			Operand rhs = {Addressing_Invalid};
-			AstNode binary_expr = {AstNode_BinaryExpr};
+			Ast binary_expr = {Ast_BinaryExpr};
 			ast_node(be, BinaryExpr, &binary_expr);
 			ast_node(be, BinaryExpr, &binary_expr);
 			be->op = op;
 			be->op = op;
 			be->op.kind = cast(TokenKind)(cast(i32)be->op.kind - (Token_AddEq - Token_Add));
 			be->op.kind = cast(TokenKind)(cast(i32)be->op.kind - (Token_AddEq - Token_Add));
@@ -1201,8 +1201,8 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 
 
 		if (is->else_stmt != nullptr) {
 		if (is->else_stmt != nullptr) {
 			switch (is->else_stmt->kind) {
 			switch (is->else_stmt->kind) {
-			case AstNode_IfStmt:
-			case AstNode_BlockStmt:
+			case Ast_IfStmt:
+			case Ast_BlockStmt:
 				check_stmt(ctx, is->else_stmt, mod_flags);
 				check_stmt(ctx, is->else_stmt, mod_flags);
 				break;
 				break;
 			default:
 			default:
@@ -1277,8 +1277,8 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 		if (fs->post != nullptr) {
 		if (fs->post != nullptr) {
 			check_stmt(ctx, fs->post, 0);
 			check_stmt(ctx, fs->post, 0);
 
 
-			if (fs->post->kind != AstNode_AssignStmt &&
-			    fs->post->kind != AstNode_IncDecStmt) {
+			if (fs->post->kind != Ast_AssignStmt &&
+			    fs->post->kind != Ast_IncDecStmt) {
 				error(fs->post, "'for' statement post statement must be a simple statement");
 				error(fs->post, "'for' statement post statement must be a simple statement");
 			}
 			}
 		}
 		}
@@ -1299,10 +1299,10 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 		isize entity_count = 0;
 		isize entity_count = 0;
 		bool is_map = false;
 		bool is_map = false;
 
 
-		AstNode *expr = unparen_expr(rs->expr);
+		Ast *expr = unparen_expr(rs->expr);
 
 
 
 
-		if (is_ast_node_a_range(expr)) {
+		if (is_ast_range(expr)) {
 			ast_node(ie, BinaryExpr, expr);
 			ast_node(ie, BinaryExpr, expr);
 			Operand x = {Addressing_Invalid};
 			Operand x = {Addressing_Invalid};
 			Operand y = {Addressing_Invalid};
 			Operand y = {Addressing_Invalid};
@@ -1447,18 +1447,18 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 		}
 		}
 
 
 	skip_expr:; // NOTE(zhiayang): again, declaring a variable immediately after a label... weird.
 	skip_expr:; // NOTE(zhiayang): again, declaring a variable immediately after a label... weird.
-		AstNode *lhs[2] = {rs->val0, rs->val1};
+		Ast *lhs[2] = {rs->val0, rs->val1};
 		Type *   rhs[2] = {val0, val1};
 		Type *   rhs[2] = {val0, val1};
 
 
 		for (isize i = 0; i < 2; i++) {
 		for (isize i = 0; i < 2; i++) {
 			if (lhs[i] == nullptr) {
 			if (lhs[i] == nullptr) {
 				continue;
 				continue;
 			}
 			}
-			AstNode *name = lhs[i];
+			Ast *name = lhs[i];
 			Type *   type = rhs[i];
 			Type *   type = rhs[i];
 
 
 			Entity *entity = nullptr;
 			Entity *entity = nullptr;
-			if (name->kind == AstNode_Ident) {
+			if (name->kind == Ast_Ident) {
 				Token token = name->Ident.token;
 				Token token = name->Ident.token;
 				String str = token.string;
 				String str = token.string;
 				Entity *found = nullptr;
 				Entity *found = nullptr;
@@ -1483,7 +1483,7 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 			}
 			}
 
 
 			if (entity == nullptr) {
 			if (entity == nullptr) {
-				entity = alloc_entity_dummy_variable(universal_scope, ast_node_token(name));
+				entity = alloc_entity_dummy_variable(universal_scope, ast_token(name));
 			}
 			}
 
 
 			entities[entity_count++] = entity;
 			entities[entity_count++] = entity;
@@ -1513,7 +1513,7 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 
 
 
 
 	case_ast_node(ds, DeferStmt, node);
 	case_ast_node(ds, DeferStmt, node);
-		if (is_ast_node_decl(ds->stmt)) {
+		if (is_ast_decl(ds->stmt)) {
 			error(ds->token, "You cannot defer a declaration");
 			error(ds->token, "You cannot defer a declaration");
 		} else {
 		} else {
 			bool out_in_defer = ctx->in_defer;
 			bool out_in_defer = ctx->in_defer;
@@ -1547,11 +1547,11 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 		}
 		}
 
 
 		if (bs->label != nullptr) {
 		if (bs->label != nullptr) {
-			if (bs->label->kind != AstNode_Ident) {
+			if (bs->label->kind != Ast_Ident) {
 				error(bs->label, "A branch statement's label name must be an identifier");
 				error(bs->label, "A branch statement's label name must be an identifier");
 				return;
 				return;
 			}
 			}
-			AstNode *ident = bs->label;
+			Ast *ident = bs->label;
 			String name = ident->Ident.token.string;
 			String name = ident->Ident.token.string;
 			Operand o = {};
 			Operand o = {};
 			Entity *e = check_ident(ctx, &o, ident, nullptr, nullptr, false);
 			Entity *e = check_ident(ctx, &o, ident, nullptr, nullptr, false);
@@ -1574,24 +1574,24 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 			return;
 			return;
 		}
 		}
 		for_array(i, us->list) {
 		for_array(i, us->list) {
-			AstNode *expr = unparen_expr(us->list[0]);
+			Ast *expr = unparen_expr(us->list[0]);
 			Entity *e = nullptr;
 			Entity *e = nullptr;
 
 
 			bool is_selector = false;
 			bool is_selector = false;
 			Operand o = {};
 			Operand o = {};
 			switch (expr->kind) {
 			switch (expr->kind) {
-			case AstNode_Ident:
+			case Ast_Ident:
 				e = check_ident(ctx, &o, expr, nullptr, nullptr, true);
 				e = check_ident(ctx, &o, expr, nullptr, nullptr, true);
 				break;
 				break;
-			case AstNode_SelectorExpr:
+			case Ast_SelectorExpr:
 				e = check_selector(ctx, &o, expr, nullptr);
 				e = check_selector(ctx, &o, expr, nullptr);
 				is_selector = true;
 				is_selector = true;
 				break;
 				break;
-			case AstNode_Implicit:
+			case Ast_Implicit:
 				error(us->token, "'using' applied to an implicit value");
 				error(us->token, "'using' applied to an implicit value");
 				continue;
 				continue;
 			default:
 			default:
-				error(us->token, "'using' can only be applied to an entity, got %.*s", LIT(ast_node_strings[expr->kind]));
+				error(us->token, "'using' can only be applied to an entity, got %.*s", LIT(ast_strings[expr->kind]));
 				continue;
 				continue;
 			}
 			}
 
 
@@ -1609,9 +1609,9 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 	case_end;
 	case_end;
 
 
 	case_ast_node(fb, ForeignBlockDecl, node);
 	case_ast_node(fb, ForeignBlockDecl, node);
-		AstNode *foreign_library = fb->foreign_library;
+		Ast *foreign_library = fb->foreign_library;
 		CheckerContext c = *ctx;
 		CheckerContext c = *ctx;
-		if (foreign_library->kind != AstNode_Ident) {
+		if (foreign_library->kind != Ast_Ident) {
 			error(foreign_library, "foreign library name must be an identifier");
 			error(foreign_library, "foreign library name must be an identifier");
 		} else {
 		} else {
 			c.foreign_context.curr_library = foreign_library;
 			c.foreign_context.curr_library = foreign_library;
@@ -1622,8 +1622,8 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 
 
 		ast_node(block, BlockStmt, fb->body);
 		ast_node(block, BlockStmt, fb->body);
 		for_array(i, block->stmts) {
 		for_array(i, block->stmts) {
-			AstNode *decl = block->stmts[i];
-			if (decl->kind == AstNode_ValueDecl && decl->ValueDecl.is_mutable) {
+			Ast *decl = block->stmts[i];
+			if (decl->kind == Ast_ValueDecl && decl->ValueDecl.is_mutable) {
 				check_stmt(&c, decl, flags);
 				check_stmt(&c, decl, flags);
 			}
 			}
 		}
 		}
@@ -1636,9 +1636,9 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 
 
 			isize new_name_count = 0;
 			isize new_name_count = 0;
 			for_array(i, vd->names) {
 			for_array(i, vd->names) {
-				AstNode *name = vd->names[i];
+				Ast *name = vd->names[i];
 				Entity *entity = nullptr;
 				Entity *entity = nullptr;
-				if (name->kind != AstNode_Ident) {
+				if (name->kind != Ast_Ident) {
 					error(name, "A variable declaration must be an identifier");
 					error(name, "A variable declaration must be an identifier");
 				} else {
 				} else {
 					Token token = name->Ident.token;
 					Token token = name->Ident.token;
@@ -1653,9 +1653,9 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 						entity = alloc_entity_variable(ctx->scope, token, nullptr, false);
 						entity = alloc_entity_variable(ctx->scope, token, nullptr, false);
 						entity->identifier = name;
 						entity->identifier = name;
 
 
-						AstNode *fl = ctx->foreign_context.curr_library;
+						Ast *fl = ctx->foreign_context.curr_library;
 						if (fl != nullptr) {
 						if (fl != nullptr) {
-							GB_ASSERT(fl->kind == AstNode_Ident);
+							GB_ASSERT(fl->kind == Ast_Ident);
 							entity->Variable.is_foreign = true;
 							entity->Variable.is_foreign = true;
 							entity->Variable.foreign_library_ident = fl;
 							entity->Variable.foreign_library_ident = fl;
 						}
 						}
@@ -1669,7 +1669,7 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 					}
 					}
 				}
 				}
 				if (entity == nullptr) {
 				if (entity == nullptr) {
-					entity = alloc_entity_dummy_variable(universal_scope, ast_node_token(name));
+					entity = alloc_entity_dummy_variable(universal_scope, ast_token(name));
 				}
 				}
 				entity->parent_proc_decl = ctx->curr_proc_decl;
 				entity->parent_proc_decl = ctx->curr_proc_decl;
 				entities[entity_count++] = entity;
 				entities[entity_count++] = entity;
@@ -1766,7 +1766,7 @@ void check_stmt_internal(CheckerContext *ctx, AstNode *node, u32 flags) {
 			}
 			}
 
 
 			if (vd->is_using != 0) {
 			if (vd->is_using != 0) {
-				Token token = ast_node_token(node);
+				Token token = ast_token(node);
 				if (vd->type != nullptr && entity_count > 1) {
 				if (vd->type != nullptr && entity_count > 1) {
 					error(token, "'using' can only be applied to one variable of the same type");
 					error(token, "'using' can only be applied to one variable of the same type");
 					// TODO(bill): Should a 'continue' happen here?
 					// TODO(bill): Should a 'continue' happen here?

+ 89 - 89
src/check_type.cpp

@@ -1,5 +1,5 @@
 
 
-void populate_using_entity_scope(CheckerContext *ctx, AstNode *node, Type *t) {
+void populate_using_entity_scope(CheckerContext *ctx, Ast *node, Type *t) {
 	t = base_type(type_deref(t));
 	t = base_type(type_deref(t));
 	gbString str = nullptr;
 	gbString str = nullptr;
 	defer (gb_string_free(str));
 	defer (gb_string_free(str));
@@ -31,16 +31,16 @@ void populate_using_entity_scope(CheckerContext *ctx, AstNode *node, Type *t) {
 
 
 }
 }
 
 
-void check_struct_fields(CheckerContext *ctx, AstNode *node, Array<Entity *> *fields, Array<AstNode *> const &params,
+void check_struct_fields(CheckerContext *ctx, Ast *node, Array<Entity *> *fields, Array<Ast *> const &params,
                          isize init_field_capacity, Type *named_type, String context) {
                          isize init_field_capacity, Type *named_type, String context) {
 	*fields = array_make<Entity *>(heap_allocator(), 0, init_field_capacity);
 	*fields = array_make<Entity *>(heap_allocator(), 0, init_field_capacity);
 
 
-	GB_ASSERT(node->kind == AstNode_StructType);
+	GB_ASSERT(node->kind == Ast_StructType);
 
 
 	isize variable_count = 0;
 	isize variable_count = 0;
 	for_array(i, params) {
 	for_array(i, params) {
-		AstNode *field = params[i];
-		if (ast_node_expect(field, AstNode_Field)) {
+		Ast *field = params[i];
+		if (ast_node_expect(field, Ast_Field)) {
 			ast_node(f, Field, field);
 			ast_node(f, Field, field);
 			variable_count += gb_max(f->names.count, 1);
 			variable_count += gb_max(f->names.count, 1);
 		}
 		}
@@ -48,12 +48,12 @@ void check_struct_fields(CheckerContext *ctx, AstNode *node, Array<Entity *> *fi
 
 
 	i32 field_src_index = 0;
 	i32 field_src_index = 0;
 	for_array(i, params) {
 	for_array(i, params) {
-		AstNode *param = params[i];
-		if (param->kind != AstNode_Field) {
+		Ast *param = params[i];
+		if (param->kind != Ast_Field) {
 			continue;
 			continue;
 		}
 		}
 		ast_node(p, Field, param);
 		ast_node(p, Field, param);
-		AstNode *type_expr = p->type;
+		Ast *type_expr = p->type;
 		Type *type = nullptr;
 		Type *type = nullptr;
 		bool detemine_type_from_operand = false;
 		bool detemine_type_from_operand = false;
 
 
@@ -80,8 +80,8 @@ void check_struct_fields(CheckerContext *ctx, AstNode *node, Array<Entity *> *fi
 		bool is_using = (p->flags&FieldFlag_using) != 0;
 		bool is_using = (p->flags&FieldFlag_using) != 0;
 
 
 		for_array(j, p->names) {
 		for_array(j, p->names) {
-			AstNode *name = p->names[j];
-			if (!ast_node_expect(name, AstNode_Ident)) {
+			Ast *name = p->names[j];
+			if (!ast_node_expect(name, Ast_Ident)) {
 				continue;
 				continue;
 			}
 			}
 
 
@@ -101,7 +101,7 @@ void check_struct_fields(CheckerContext *ctx, AstNode *node, Array<Entity *> *fi
 
 
 			if (!is_type_struct(t) && !is_type_raw_union(t) && !is_type_bit_field(t) &&
 			if (!is_type_struct(t) && !is_type_raw_union(t) && !is_type_bit_field(t) &&
 			    p->names.count >= 1 &&
 			    p->names.count >= 1 &&
-			    p->names[0]->kind == AstNode_Ident) {
+			    p->names[0]->kind == Ast_Ident) {
 				Token name_token = p->names[0]->Ident.token;
 				Token name_token = p->names[0]->Ident.token;
 				gbString type_str = type_to_string(first_type);
 				gbString type_str = type_to_string(first_type);
 				error(name_token, "'using' cannot be applied to the field '%.*s' of type '%s'", LIT(name_token.string), type_str);
 				error(name_token, "'using' cannot be applied to the field '%.*s' of type '%s'", LIT(name_token.string), type_str);
@@ -122,7 +122,7 @@ Entity *make_names_field_for_struct(CheckerContext *ctx, Scope *scope) {
 	return e;
 	return e;
 }
 }
 
 
-bool check_custom_align(CheckerContext *ctx, AstNode *node, i64 *align_) {
+bool check_custom_align(CheckerContext *ctx, Ast *node, i64 *align_) {
 	GB_ASSERT(align_ != nullptr);
 	GB_ASSERT(align_ != nullptr);
 	Operand o = {};
 	Operand o = {};
 	check_expr(ctx, &o, node);
 	check_expr(ctx, &o, node);
@@ -197,18 +197,18 @@ Entity *find_polymorphic_struct_entity(CheckerContext *ctx, Type *original_type,
 }
 }
 
 
 
 
-void add_polymorphic_struct_entity(CheckerContext *ctx, AstNode *node, Type *named_type, Type *original_type) {
+void add_polymorphic_struct_entity(CheckerContext *ctx, Ast *node, Type *named_type, Type *original_type) {
 	GB_ASSERT(is_type_named(named_type));
 	GB_ASSERT(is_type_named(named_type));
 	gbAllocator a = heap_allocator();
 	gbAllocator a = heap_allocator();
 	Scope *s = ctx->scope->parent;
 	Scope *s = ctx->scope->parent;
 
 
 	Entity *e = nullptr;
 	Entity *e = nullptr;
 	{
 	{
-		Token token = ast_node_token(node);
+		Token token = ast_token(node);
 		token.kind = Token_String;
 		token.kind = Token_String;
 		token.string = named_type->Named.name;
 		token.string = named_type->Named.name;
 
 
-		AstNode *node = ast_ident(nullptr, token);
+		Ast *node = ast_ident(nullptr, token);
 
 
 		e = alloc_entity_type_name(s, token, named_type);
 		e = alloc_entity_type_name(s, token, named_type);
 		e->state = EntityState_Resolved;
 		e->state = EntityState_Resolved;
@@ -228,7 +228,7 @@ void add_polymorphic_struct_entity(CheckerContext *ctx, AstNode *node, Type *nam
 	}
 	}
 }
 }
 
 
-void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Array<Operand> *poly_operands, Type *named_type, Type *original_type_for_poly) {
+void check_struct_type(CheckerContext *ctx, Type *struct_type, Ast *node, Array<Operand> *poly_operands, Type *named_type, Type *original_type_for_poly) {
 	GB_ASSERT(is_type_struct(struct_type));
 	GB_ASSERT(is_type_struct(struct_type));
 	ast_node(st, StructType, node);
 	ast_node(st, StructType, node);
 
 
@@ -236,7 +236,7 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar
 
 
 	isize min_field_count = 0;
 	isize min_field_count = 0;
 	for_array(field_index, st->fields) {
 	for_array(field_index, st->fields) {
-	AstNode *field = st->fields[field_index];
+	Ast *field = st->fields[field_index];
 		switch (field->kind) {
 		switch (field->kind) {
 		case_ast_node(f, ValueDecl, field);
 		case_ast_node(f, ValueDecl, field);
 			min_field_count += f->names.count;
 			min_field_count += f->names.count;
@@ -259,12 +259,12 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar
 
 
 	if (st->polymorphic_params != nullptr) {
 	if (st->polymorphic_params != nullptr) {
 		ast_node(field_list, FieldList, st->polymorphic_params);
 		ast_node(field_list, FieldList, st->polymorphic_params);
-		Array<AstNode *> params = field_list->list;
+		Array<Ast *> params = field_list->list;
 		if (params.count != 0) {
 		if (params.count != 0) {
 			isize variable_count = 0;
 			isize variable_count = 0;
 			for_array(i, params) {
 			for_array(i, params) {
-				AstNode *field = params[i];
-				if (ast_node_expect(field, AstNode_Field)) {
+				Ast *field = params[i];
+				if (ast_node_expect(field, Ast_Field)) {
 					ast_node(f, Field, field);
 					ast_node(f, Field, field);
 					variable_count += gb_max(f->names.count, 1);
 					variable_count += gb_max(f->names.count, 1);
 				}
 				}
@@ -273,12 +273,12 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar
 			auto entities = array_make<Entity *>(ctx->allocator, 0, variable_count);
 			auto entities = array_make<Entity *>(ctx->allocator, 0, variable_count);
 
 
 			for_array(i, params) {
 			for_array(i, params) {
-				AstNode *param = params[i];
-				if (param->kind != AstNode_Field) {
+				Ast *param = params[i];
+				if (param->kind != Ast_Field) {
 					continue;
 					continue;
 				}
 				}
 				ast_node(p, Field, param);
 				ast_node(p, Field, param);
-				AstNode *type_expr = p->type;
+				Ast *type_expr = p->type;
 				Type *type = nullptr;
 				Type *type = nullptr;
 				bool is_type_param = false;
 				bool is_type_param = false;
 				bool is_type_polymorphic_type = false;
 				bool is_type_polymorphic_type = false;
@@ -286,15 +286,15 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar
 					error(param, "Expected a type for this parameter");
 					error(param, "Expected a type for this parameter");
 					continue;
 					continue;
 				}
 				}
-				if (type_expr->kind == AstNode_Ellipsis) {
+				if (type_expr->kind == Ast_Ellipsis) {
 					type_expr = type_expr->Ellipsis.expr;
 					type_expr = type_expr->Ellipsis.expr;
 					error(param, "A polymorphic parameter cannot be variadic");
 					error(param, "A polymorphic parameter cannot be variadic");
 				}
 				}
-				if (type_expr->kind == AstNode_TypeType) {
+				if (type_expr->kind == Ast_TypeType) {
 					is_type_param = true;
 					is_type_param = true;
 					Type *specialization = nullptr;
 					Type *specialization = nullptr;
 					if (type_expr->TypeType.specialization != nullptr) {
 					if (type_expr->TypeType.specialization != nullptr) {
-						AstNode *s = type_expr->TypeType.specialization;
+						Ast *s = type_expr->TypeType.specialization;
 						specialization = check_type(ctx, s);
 						specialization = check_type(ctx, s);
 						// if (!is_type_polymorphic_struct(specialization)) {
 						// if (!is_type_polymorphic_struct(specialization)) {
 						// 	gbString str = type_to_string(specialization);
 						// 	gbString str = type_to_string(specialization);
@@ -339,8 +339,8 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar
 
 
 				Scope *scope = ctx->scope;
 				Scope *scope = ctx->scope;
 				for_array(j, p->names) {
 				for_array(j, p->names) {
-					AstNode *name = p->names[j];
-					if (!ast_node_expect(name, AstNode_Ident)) {
+					Ast *name = p->names[j];
+					if (!ast_node_expect(name, Ast_Ident)) {
 						continue;
 						continue;
 					}
 					}
 					Entity *e = nullptr;
 					Entity *e = nullptr;
@@ -431,7 +431,7 @@ void check_struct_type(CheckerContext *ctx, Type *struct_type, AstNode *node, Ar
 		}
 		}
 	}
 	}
 }
 }
-void check_union_type(CheckerContext *ctx, Type *union_type, AstNode *node) {
+void check_union_type(CheckerContext *ctx, Type *union_type, Ast *node) {
 	GB_ASSERT(is_type_union(union_type));
 	GB_ASSERT(is_type_union(union_type));
 	ast_node(ut, UnionType, node);
 	ast_node(ut, UnionType, node);
 
 
@@ -444,7 +444,7 @@ void check_union_type(CheckerContext *ctx, Type *union_type, AstNode *node) {
 	union_type->Union.scope = ctx->scope;
 	union_type->Union.scope = ctx->scope;
 
 
 	for_array(i, ut->variants) {
 	for_array(i, ut->variants) {
-		AstNode *node = ut->variants[i];
+		Ast *node = ut->variants[i];
 		Type *t = check_type_expr(ctx, node, nullptr);
 		Type *t = check_type_expr(ctx, node, nullptr);
 		if (t != nullptr && t != t_invalid) {
 		if (t != nullptr && t != t_invalid) {
 			bool ok = true;
 			bool ok = true;
@@ -485,7 +485,7 @@ void check_union_type(CheckerContext *ctx, Type *union_type, AstNode *node) {
 	}
 	}
 }
 }
 
 
-void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, AstNode *node) {
+void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast *node) {
 	ast_node(et, EnumType, node);
 	ast_node(et, EnumType, node);
 	GB_ASSERT(is_type_enum(enum_type));
 	GB_ASSERT(is_type_enum(enum_type));
 
 
@@ -521,18 +521,18 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast
 	scope_reserve(ctx->scope, et->fields.count);
 	scope_reserve(ctx->scope, et->fields.count);
 
 
 	for_array(i, et->fields) {
 	for_array(i, et->fields) {
-		AstNode *field = et->fields[i];
-		AstNode *ident = nullptr;
-		AstNode *init = nullptr;
-		if (field->kind == AstNode_FieldValue) {
+		Ast *field = et->fields[i];
+		Ast *ident = nullptr;
+		Ast *init = nullptr;
+		if (field->kind == Ast_FieldValue) {
 			ast_node(fv, FieldValue, field);
 			ast_node(fv, FieldValue, field);
-			if (fv->field == nullptr || fv->field->kind != AstNode_Ident) {
+			if (fv->field == nullptr || fv->field->kind != Ast_Ident) {
 				error(field, "An enum field's name must be an identifier");
 				error(field, "An enum field's name must be an identifier");
 				continue;
 				continue;
 			}
 			}
 			ident = fv->field;
 			ident = fv->field;
 			init = fv->value;
 			init = fv->value;
-		} else if (field->kind == AstNode_Ident) {
+		} else if (field->kind == Ast_Ident) {
 			ident = field;
 			ident = field;
 		} else {
 		} else {
 			error(field, "An enum field's name must be an identifier");
 			error(field, "An enum field's name must be an identifier");
@@ -634,7 +634,7 @@ void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *named_type, Ast
 }
 }
 
 
 
 
-void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type, AstNode *node) {
+void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type, Ast *node) {
 	ast_node(bft, BitFieldType, node);
 	ast_node(bft, BitFieldType, node);
 	GB_ASSERT(is_type_bit_field(bit_field_type));
 	GB_ASSERT(is_type_bit_field(bit_field_type));
 
 
@@ -646,12 +646,12 @@ void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type, AstNode *no
 
 
 	u32 curr_offset = 0;
 	u32 curr_offset = 0;
 	for_array(i, bft->fields) {
 	for_array(i, bft->fields) {
-		AstNode *field = bft->fields[i];
-		GB_ASSERT(field->kind == AstNode_FieldValue);
-		AstNode *ident = field->FieldValue.field;
-		AstNode *value = field->FieldValue.value;
+		Ast *field = bft->fields[i];
+		GB_ASSERT(field->kind == Ast_FieldValue);
+		Ast *ident = field->FieldValue.field;
+		Ast *value = field->FieldValue.value;
 
 
-		if (ident->kind != AstNode_Ident) {
+		if (ident->kind != Ast_Ident) {
 			error(field, "A bit field value's name must be an identifier");
 			error(field, "A bit field value's name must be an identifier");
 			continue;
 			continue;
 		}
 		}
@@ -786,7 +786,7 @@ Type *determine_type_from_polymorphic(CheckerContext *ctx, Type *poly_type, Oper
 }
 }
 
 
 
 
-Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool *is_variadic_, isize *variadic_index_, bool *success_, isize *specialization_count_, Array<Operand> *operands) {
+Type *check_get_params(CheckerContext *ctx, Scope *scope, Ast *_params, bool *is_variadic_, isize *variadic_index_, bool *success_, isize *specialization_count_, Array<Operand> *operands) {
 	if (_params == nullptr) {
 	if (_params == nullptr) {
 		return nullptr;
 		return nullptr;
 	}
 	}
@@ -795,7 +795,7 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 
 
 	bool success = true;
 	bool success = true;
 	ast_node(field_list, FieldList, _params);
 	ast_node(field_list, FieldList, _params);
-	Array<AstNode *> params = field_list->list;
+	Array<Ast *> params = field_list->list;
 
 
 	if (params.count == 0) {
 	if (params.count == 0) {
 		if (success_) *success_ = success;
 		if (success_) *success_ = success;
@@ -806,16 +806,16 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 
 
 	isize variable_count = 0;
 	isize variable_count = 0;
 	for_array(i, params) {
 	for_array(i, params) {
-		AstNode *field = params[i];
-		if (ast_node_expect(field, AstNode_Field)) {
+		Ast *field = params[i];
+		if (ast_node_expect(field, Ast_Field)) {
 			ast_node(f, Field, field);
 			ast_node(f, Field, field);
 			variable_count += gb_max(f->names.count, 1);
 			variable_count += gb_max(f->names.count, 1);
 		}
 		}
 	}
 	}
 	isize min_variable_count = variable_count;
 	isize min_variable_count = variable_count;
 	for (isize i = params.count-1; i >= 0; i--) {
 	for (isize i = params.count-1; i >= 0; i--) {
-		AstNode *field = params[i];
-		if (field->kind == AstNode_Field) {
+		Ast *field = params[i];
+		if (field->kind == Ast_Field) {
 			ast_node(f, Field, field);
 			ast_node(f, Field, field);
 			if (f->default_value == nullptr)  {
 			if (f->default_value == nullptr)  {
 				break;
 				break;
@@ -830,14 +830,14 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 	bool is_c_vararg = false;
 	bool is_c_vararg = false;
 	auto variables = array_make<Entity *>(ctx->allocator, 0, variable_count);
 	auto variables = array_make<Entity *>(ctx->allocator, 0, variable_count);
 	for_array(i, params) {
 	for_array(i, params) {
-		AstNode *param = params[i];
-		if (param->kind != AstNode_Field) {
+		Ast *param = params[i];
+		if (param->kind != Ast_Field) {
 			continue;
 			continue;
 		}
 		}
 		ast_node(p, Field, param);
 		ast_node(p, Field, param);
-		AstNode *type_expr = p->type;
+		Ast *type_expr = p->type;
 		Type *type = nullptr;
 		Type *type = nullptr;
-		AstNode *default_value = unparen_expr(p->default_value);
+		Ast *default_value = unparen_expr(p->default_value);
 		ExactValue value = {};
 		ExactValue value = {};
 		bool default_is_nil = false;
 		bool default_is_nil = false;
 		bool default_is_location = false;
 		bool default_is_location = false;
@@ -849,7 +849,7 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 		bool is_using = (p->flags&FieldFlag_using) != 0;
 		bool is_using = (p->flags&FieldFlag_using) != 0;
 
 
 		if (type_expr == nullptr) {
 		if (type_expr == nullptr) {
-			if (default_value->kind == AstNode_BasicDirective &&
+			if (default_value->kind == Ast_BasicDirective &&
 			    default_value->BasicDirective.name == "caller_location") {
 			    default_value->BasicDirective.name == "caller_location") {
 				init_core_source_code_location(ctx->checker);
 				init_core_source_code_location(ctx->checker);
 				default_is_location = true;
 				default_is_location = true;
@@ -860,15 +860,15 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 				if (is_operand_nil(o)) {
 				if (is_operand_nil(o)) {
 					default_is_nil = true;
 					default_is_nil = true;
 				} else if (o.mode != Addressing_Constant) {
 				} else if (o.mode != Addressing_Constant) {
-					if (default_value->kind == AstNode_ProcLit) {
+					if (default_value->kind == Ast_ProcLit) {
 						value = exact_value_procedure(default_value);
 						value = exact_value_procedure(default_value);
 					} else {
 					} else {
 						Entity *e = nullptr;
 						Entity *e = nullptr;
 						if (o.mode == Addressing_Value && is_type_proc(o.type)) {
 						if (o.mode == Addressing_Value && is_type_proc(o.type)) {
 							Operand x = {};
 							Operand x = {};
-							if (default_value->kind == AstNode_Ident) {
+							if (default_value->kind == Ast_Ident) {
 								e = check_ident(ctx, &x, default_value, nullptr, nullptr, false);
 								e = check_ident(ctx, &x, default_value, nullptr, nullptr, false);
-							} else if (default_value->kind == AstNode_SelectorExpr) {
+							} else if (default_value->kind == Ast_SelectorExpr) {
 								e = check_selector(ctx, &x, default_value, nullptr);
 								e = check_selector(ctx, &x, default_value, nullptr);
 							}
 							}
 						}
 						}
@@ -888,7 +888,7 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 				type = default_type(o.type);
 				type = default_type(o.type);
 			}
 			}
 		} else {
 		} else {
-			if (type_expr->kind == AstNode_Ellipsis) {
+			if (type_expr->kind == Ast_Ellipsis) {
 				type_expr = type_expr->Ellipsis.expr;
 				type_expr = type_expr->Ellipsis.expr;
 				#if 1
 				#if 1
 					is_variadic = true;
 					is_variadic = true;
@@ -906,7 +906,7 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 				}
 				}
 				#endif
 				#endif
 			}
 			}
-			if (type_expr->kind == AstNode_TypeType) {
+			if (type_expr->kind == Ast_TypeType) {
 				ast_node(tt, TypeType, type_expr);
 				ast_node(tt, TypeType, type_expr);
 				is_type_param = true;
 				is_type_param = true;
 				specialization = check_type(ctx, tt->specialization);
 				specialization = check_type(ctx, tt->specialization);
@@ -942,12 +942,12 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 			}
 			}
 
 
 			if (default_value != nullptr) {
 			if (default_value != nullptr) {
-				if (type_expr->kind == AstNode_TypeType) {
+				if (type_expr->kind == Ast_TypeType) {
 					error(default_value, "A type parameter may not have a default value");
 					error(default_value, "A type parameter may not have a default value");
 					continue;
 					continue;
 				} else {
 				} else {
 					Operand o = {};
 					Operand o = {};
-					if (default_value->kind == AstNode_BasicDirective &&
+					if (default_value->kind == Ast_BasicDirective &&
 					    default_value->BasicDirective.name == "caller_location") {
 					    default_value->BasicDirective.name == "caller_location") {
 						init_core_source_code_location(ctx->checker);
 						init_core_source_code_location(ctx->checker);
 						default_is_location = true;
 						default_is_location = true;
@@ -959,15 +959,15 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 						if (is_operand_nil(o)) {
 						if (is_operand_nil(o)) {
 							default_is_nil = true;
 							default_is_nil = true;
 						} else if (o.mode != Addressing_Constant) {
 						} else if (o.mode != Addressing_Constant) {
-							if (default_value->kind == AstNode_ProcLit) {
+							if (default_value->kind == Ast_ProcLit) {
 								value = exact_value_procedure(default_value);
 								value = exact_value_procedure(default_value);
 							} else {
 							} else {
 								Entity *e = nullptr;
 								Entity *e = nullptr;
 								if (o.mode == Addressing_Value && is_type_proc(o.type)) {
 								if (o.mode == Addressing_Value && is_type_proc(o.type)) {
 									Operand x = {};
 									Operand x = {};
-									if (default_value->kind == AstNode_Ident) {
+									if (default_value->kind == Ast_Ident) {
 										e = check_ident(ctx, &x, default_value, nullptr, nullptr, false);
 										e = check_ident(ctx, &x, default_value, nullptr, nullptr, false);
-									} else if (default_value->kind == AstNode_SelectorExpr) {
+									} else if (default_value->kind == Ast_SelectorExpr) {
 										e = check_selector(ctx, &x, default_value, nullptr);
 										e = check_selector(ctx, &x, default_value, nullptr);
 									}
 									}
 								}
 								}
@@ -1010,7 +1010,7 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 
 
 		if (p->flags&FieldFlag_c_vararg) {
 		if (p->flags&FieldFlag_c_vararg) {
 			if (p->type == nullptr ||
 			if (p->type == nullptr ||
-			    p->type->kind != AstNode_Ellipsis) {
+			    p->type->kind != Ast_Ellipsis) {
 				error(param, "'#c_vararg' can only be applied to variadic type fields");
 				error(param, "'#c_vararg' can only be applied to variadic type fields");
 				p->flags &= ~FieldFlag_c_vararg; // Remove the flag
 				p->flags &= ~FieldFlag_c_vararg; // Remove the flag
 			} else {
 			} else {
@@ -1031,8 +1031,8 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 		bool is_in = (p->flags&FieldFlag_in) != 0;
 		bool is_in = (p->flags&FieldFlag_in) != 0;
 
 
 		for_array(j, p->names) {
 		for_array(j, p->names) {
-			AstNode *name = p->names[j];
-			if (!ast_node_expect(name, AstNode_Ident)) {
+			Ast *name = p->names[j];
+			if (!ast_node_expect(name, Ast_Ident)) {
 				continue;
 				continue;
 			}
 			}
 
 
@@ -1150,12 +1150,12 @@ Type *check_get_params(CheckerContext *ctx, Scope *scope, AstNode *_params, bool
 	return tuple;
 	return tuple;
 }
 }
 
 
-Type *check_get_results(CheckerContext *ctx, Scope *scope, AstNode *_results) {
+Type *check_get_results(CheckerContext *ctx, Scope *scope, Ast *_results) {
 	if (_results == nullptr) {
 	if (_results == nullptr) {
 		return nullptr;
 		return nullptr;
 	}
 	}
 	ast_node(field_list, FieldList, _results);
 	ast_node(field_list, FieldList, _results);
-	Array<AstNode *> results = field_list->list;
+	Array<Ast *> results = field_list->list;
 
 
 	if (results.count == 0) {
 	if (results.count == 0) {
 		return nullptr;
 		return nullptr;
@@ -1164,8 +1164,8 @@ Type *check_get_results(CheckerContext *ctx, Scope *scope, AstNode *_results) {
 
 
 	isize variable_count = 0;
 	isize variable_count = 0;
 	for_array(i, results) {
 	for_array(i, results) {
-		AstNode *field = results[i];
-		if (ast_node_expect(field, AstNode_Field)) {
+		Ast *field = results[i];
+		if (ast_node_expect(field, Ast_Field)) {
 			ast_node(f, Field, field);
 			ast_node(f, Field, field);
 			variable_count += gb_max(f->names.count, 1);
 			variable_count += gb_max(f->names.count, 1);
 		}
 		}
@@ -1174,7 +1174,7 @@ Type *check_get_results(CheckerContext *ctx, Scope *scope, AstNode *_results) {
 	auto variables = array_make<Entity *>(ctx->allocator, 0, variable_count);
 	auto variables = array_make<Entity *>(ctx->allocator, 0, variable_count);
 	for_array(i, results) {
 	for_array(i, results) {
 		ast_node(field, Field, results[i]);
 		ast_node(field, Field, results[i]);
-		AstNode *default_value = unparen_expr(field->default_value);
+		Ast *default_value = unparen_expr(field->default_value);
 		ExactValue value = {};
 		ExactValue value = {};
 		bool default_is_nil = false;
 		bool default_is_nil = false;
 
 
@@ -1220,7 +1220,7 @@ Type *check_get_results(CheckerContext *ctx, Scope *scope, AstNode *_results) {
 
 
 
 
 		if (field->names.count == 0) {
 		if (field->names.count == 0) {
-			Token token = ast_node_token(field->type);
+			Token token = ast_token(field->type);
 			token.string = str_lit("");
 			token.string = str_lit("");
 			Entity *param = alloc_entity_param(scope, token, type, false, false);
 			Entity *param = alloc_entity_param(scope, token, type, false, false);
 			param->Variable.default_value = value;
 			param->Variable.default_value = value;
@@ -1228,14 +1228,14 @@ Type *check_get_results(CheckerContext *ctx, Scope *scope, AstNode *_results) {
 			array_add(&variables, param);
 			array_add(&variables, param);
 		} else {
 		} else {
 			for_array(j, field->names) {
 			for_array(j, field->names) {
-				Token token = ast_node_token(results[i]);
+				Token token = ast_token(results[i]);
 				if (field->type != nullptr) {
 				if (field->type != nullptr) {
-					token = ast_node_token(field->type);
+					token = ast_token(field->type);
 				}
 				}
 				token.string = str_lit("");
 				token.string = str_lit("");
 
 
-				AstNode *name = field->names[j];
-				if (name->kind != AstNode_Ident) {
+				Ast *name = field->names[j];
+				if (name->kind != Ast_Ident) {
 					error(name, "Expected an identifer for as the field name");
 					error(name, "Expected an identifer for as the field name");
 				} else {
 				} else {
 					token = name->Ident.token;
 					token = name->Ident.token;
@@ -1466,7 +1466,7 @@ bool abi_compat_return_by_value(gbAllocator a, ProcCallingConvention cc, Type *a
 }
 }
 
 
 // NOTE(bill): 'operands' is for generating non generic procedure type
 // NOTE(bill): 'operands' is for generating non generic procedure type
-bool check_procedure_type(CheckerContext *ctx, Type *type, AstNode *proc_type_node, Array<Operand> *operands) {
+bool check_procedure_type(CheckerContext *ctx, Type *type, Ast *proc_type_node, Array<Operand> *operands) {
 	ast_node(pt, ProcType, proc_type_node);
 	ast_node(pt, ProcType, proc_type_node);
 
 
 	if (ctx->polymorphic_scope == nullptr && ctx->allow_polymorphic_types) {
 	if (ctx->polymorphic_scope == nullptr && ctx->allow_polymorphic_types) {
@@ -1572,11 +1572,11 @@ bool check_procedure_type(CheckerContext *ctx, Type *type, AstNode *proc_type_no
 }
 }
 
 
 
 
-i64 check_array_count(CheckerContext *ctx, Operand *o, AstNode *e) {
+i64 check_array_count(CheckerContext *ctx, Operand *o, Ast *e) {
 	if (e == nullptr) {
 	if (e == nullptr) {
 		return 0;
 		return 0;
 	}
 	}
-	if (e->kind == AstNode_UnaryExpr &&
+	if (e->kind == Ast_UnaryExpr &&
 	    e->UnaryExpr.op.kind == Token_Ellipsis) {
 	    e->UnaryExpr.op.kind == Token_Ellipsis) {
 		return -1;
 		return -1;
 	}
 	}
@@ -1641,7 +1641,7 @@ void init_map_entry_type(Type *type) {
 		value: Value;
 		value: Value;
 	}
 	}
 	*/
 	*/
-	AstNode *dummy_node = alloc_ast_node(nullptr, AstNode_Invalid);
+	Ast *dummy_node = alloc_ast_node(nullptr, Ast_Invalid);
 	Scope *s = create_scope(universal_scope, a);
 	Scope *s = create_scope(universal_scope, a);
 
 
 	auto fields = array_make<Entity *>(a, 0, 3);
 	auto fields = array_make<Entity *>(a, 0, 3);
@@ -1676,7 +1676,7 @@ void init_map_internal_types(Type *type) {
 	}
 	}
 	*/
 	*/
 	gbAllocator a = heap_allocator();
 	gbAllocator a = heap_allocator();
-	AstNode *dummy_node = alloc_ast_node(nullptr, AstNode_Invalid);
+	Ast *dummy_node = alloc_ast_node(nullptr, Ast_Invalid);
 	Scope *s = create_scope(universal_scope, a);
 	Scope *s = create_scope(universal_scope, a);
 
 
 	Type *hashes_type  = alloc_type_dynamic_array(t_int);
 	Type *hashes_type  = alloc_type_dynamic_array(t_int);
@@ -1695,7 +1695,7 @@ void init_map_internal_types(Type *type) {
 	type->Map.lookup_result_type    = make_optional_ok_type(value);
 	type->Map.lookup_result_type    = make_optional_ok_type(value);
 }
 }
 
 
-void check_map_type(CheckerContext *ctx, Type *type, AstNode *node) {
+void check_map_type(CheckerContext *ctx, Type *type, Ast *node) {
 	GB_ASSERT(type->kind == Type_Map);
 	GB_ASSERT(type->kind == Type_Map);
 	ast_node(mt, MapType, node);
 	ast_node(mt, MapType, node);
 
 
@@ -1728,7 +1728,7 @@ void check_map_type(CheckerContext *ctx, Type *type, AstNode *node) {
 
 
 
 
 
 
-bool check_type_internal(CheckerContext *ctx, AstNode *e, Type **type, Type *named_type) {
+bool check_type_internal(CheckerContext *ctx, Ast *e, Type **type, Type *named_type) {
 	GB_ASSERT_NOT_NULL(type);
 	GB_ASSERT_NOT_NULL(type);
 	if (e == nullptr) {
 	if (e == nullptr) {
 		*type = t_invalid;
 		*type = t_invalid;
@@ -1792,8 +1792,8 @@ bool check_type_internal(CheckerContext *ctx, AstNode *e, Type **type, Type *nam
 	case_end;
 	case_end;
 
 
 	case_ast_node(pt, PolyType, e);
 	case_ast_node(pt, PolyType, e);
-		AstNode *ident = pt->type;
-		if (ident->kind != AstNode_Ident) {
+		Ast *ident = pt->type;
+		if (ident->kind != Ast_Ident) {
 			error(ident, "Expected an identifier after the $");
 			error(ident, "Expected an identifier after the $");
 			*type = t_invalid;
 			*type = t_invalid;
 			return false;
 			return false;
@@ -1805,7 +1805,7 @@ bool check_type_internal(CheckerContext *ctx, AstNode *e, Type **type, Type *nam
 			CheckerContext c = *ctx;
 			CheckerContext c = *ctx;
 			c.in_polymorphic_specialization = true;
 			c.in_polymorphic_specialization = true;
 
 
-			AstNode *s = pt->specialization;
+			Ast *s = pt->specialization;
 			specific = check_type(&c, s);
 			specific = check_type(&c, s);
 		}
 		}
 		Type *t = alloc_type_generic(ctx->scope, 0, token.string, specific);
 		Type *t = alloc_type_generic(ctx->scope, 0, token.string, specific);
@@ -2009,7 +2009,7 @@ bool check_type_internal(CheckerContext *ctx, AstNode *e, Type **type, Type *nam
 	return false;
 	return false;
 }
 }
 
 
-Type *check_type(CheckerContext *ctx, AstNode *e) {
+Type *check_type(CheckerContext *ctx, Ast *e) {
 	CheckerContext c = *ctx;
 	CheckerContext c = *ctx;
 	c.type_path = new_checker_type_path();
 	c.type_path = new_checker_type_path();
 	defer (destroy_checker_type_path(c.type_path));
 	defer (destroy_checker_type_path(c.type_path));
@@ -2017,7 +2017,7 @@ Type *check_type(CheckerContext *ctx, AstNode *e) {
 	return check_type_expr(&c, e, nullptr);
 	return check_type_expr(&c, e, nullptr);
 }
 }
 
 
-Type *check_type_expr(CheckerContext *ctx, AstNode *e, Type *named_type) {
+Type *check_type_expr(CheckerContext *ctx, Ast *e, Type *named_type) {
 	Type *type = nullptr;
 	Type *type = nullptr;
 	bool ok = check_type_internal(ctx, e, &type, named_type);
 	bool ok = check_type_internal(ctx, e, &type, named_type);
 
 

+ 125 - 125
src/checker.cpp

@@ -1,7 +1,7 @@
 #include "entity.cpp"
 #include "entity.cpp"
 #include "types.cpp"
 #include "types.cpp"
 
 
-void check_expr(CheckerContext *c, Operand *operand, AstNode *expression);
+void check_expr(CheckerContext *c, Operand *operand, Ast *expression);
 
 
 
 
 bool is_operand_value(Operand o) {
 bool is_operand_value(Operand o) {
@@ -165,10 +165,10 @@ void import_graph_node_swap(ImportGraphNode **data, isize i, isize j) {
 }
 }
 
 
 GB_COMPARE_PROC(ast_node_cmp) {
 GB_COMPARE_PROC(ast_node_cmp) {
-	AstNode *x = *cast(AstNode **)a;
-	AstNode *y = *cast(AstNode **)b;
-	Token i = ast_node_token(x);
-	Token j = ast_node_token(y);
+	Ast *x = *cast(Ast **)a;
+	Ast *y = *cast(Ast **)b;
+	Token i = ast_token(x);
+	Token j = ast_token(y);
 	return token_pos_cmp(i.pos, j.pos);
 	return token_pos_cmp(i.pos, j.pos);
 }
 }
 
 
@@ -307,7 +307,7 @@ void destroy_scope(Scope *scope) {
 }
 }
 
 
 
 
-void add_scope(CheckerContext *c, AstNode *node, Scope *scope) {
+void add_scope(CheckerContext *c, Ast *node, Scope *scope) {
 	GB_ASSERT(node != nullptr);
 	GB_ASSERT(node != nullptr);
 	GB_ASSERT(scope != nullptr);
 	GB_ASSERT(scope != nullptr);
 	scope->node = node;
 	scope->node = node;
@@ -315,20 +315,20 @@ void add_scope(CheckerContext *c, AstNode *node, Scope *scope) {
 }
 }
 
 
 
 
-void check_open_scope(CheckerContext *c, AstNode *node) {
+void check_open_scope(CheckerContext *c, Ast *node) {
 	node = unparen_expr(node);
 	node = unparen_expr(node);
-	GB_ASSERT(node->kind == AstNode_Invalid ||
-	          is_ast_node_stmt(node) ||
-	          is_ast_node_type(node));
+	GB_ASSERT(node->kind == Ast_Invalid ||
+	          is_ast_stmt(node) ||
+	          is_ast_type(node));
 	Scope *scope = create_scope(c->scope, c->allocator);
 	Scope *scope = create_scope(c->scope, c->allocator);
 	add_scope(c, node, scope);
 	add_scope(c, node, scope);
 	switch (node->kind) {
 	switch (node->kind) {
-	case AstNode_ProcType:
+	case Ast_ProcType:
 		scope->is_proc = true;
 		scope->is_proc = true;
 		break;
 		break;
-	case AstNode_StructType:
-	case AstNode_EnumType:
-	case AstNode_UnionType:
+	case Ast_StructType:
+	case Ast_EnumType:
+	case Ast_UnionType:
 		scope->is_struct = true;
 		scope->is_struct = true;
 		break;
 		break;
 	}
 	}
@@ -662,26 +662,26 @@ void destroy_checker(Checker *c) {
 }
 }
 
 
 
 
-Entity *entity_of_ident(AstNode *identifier) {
-	if (identifier->kind == AstNode_Ident) {
+Entity *entity_of_ident(Ast *identifier) {
+	if (identifier->kind == Ast_Ident) {
 		return identifier->Ident.entity;
 		return identifier->Ident.entity;
 	}
 	}
 	return nullptr;
 	return nullptr;
 }
 }
 
 
-TypeAndValue type_and_value_of_expr(CheckerInfo *i, AstNode *expr) {
+TypeAndValue type_and_value_of_expr(CheckerInfo *i, Ast *expr) {
 	TypeAndValue result = {};
 	TypeAndValue result = {};
 	TypeAndValue *found = map_get(&i->types, hash_node(expr));
 	TypeAndValue *found = map_get(&i->types, hash_node(expr));
 	if (found) result = *found;
 	if (found) result = *found;
 	return result;
 	return result;
 }
 }
 
 
-Type *type_of_expr(CheckerInfo *i, AstNode *expr) {
+Type *type_of_expr(CheckerInfo *i, Ast *expr) {
 	TypeAndValue tav = type_and_value_of_expr(i, expr);
 	TypeAndValue tav = type_and_value_of_expr(i, expr);
 	if (tav.mode != Addressing_Invalid) {
 	if (tav.mode != Addressing_Invalid) {
 		return tav.type;
 		return tav.type;
 	}
 	}
-	if (expr->kind == AstNode_Ident) {
+	if (expr->kind == Ast_Ident) {
 		Entity *entity = entity_of_ident(expr);
 		Entity *entity = entity_of_ident(expr);
 		if (entity) {
 		if (entity) {
 			return entity->type;
 			return entity->type;
@@ -691,12 +691,12 @@ Type *type_of_expr(CheckerInfo *i, AstNode *expr) {
 	return nullptr;
 	return nullptr;
 }
 }
 
 
-Entity *implicit_entity_of_node(CheckerInfo *i, AstNode *clause) {
+Entity *implicit_entity_of_node(CheckerInfo *i, Ast *clause) {
 	// Entity **found = map_get(&i->implicits, hash_node(clause));
 	// Entity **found = map_get(&i->implicits, hash_node(clause));
 	// if (found != nullptr) {
 	// if (found != nullptr) {
 		// return *found;
 		// return *found;
 	// }
 	// }
-	if (clause->kind == AstNode_CaseClause) {
+	if (clause->kind == Ast_CaseClause) {
 		return clause->CaseClause.implicit_entity;
 		return clause->CaseClause.implicit_entity;
 	}
 	}
 	return nullptr;
 	return nullptr;
@@ -707,15 +707,15 @@ bool is_entity_implicitly_imported(Entity *import_name, Entity *e) {
 }
 }
 
 
 // Will return nullptr if not found
 // Will return nullptr if not found
-Entity *entity_of_node(CheckerInfo *i, AstNode *expr) {
+Entity *entity_of_node(CheckerInfo *i, Ast *expr) {
 	expr = unparen_expr(expr);
 	expr = unparen_expr(expr);
 	switch (expr->kind) {
 	switch (expr->kind) {
 	case_ast_node(ident, Ident, expr);
 	case_ast_node(ident, Ident, expr);
 		return entity_of_ident(expr);
 		return entity_of_ident(expr);
 	case_end;
 	case_end;
 	case_ast_node(se, SelectorExpr, expr);
 	case_ast_node(se, SelectorExpr, expr);
-		AstNode *s = unselector_expr(se->selector);
-		if (s->kind == AstNode_Ident) {
+		Ast *s = unselector_expr(se->selector);
+		if (s->kind == Ast_Ident) {
 			return entity_of_ident(s);
 			return entity_of_ident(s);
 		}
 		}
 	case_end;
 	case_end;
@@ -734,7 +734,7 @@ DeclInfo *decl_info_of_entity(Entity *e) {
 	return nullptr;
 	return nullptr;
 }
 }
 
 
-DeclInfo *decl_info_of_ident(AstNode *ident) {
+DeclInfo *decl_info_of_ident(Ast *ident) {
 	return decl_info_of_entity(entity_of_ident(ident));
 	return decl_info_of_entity(entity_of_ident(ident));
 }
 }
 
 
@@ -745,16 +745,16 @@ AstFile *ast_file_of_filename(CheckerInfo *i, String filename) {
 	}
 	}
 	return nullptr;
 	return nullptr;
 }
 }
-Scope *scope_of_node(AstNode *node) {
+Scope *scope_of_node(Ast *node) {
 	return node->scope;
 	return node->scope;
 }
 }
-ExprInfo *check_get_expr_info(CheckerInfo *i, AstNode *expr) {
+ExprInfo *check_get_expr_info(CheckerInfo *i, Ast *expr) {
 	return map_get(&i->untyped, hash_node(expr));
 	return map_get(&i->untyped, hash_node(expr));
 }
 }
-void check_set_expr_info(CheckerInfo *i, AstNode *expr, ExprInfo info) {
+void check_set_expr_info(CheckerInfo *i, Ast *expr, ExprInfo info) {
 	map_set(&i->untyped, hash_node(expr), info);
 	map_set(&i->untyped, hash_node(expr), info);
 }
 }
-void check_remove_expr_info(CheckerInfo *i, AstNode *expr) {
+void check_remove_expr_info(CheckerInfo *i, Ast *expr) {
 	map_remove(&i->untyped, hash_node(expr));
 	map_remove(&i->untyped, hash_node(expr));
 }
 }
 
 
@@ -794,7 +794,7 @@ isize type_info_index(CheckerInfo *info, Type *type, bool error_on_failure) {
 }
 }
 
 
 
 
-void add_untyped(CheckerInfo *i, AstNode *expression, bool lhs, AddressingMode mode, Type *type, ExactValue value) {
+void add_untyped(CheckerInfo *i, Ast *expression, bool lhs, AddressingMode mode, Type *type, ExactValue value) {
 	if (expression == nullptr) {
 	if (expression == nullptr) {
 		return;
 		return;
 	}
 	}
@@ -807,7 +807,7 @@ void add_untyped(CheckerInfo *i, AstNode *expression, bool lhs, AddressingMode m
 	map_set(&i->untyped, hash_node(expression), make_expr_info(mode, type, value, lhs));
 	map_set(&i->untyped, hash_node(expression), make_expr_info(mode, type, value, lhs));
 }
 }
 
 
-void add_type_and_value(CheckerInfo *i, AstNode *expression, AddressingMode mode, Type *type, ExactValue value) {
+void add_type_and_value(CheckerInfo *i, Ast *expression, AddressingMode mode, Type *type, ExactValue value) {
 	if (expression == nullptr) {
 	if (expression == nullptr) {
 		return;
 		return;
 	}
 	}
@@ -825,9 +825,9 @@ void add_type_and_value(CheckerInfo *i, AstNode *expression, AddressingMode mode
 	map_set(&i->types, hash_node(expression), tv);
 	map_set(&i->types, hash_node(expression), tv);
 }
 }
 
 
-void add_entity_definition(CheckerInfo *i, AstNode *identifier, Entity *entity) {
+void add_entity_definition(CheckerInfo *i, Ast *identifier, Entity *entity) {
 	GB_ASSERT(identifier != nullptr);
 	GB_ASSERT(identifier != nullptr);
-	GB_ASSERT(identifier->kind == AstNode_Ident);
+	GB_ASSERT(identifier->kind == Ast_Ident);
 	if (is_blank_ident(identifier)) {
 	if (is_blank_ident(identifier)) {
 		return;
 		return;
 	}
 	}
@@ -842,7 +842,7 @@ void add_entity_definition(CheckerInfo *i, AstNode *identifier, Entity *entity)
 	array_add(&i->definitions, entity);
 	array_add(&i->definitions, entity);
 }
 }
 
 
-bool add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
+bool add_entity(Checker *c, Scope *scope, Ast *identifier, Entity *entity) {
 	if (scope == nullptr) {
 	if (scope == nullptr) {
 		return false;
 		return false;
 	}
 	}
@@ -883,12 +883,12 @@ bool add_entity(Checker *c, Scope *scope, AstNode *identifier, Entity *entity) {
 	return true;
 	return true;
 }
 }
 
 
-void add_entity_use(CheckerContext *c, AstNode *identifier, Entity *entity) {
+void add_entity_use(CheckerContext *c, Ast *identifier, Entity *entity) {
 	if (entity == nullptr) {
 	if (entity == nullptr) {
 		return;
 		return;
 	}
 	}
 	if (identifier != nullptr) {
 	if (identifier != nullptr) {
-		if (identifier->kind != AstNode_Ident) {
+		if (identifier->kind != Ast_Ident) {
 			return;
 			return;
 		}
 		}
 		if (entity->identifier == nullptr) {
 		if (entity->identifier == nullptr) {
@@ -906,8 +906,8 @@ void add_entity_use(CheckerContext *c, AstNode *identifier, Entity *entity) {
 }
 }
 
 
 
 
-void add_entity_and_decl_info(CheckerContext *c, AstNode *identifier, Entity *e, DeclInfo *d) {
-	GB_ASSERT(identifier->kind == AstNode_Ident);
+void add_entity_and_decl_info(CheckerContext *c, Ast *identifier, Entity *e, DeclInfo *d) {
+	GB_ASSERT(identifier->kind == Ast_Ident);
 	GB_ASSERT(e != nullptr && d != nullptr);
 	GB_ASSERT(e != nullptr && d != nullptr);
 	GB_ASSERT(identifier->Ident.token.string == e->token.string);
 	GB_ASSERT(identifier->Ident.token.string == e->token.string);
 
 
@@ -931,10 +931,10 @@ void add_entity_and_decl_info(CheckerContext *c, AstNode *identifier, Entity *e,
 }
 }
 
 
 
 
-void add_implicit_entity(CheckerContext *c, AstNode *clause, Entity *e) {
+void add_implicit_entity(CheckerContext *c, Ast *clause, Entity *e) {
 	GB_ASSERT(clause != nullptr);
 	GB_ASSERT(clause != nullptr);
 	GB_ASSERT(e != nullptr);
 	GB_ASSERT(e != nullptr);
-	GB_ASSERT(clause->kind == AstNode_CaseClause);
+	GB_ASSERT(clause->kind == Ast_CaseClause);
 	clause->CaseClause.implicit_entity = e;
 	clause->CaseClause.implicit_entity = e;
 }
 }
 
 
@@ -1098,7 +1098,7 @@ void check_procedure_later(Checker *c, ProcInfo info) {
 	array_add(&c->procs_to_check, info);
 	array_add(&c->procs_to_check, info);
 }
 }
 
 
-void check_procedure_later(Checker *c, AstFile *file, Token token, DeclInfo *decl, Type *type, AstNode *body, u64 tags) {
+void check_procedure_later(Checker *c, AstFile *file, Token token, DeclInfo *decl, Type *type, Ast *body, u64 tags) {
 	ProcInfo info = {};
 	ProcInfo info = {};
 	info.file  = file;
 	info.file  = file;
 	info.token = token;
 	info.token = token;
@@ -1798,7 +1798,7 @@ DECL_ATTRIBUTE_PROC(var_decl_attribute) {
 
 
 
 
 
 
-void check_decl_attributes(CheckerContext *c, Array<AstNode *> const &attributes, DeclAttributeProc *proc, AttributeContext *ac) {
+void check_decl_attributes(CheckerContext *c, Array<Ast *> const &attributes, DeclAttributeProc *proc, AttributeContext *ac) {
 	if (attributes.count == 0) return;
 	if (attributes.count == 0) return;
 
 
 	String original_link_prefix = {};
 	String original_link_prefix = {};
@@ -1811,19 +1811,19 @@ void check_decl_attributes(CheckerContext *c, Array<AstNode *> const &attributes
 	defer (string_set_destroy(&set));
 	defer (string_set_destroy(&set));
 
 
 	for_array(i, attributes) {
 	for_array(i, attributes) {
-		AstNode *attr = attributes[i];
-		if (attr->kind != AstNode_Attribute) continue;
+		Ast *attr = attributes[i];
+		if (attr->kind != Ast_Attribute) continue;
 		for_array(j, attr->Attribute.elems) {
 		for_array(j, attr->Attribute.elems) {
-			AstNode *elem = attr->Attribute.elems[j];
+			Ast *elem = attr->Attribute.elems[j];
 			String name = {};
 			String name = {};
-			AstNode *value = nullptr;
+			Ast *value = nullptr;
 
 
 			switch (elem->kind) {
 			switch (elem->kind) {
 			case_ast_node(i, Ident, elem);
 			case_ast_node(i, Ident, elem);
 				name = i->token.string;
 				name = i->token.string;
 			case_end;
 			case_end;
 			case_ast_node(fv, FieldValue, elem);
 			case_ast_node(fv, FieldValue, elem);
-				GB_ASSERT(fv->field->kind == AstNode_Ident);
+				GB_ASSERT(fv->field->kind == Ast_Ident);
 				name = fv->field->Ident.token.string;
 				name = fv->field->Ident.token.string;
 				value = fv->value;
 				value = fv->value;
 			case_end;
 			case_end;
@@ -1869,7 +1869,7 @@ void check_decl_attributes(CheckerContext *c, Array<AstNode *> const &attributes
 }
 }
 
 
 
 
-bool check_arity_match(CheckerContext *c, AstNodeValueDecl *vd, bool is_global) {
+bool check_arity_match(CheckerContext *c, AstValueDecl *vd, bool is_global) {
 	isize lhs = vd->names.count;
 	isize lhs = vd->names.count;
 	isize rhs = vd->values.count;
 	isize rhs = vd->values.count;
 
 
@@ -1880,7 +1880,7 @@ bool check_arity_match(CheckerContext *c, AstNodeValueDecl *vd, bool is_global)
 		}
 		}
 	} else if (lhs < rhs) {
 	} else if (lhs < rhs) {
 		if (lhs < vd->values.count) {
 		if (lhs < vd->values.count) {
-			AstNode *n = vd->values[lhs];
+			Ast *n = vd->values[lhs];
 			gbString str = expr_to_string(n);
 			gbString str = expr_to_string(n);
 			error(n, "Extra initial expression '%s'", str);
 			error(n, "Extra initial expression '%s'", str);
 			gb_string_free(str);
 			gb_string_free(str);
@@ -1890,13 +1890,13 @@ bool check_arity_match(CheckerContext *c, AstNodeValueDecl *vd, bool is_global)
 		return false;
 		return false;
 	} else if (lhs > rhs) {
 	} else if (lhs > rhs) {
 		if (!is_global && rhs != 1) {
 		if (!is_global && rhs != 1) {
-			AstNode *n = vd->names[rhs];
+			Ast *n = vd->names[rhs];
 			gbString str = expr_to_string(n);
 			gbString str = expr_to_string(n);
 			error(n, "Missing expression for '%s'", str);
 			error(n, "Missing expression for '%s'", str);
 			gb_string_free(str);
 			gb_string_free(str);
 			return false;
 			return false;
 		} else if (is_global) {
 		} else if (is_global) {
-			AstNode *n = vd->values[rhs-1];
+			Ast *n = vd->values[rhs-1];
 			error(n, "Expected %td expressions on the right hand side, got %td", lhs, rhs);
 			error(n, "Expected %td expressions on the right hand side, got %td", lhs, rhs);
 			return false;
 			return false;
 		}
 		}
@@ -1905,7 +1905,7 @@ bool check_arity_match(CheckerContext *c, AstNodeValueDecl *vd, bool is_global)
 	return true;
 	return true;
 }
 }
 
 
-void check_collect_entities_from_when_stmt(CheckerContext *c, AstNodeWhenStmt *ws) {
+void check_collect_entities_from_when_stmt(CheckerContext *c, AstWhenStmt *ws) {
 	Operand operand = {Addressing_Invalid};
 	Operand operand = {Addressing_Invalid};
 	if (!ws->is_cond_determined) {
 	if (!ws->is_cond_determined) {
 		check_expr(c, &operand, ws->cond);
 		check_expr(c, &operand, ws->cond);
@@ -1920,17 +1920,17 @@ void check_collect_entities_from_when_stmt(CheckerContext *c, AstNodeWhenStmt *w
 		ws->determined_cond = operand.value.kind == ExactValue_Bool && operand.value.value_bool;
 		ws->determined_cond = operand.value.kind == ExactValue_Bool && operand.value.value_bool;
 	}
 	}
 
 
-	if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
+	if (ws->body == nullptr || ws->body->kind != Ast_BlockStmt) {
 		error(ws->cond, "Invalid body for 'when' statement");
 		error(ws->cond, "Invalid body for 'when' statement");
 	} else {
 	} else {
 		if (ws->determined_cond) {
 		if (ws->determined_cond) {
 			check_collect_entities(c, ws->body->BlockStmt.stmts);
 			check_collect_entities(c, ws->body->BlockStmt.stmts);
 		} else if (ws->else_stmt) {
 		} else if (ws->else_stmt) {
 			switch (ws->else_stmt->kind) {
 			switch (ws->else_stmt->kind) {
-			case AstNode_BlockStmt:
+			case Ast_BlockStmt:
 				check_collect_entities(c, ws->else_stmt->BlockStmt.stmts);
 				check_collect_entities(c, ws->else_stmt->BlockStmt.stmts);
 				break;
 				break;
-			case AstNode_WhenStmt:
+			case Ast_WhenStmt:
 				check_collect_entities_from_when_stmt(c, &ws->else_stmt->WhenStmt);
 				check_collect_entities_from_when_stmt(c, &ws->else_stmt->WhenStmt);
 				break;
 				break;
 			default:
 			default:
@@ -1941,7 +1941,7 @@ void check_collect_entities_from_when_stmt(CheckerContext *c, AstNodeWhenStmt *w
 	}
 	}
 }
 }
 
 
-void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<AstNode *> *attributes) {
+void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<Ast *> *attributes) {
 	switch (e->kind) {
 	switch (e->kind) {
 	case Entity_ProcGroup:
 	case Entity_ProcGroup:
 	case Entity_Procedure:
 	case Entity_Procedure:
@@ -1956,19 +1956,19 @@ void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<AstNode *> *
 	}
 	}
 
 
 	for_array(j, *attributes) {
 	for_array(j, *attributes) {
-		AstNode *attr = (*attributes)[j];
-		if (attr->kind != AstNode_Attribute) continue;
+		Ast *attr = (*attributes)[j];
+		if (attr->kind != Ast_Attribute) continue;
 		for (isize k = 0; k < attr->Attribute.elems.count; k++) {
 		for (isize k = 0; k < attr->Attribute.elems.count; k++) {
-			AstNode *elem = attr->Attribute.elems[k];
+			Ast *elem = attr->Attribute.elems[k];
 			String name = {};
 			String name = {};
-			AstNode *value = nullptr;
+			Ast *value = nullptr;
 
 
 			switch (elem->kind) {
 			switch (elem->kind) {
 			case_ast_node(i, Ident, elem);
 			case_ast_node(i, Ident, elem);
 				name = i->token.string;
 				name = i->token.string;
 			case_end;
 			case_end;
 			case_ast_node(fv, FieldValue, elem);
 			case_ast_node(fv, FieldValue, elem);
-				GB_ASSERT(fv->field->kind == AstNode_Ident);
+				GB_ASSERT(fv->field->kind == Ast_Ident);
 				name = fv->field->Ident.token.string;
 				name = fv->field->Ident.token.string;
 				value = fv->value;
 				value = fv->value;
 			case_end;
 			case_end;
@@ -1991,8 +1991,8 @@ void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<AstNode *> *
 	}
 	}
 
 
 	for (isize i = 0; i < attributes->count; i++) {
 	for (isize i = 0; i < attributes->count; i++) {
-		AstNode *attr = (*attributes)[i];
-		if (attr->kind != AstNode_Attribute) continue;
+		Ast *attr = (*attributes)[i];
+		if (attr->kind != Ast_Attribute) continue;
 		if (attr->Attribute.elems.count == 0) {
 		if (attr->Attribute.elems.count == 0) {
 			(*attributes)[i] = (*attributes)[attributes->count-1];
 			(*attributes)[i] = (*attributes)[attributes->count-1];
 			attributes->count--;
 			attributes->count--;
@@ -2001,7 +2001,7 @@ void check_builtin_attributes(CheckerContext *ctx, Entity *e, Array<AstNode *> *
 	}
 	}
 }
 }
 
 
-void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
+void check_collect_value_decl(CheckerContext *c, Ast *decl) {
 	if (decl->been_handled) return;
 	if (decl->been_handled) return;
 	decl->been_handled = true;
 	decl->been_handled = true;
 
 
@@ -2027,13 +2027,13 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 		}
 		}
 
 
 		for_array(i, vd->names) {
 		for_array(i, vd->names) {
-			AstNode *name = vd->names[i];
-			AstNode *value = nullptr;
+			Ast *name = vd->names[i];
+			Ast *value = nullptr;
 			if (i < vd->values.count) {
 			if (i < vd->values.count) {
 				value = vd->values[i];
 				value = vd->values[i];
 			}
 			}
-			if (name->kind != AstNode_Ident) {
-				error(name, "A declaration's name must be an identifier, got %.*s", LIT(ast_node_strings[name->kind]));
+			if (name->kind != Ast_Ident) {
+				error(name, "A declaration's name must be an identifier, got %.*s", LIT(ast_strings[name->kind]));
 				continue;
 				continue;
 			}
 			}
 			Entity *e = alloc_entity_variable(c->scope, name->Ident.token, nullptr, false);
 			Entity *e = alloc_entity_variable(c->scope, name->Ident.token, nullptr, false);
@@ -2044,9 +2044,9 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 				error(name, "'using' is not allowed at the file scope");
 				error(name, "'using' is not allowed at the file scope");
 			}
 			}
 
 
-			AstNode *fl = c->foreign_context.curr_library;
+			Ast *fl = c->foreign_context.curr_library;
 			if (fl != nullptr) {
 			if (fl != nullptr) {
-				GB_ASSERT(fl->kind == AstNode_Ident);
+				GB_ASSERT(fl->kind == Ast_Ident);
 				e->Variable.is_foreign = true;
 				e->Variable.is_foreign = true;
 				e->Variable.foreign_library_ident = fl;
 				e->Variable.foreign_library_ident = fl;
 
 
@@ -2060,7 +2060,7 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 
 
 			DeclInfo *d = di;
 			DeclInfo *d = di;
 			if (d == nullptr || i > 0) {
 			if (d == nullptr || i > 0) {
-				AstNode *init_expr = value;
+				Ast *init_expr = value;
 				d = make_decl_info(heap_allocator(), e->scope, c->decl);
 				d = make_decl_info(heap_allocator(), e->scope, c->decl);
 				d->type_expr = vd->type;
 				d->type_expr = vd->type;
 				d->init_expr = init_expr;
 				d->init_expr = init_expr;
@@ -2077,13 +2077,13 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 		check_arity_match(c, vd, true);
 		check_arity_match(c, vd, true);
 	} else {
 	} else {
 		for_array(i, vd->names) {
 		for_array(i, vd->names) {
-			AstNode *name = vd->names[i];
-			if (name->kind != AstNode_Ident) {
-				error(name, "A declaration's name must be an identifier, got %.*s", LIT(ast_node_strings[name->kind]));
+			Ast *name = vd->names[i];
+			if (name->kind != Ast_Ident) {
+				error(name, "A declaration's name must be an identifier, got %.*s", LIT(ast_strings[name->kind]));
 				continue;
 				continue;
 			}
 			}
 
 
-			AstNode *init = unparen_expr(vd->values[i]);
+			Ast *init = unparen_expr(vd->values[i]);
 			if (init == nullptr) {
 			if (init == nullptr) {
 				error(name, "Expected a value for this constant value declaration");
 				error(name, "Expected a value for this constant value declaration");
 				continue;
 				continue;
@@ -2091,21 +2091,21 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 
 
 			Token token = name->Ident.token;
 			Token token = name->Ident.token;
 
 
-			AstNode *fl = c->foreign_context.curr_library;
+			Ast *fl = c->foreign_context.curr_library;
 			DeclInfo *d = make_decl_info(c->allocator, c->scope, c->decl);
 			DeclInfo *d = make_decl_info(c->allocator, c->scope, c->decl);
 			Entity *e = nullptr;
 			Entity *e = nullptr;
 
 
 			d->attributes = vd->attributes;
 			d->attributes = vd->attributes;
 
 
-			if (is_ast_node_type(init) ||
-				(vd->type != nullptr && vd->type->kind == AstNode_TypeType)) {
+			if (is_ast_type(init) ||
+				(vd->type != nullptr && vd->type->kind == Ast_TypeType)) {
 				e = alloc_entity_type_name(d->scope, token, nullptr);
 				e = alloc_entity_type_name(d->scope, token, nullptr);
 				if (vd->type != nullptr) {
 				if (vd->type != nullptr) {
 					error(name, "A type declaration cannot have an type parameter");
 					error(name, "A type declaration cannot have an type parameter");
 				}
 				}
 				d->type_expr = init;
 				d->type_expr = init;
 				d->init_expr = init;
 				d->init_expr = init;
-			} else if (init->kind == AstNode_ProcLit) {
+			} else if (init->kind == Ast_ProcLit) {
 				if (c->scope->is_struct) {
 				if (c->scope->is_struct) {
 					error(name, "Procedure declarations are not allowed within a struct");
 					error(name, "Procedure declarations are not allowed within a struct");
 					continue;
 					continue;
@@ -2113,11 +2113,11 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 				ast_node(pl, ProcLit, init);
 				ast_node(pl, ProcLit, init);
 				e = alloc_entity_procedure(d->scope, token, nullptr, pl->tags);
 				e = alloc_entity_procedure(d->scope, token, nullptr, pl->tags);
 				if (fl != nullptr) {
 				if (fl != nullptr) {
-					GB_ASSERT(fl->kind == AstNode_Ident);
+					GB_ASSERT(fl->kind == Ast_Ident);
 					e->Procedure.foreign_library_ident = fl;
 					e->Procedure.foreign_library_ident = fl;
 					e->Procedure.is_foreign = true;
 					e->Procedure.is_foreign = true;
 
 
-					GB_ASSERT(pl->type->kind == AstNode_ProcType);
+					GB_ASSERT(pl->type->kind == Ast_ProcType);
 					auto cc = pl->type->ProcType.calling_convention;
 					auto cc = pl->type->ProcType.calling_convention;
 					if (cc == ProcCC_ForeignBlockDefault) {
 					if (cc == ProcCC_ForeignBlockDefault) {
 						cc = ProcCC_CDecl;
 						cc = ProcCC_CDecl;
@@ -2135,7 +2135,7 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 				}
 				}
 				d->proc_lit = init;
 				d->proc_lit = init;
 				d->type_expr = pl->type;
 				d->type_expr = pl->type;
-			} else if (init->kind == AstNode_ProcGroup) {
+			} else if (init->kind == Ast_ProcGroup) {
 				ast_node(pg, ProcGroup, init);
 				ast_node(pg, ProcGroup, init);
 				e = alloc_entity_proc_group(d->scope, token, nullptr);
 				e = alloc_entity_proc_group(d->scope, token, nullptr);
 				if (fl != nullptr) {
 				if (fl != nullptr) {
@@ -2151,9 +2151,9 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 
 
 			if (e->kind != Entity_Procedure) {
 			if (e->kind != Entity_Procedure) {
 				if (fl != nullptr || c->foreign_context.in_export) {
 				if (fl != nullptr || c->foreign_context.in_export) {
-					AstNodeKind kind = init->kind;
-					error(name, "Only procedures and variables are allowed to be in a foreign block, got %.*s", LIT(ast_node_strings[kind]));
-					if (kind == AstNode_ProcType) {
+					AstKind kind = init->kind;
+					error(name, "Only procedures and variables are allowed to be in a foreign block, got %.*s", LIT(ast_strings[kind]));
+					if (kind == Ast_ProcType) {
 						gb_printf_err("\tDid you forget to append '---' to the procedure?\n");
 						gb_printf_err("\tDid you forget to append '---' to the procedure?\n");
 					}
 					}
 				}
 				}
@@ -2168,17 +2168,17 @@ void check_collect_value_decl(CheckerContext *c, AstNode *decl) {
 	}
 	}
 }
 }
 
 
-void check_add_foreign_block_decl(CheckerContext *ctx, AstNode *decl) {
+void check_add_foreign_block_decl(CheckerContext *ctx, Ast *decl) {
 	if (decl->been_handled) return;
 	if (decl->been_handled) return;
 	decl->been_handled = true;
 	decl->been_handled = true;
 
 
 	ast_node(fb, ForeignBlockDecl, decl);
 	ast_node(fb, ForeignBlockDecl, decl);
-	AstNode *foreign_library = fb->foreign_library;
+	Ast *foreign_library = fb->foreign_library;
 
 
 	CheckerContext c = *ctx;
 	CheckerContext c = *ctx;
-	if (foreign_library->kind == AstNode_Ident) {
+	if (foreign_library->kind == Ast_Ident) {
 		c.foreign_context.curr_library = foreign_library;
 		c.foreign_context.curr_library = foreign_library;
-	} else if (foreign_library->kind == AstNode_Implicit && foreign_library->Implicit.kind == Token_export) {
+	} else if (foreign_library->kind == Ast_Implicit && foreign_library->Implicit.kind == Token_export) {
 		c.foreign_context.in_export = true;
 		c.foreign_context.in_export = true;
 	} else {
 	} else {
 		error(foreign_library, "Foreign block name must be an identifier or 'export'");
 		error(foreign_library, "Foreign block name must be an identifier or 'export'");
@@ -2193,13 +2193,13 @@ void check_add_foreign_block_decl(CheckerContext *ctx, AstNode *decl) {
 }
 }
 
 
 // NOTE(bill): If file_scopes == nullptr, this will act like a local scope
 // NOTE(bill): If file_scopes == nullptr, this will act like a local scope
-void check_collect_entities(CheckerContext *c, Array<AstNode *> const &nodes) {
+void check_collect_entities(CheckerContext *c, Array<Ast *> const &nodes) {
 	for_array(decl_index, nodes) {
 	for_array(decl_index, nodes) {
-		AstNode *decl = nodes[decl_index];
-		if (!is_ast_node_decl(decl) && !is_ast_node_when_stmt(decl)) {
-			if (c->scope->is_file && decl->kind == AstNode_ExprStmt) {
-				AstNode *expr = decl->ExprStmt.expr;
-				if (expr->kind == AstNode_CallExpr && expr->CallExpr.proc->kind == AstNode_BasicDirective) {
+		Ast *decl = nodes[decl_index];
+		if (!is_ast_decl(decl) && !is_ast_when_stmt(decl)) {
+			if (c->scope->is_file && decl->kind == Ast_ExprStmt) {
+				Ast *expr = decl->ExprStmt.expr;
+				if (expr->kind == Ast_CallExpr && expr->CallExpr.proc->kind == Ast_BasicDirective) {
 					if (c->collect_delayed_decls) {
 					if (c->collect_delayed_decls) {
 						array_add(&c->scope->delayed_directives, expr);
 						array_add(&c->scope->delayed_directives, expr);
 					}
 					}
@@ -2259,7 +2259,7 @@ void check_collect_entities(CheckerContext *c, Array<AstNode *> const &nodes) {
 	// declared after this stmt in source
 	// declared after this stmt in source
 	if (!c->scope->is_file || c->collect_delayed_decls) {
 	if (!c->scope->is_file || c->collect_delayed_decls) {
 		for_array(i, nodes) {
 		for_array(i, nodes) {
-			AstNode *node = nodes[i];
+			Ast *node = nodes[i];
 			switch (node->kind) {
 			switch (node->kind) {
 			case_ast_node(ws, WhenStmt, node);
 			case_ast_node(ws, WhenStmt, node);
 				check_collect_entities_from_when_stmt(c, ws);
 				check_collect_entities_from_when_stmt(c, ws);
@@ -2378,7 +2378,7 @@ String path_to_entity_name(String name, String fullpath) {
 
 
 #if 1
 #if 1
 
 
-void add_import_dependency_node(Checker *c, AstNode *decl, Map<ImportGraphNode *> *M) {
+void add_import_dependency_node(Checker *c, Ast *decl, Map<ImportGraphNode *> *M) {
 	AstPackage *parent_pkg = decl->file->pkg;
 	AstPackage *parent_pkg = decl->file->pkg;
 
 
 	switch (decl->kind) {
 	switch (decl->kind) {
@@ -2391,7 +2391,7 @@ void add_import_dependency_node(Checker *c, AstNode *decl, Map<ImportGraphNode *
 				AstPackage *pkg = c->info.packages.entries[pkg_index].value;
 				AstPackage *pkg = c->info.packages.entries[pkg_index].value;
 				gb_printf_err("%.*s\n", LIT(pkg->fullpath));
 				gb_printf_err("%.*s\n", LIT(pkg->fullpath));
 			}
 			}
-			Token token = ast_node_token(decl);
+			Token token = ast_token(decl);
 			gb_printf_err("%.*s(%td:%td)\n", LIT(token.pos.file), token.pos.line, token.pos.column);
 			gb_printf_err("%.*s(%td:%td)\n", LIT(token.pos.file), token.pos.line, token.pos.column);
 			GB_PANIC("Unable to find package: %.*s", LIT(path));
 			GB_PANIC("Unable to find package: %.*s", LIT(path));
 		}
 		}
@@ -2428,7 +2428,7 @@ void add_import_dependency_node(Checker *c, AstNode *decl, Map<ImportGraphNode *
 
 
 		if (ws->else_stmt != nullptr) {
 		if (ws->else_stmt != nullptr) {
 			switch (ws->else_stmt->kind) {
 			switch (ws->else_stmt->kind) {
-			case AstNode_BlockStmt: {
+			case Ast_BlockStmt: {
 				auto stmts = ws->else_stmt->BlockStmt.stmts;
 				auto stmts = ws->else_stmt->BlockStmt.stmts;
 				for_array(i, stmts) {
 				for_array(i, stmts) {
 					add_import_dependency_node(c, stmts[i], M);
 					add_import_dependency_node(c, stmts[i], M);
@@ -2436,7 +2436,7 @@ void add_import_dependency_node(Checker *c, AstNode *decl, Map<ImportGraphNode *
 
 
 				break;
 				break;
 			}
 			}
-			case AstNode_WhenStmt:
+			case Ast_WhenStmt:
 				add_import_dependency_node(c, ws->else_stmt, M);
 				add_import_dependency_node(c, ws->else_stmt, M);
 				break;
 				break;
 			}
 			}
@@ -2462,7 +2462,7 @@ Array<ImportGraphNode *> generate_import_dependency_graph(Checker *c) {
 		for_array(j, p->files) {
 		for_array(j, p->files) {
 			AstFile *f = p->files[j];
 			AstFile *f = p->files[j];
 			for_array(k, f->decls) {
 			for_array(k, f->decls) {
-				AstNode *decl = f->decls[k];
+				Ast *decl = f->decls[k];
 				add_import_dependency_node(c, decl, &M);
 				add_import_dependency_node(c, decl, &M);
 			}
 			}
 		}
 		}
@@ -2484,7 +2484,7 @@ Array<ImportGraphNode *> generate_import_dependency_graph(Checker *c) {
 
 
 struct ImportPathItem {
 struct ImportPathItem {
 	AstPackage *pkg;
 	AstPackage *pkg;
-	AstNode *   decl;
+	Ast *   decl;
 };
 };
 
 
 Array<ImportPathItem> find_import_path(Checker *c, AstPackage *start, AstPackage *end, PtrSet<AstPackage *> *visited) {
 Array<ImportPathItem> find_import_path(Checker *c, AstPackage *start, AstPackage *end, PtrSet<AstPackage *> *visited) {
@@ -2507,8 +2507,8 @@ Array<ImportPathItem> find_import_path(Checker *c, AstPackage *start, AstPackage
 			AstFile *f = pkg->files[i];
 			AstFile *f = pkg->files[i];
 			for_array(j, f->imports) {
 			for_array(j, f->imports) {
 				AstPackage *pkg = nullptr;
 				AstPackage *pkg = nullptr;
-				AstNode *decl = f->imports[j];
-				if (decl->kind == AstNode_ImportDecl) {
+				Ast *decl = f->imports[j];
+				if (decl->kind == Ast_ImportDecl) {
 					pkg = decl->ImportDecl.package;
 					pkg = decl->ImportDecl.package;
 				} else {
 				} else {
 					continue;
 					continue;
@@ -2537,7 +2537,7 @@ Array<ImportPathItem> find_import_path(Checker *c, AstPackage *start, AstPackage
 	return empty_path;
 	return empty_path;
 }
 }
 #endif
 #endif
-void check_add_import_decl(CheckerContext *ctx, AstNode *decl) {
+void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
 	if (decl->been_handled) return;
 	if (decl->been_handled) return;
 	decl->been_handled = true;
 	decl->been_handled = true;
 
 
@@ -2624,7 +2624,7 @@ void check_add_import_decl(CheckerContext *ctx, AstNode *decl) {
 }
 }
 
 
 
 
-void check_add_foreign_import_decl(CheckerContext *ctx, AstNode *decl) {
+void check_add_foreign_import_decl(CheckerContext *ctx, Ast *decl) {
 	if (decl->been_handled) return;
 	if (decl->been_handled) return;
 	decl->been_handled = true;
 	decl->been_handled = true;
 
 
@@ -2667,10 +2667,10 @@ void check_add_foreign_import_decl(CheckerContext *ctx, AstNode *decl) {
 	add_entity(ctx->checker, parent_scope, nullptr, e);
 	add_entity(ctx->checker, parent_scope, nullptr, e);
 }
 }
 
 
-bool collect_checked_packages_from_decl_list(Checker *c, Array<AstNode *> const &decls) {
+bool collect_checked_packages_from_decl_list(Checker *c, Array<Ast *> const &decls) {
 	bool new_files = false;
 	bool new_files = false;
 	for_array(i, decls) {
 	for_array(i, decls) {
-		AstNode *decl = decls[i];
+		Ast *decl = decls[i];
 		switch (decl->kind) {
 		switch (decl->kind) {
 		case_ast_node(id, ImportDecl, decl);
 		case_ast_node(id, ImportDecl, decl);
 			HashKey key = hash_string(id->fullpath);
 			HashKey key = hash_string(id->fullpath);
@@ -2690,10 +2690,10 @@ bool collect_checked_packages_from_decl_list(Checker *c, Array<AstNode *> const
 }
 }
 
 
 // Returns true if a new package is present
 // Returns true if a new package is present
-bool collect_file_decls(CheckerContext *ctx, Array<AstNode *> const &decls);
-bool collect_file_decls_from_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws);
+bool collect_file_decls(CheckerContext *ctx, Array<Ast *> const &decls);
+bool collect_file_decls_from_when_stmt(CheckerContext *ctx, AstWhenStmt *ws);
 
 
-bool collect_when_stmt_from_file(CheckerContext *ctx, AstNodeWhenStmt *ws) {
+bool collect_when_stmt_from_file(CheckerContext *ctx, AstWhenStmt *ws) {
 	Operand operand = {Addressing_Invalid};
 	Operand operand = {Addressing_Invalid};
 	if (!ws->is_cond_determined) {
 	if (!ws->is_cond_determined) {
 		check_expr(ctx, &operand, ws->cond);
 		check_expr(ctx, &operand, ws->cond);
@@ -2708,16 +2708,16 @@ bool collect_when_stmt_from_file(CheckerContext *ctx, AstNodeWhenStmt *ws) {
 		ws->determined_cond = operand.value.kind == ExactValue_Bool && operand.value.value_bool;
 		ws->determined_cond = operand.value.kind == ExactValue_Bool && operand.value.value_bool;
 	}
 	}
 
 
-	if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
+	if (ws->body == nullptr || ws->body->kind != Ast_BlockStmt) {
 		error(ws->cond, "Invalid body for 'when' statement");
 		error(ws->cond, "Invalid body for 'when' statement");
 	} else {
 	} else {
 		if (ws->determined_cond) {
 		if (ws->determined_cond) {
 			return collect_checked_packages_from_decl_list(ctx->checker, ws->body->BlockStmt.stmts);
 			return collect_checked_packages_from_decl_list(ctx->checker, ws->body->BlockStmt.stmts);
 		} else if (ws->else_stmt) {
 		} else if (ws->else_stmt) {
 			switch (ws->else_stmt->kind) {
 			switch (ws->else_stmt->kind) {
-			case AstNode_BlockStmt:
+			case Ast_BlockStmt:
 				return collect_checked_packages_from_decl_list(ctx->checker, ws->else_stmt->BlockStmt.stmts);
 				return collect_checked_packages_from_decl_list(ctx->checker, ws->else_stmt->BlockStmt.stmts);
-			case AstNode_WhenStmt:
+			case Ast_WhenStmt:
 				return collect_when_stmt_from_file(ctx, &ws->else_stmt->WhenStmt);
 				return collect_when_stmt_from_file(ctx, &ws->else_stmt->WhenStmt);
 			default:
 			default:
 				error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
 				error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
@@ -2729,7 +2729,7 @@ bool collect_when_stmt_from_file(CheckerContext *ctx, AstNodeWhenStmt *ws) {
 	return false;
 	return false;
 }
 }
 
 
-bool collect_file_decls_from_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws) {
+bool collect_file_decls_from_when_stmt(CheckerContext *ctx, AstWhenStmt *ws) {
 	Operand operand = {Addressing_Invalid};
 	Operand operand = {Addressing_Invalid};
 	if (!ws->is_cond_determined) {
 	if (!ws->is_cond_determined) {
 		check_expr(ctx, &operand, ws->cond);
 		check_expr(ctx, &operand, ws->cond);
@@ -2744,16 +2744,16 @@ bool collect_file_decls_from_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws)
 		ws->determined_cond = operand.value.kind == ExactValue_Bool && operand.value.value_bool;
 		ws->determined_cond = operand.value.kind == ExactValue_Bool && operand.value.value_bool;
 	}
 	}
 
 
-	if (ws->body == nullptr || ws->body->kind != AstNode_BlockStmt) {
+	if (ws->body == nullptr || ws->body->kind != Ast_BlockStmt) {
 		error(ws->cond, "Invalid body for 'when' statement");
 		error(ws->cond, "Invalid body for 'when' statement");
 	} else {
 	} else {
 		if (ws->determined_cond) {
 		if (ws->determined_cond) {
 			return collect_file_decls(ctx, ws->body->BlockStmt.stmts);
 			return collect_file_decls(ctx, ws->body->BlockStmt.stmts);
 		} else if (ws->else_stmt) {
 		} else if (ws->else_stmt) {
 			switch (ws->else_stmt->kind) {
 			switch (ws->else_stmt->kind) {
-			case AstNode_BlockStmt:
+			case Ast_BlockStmt:
 				return collect_file_decls(ctx, ws->else_stmt->BlockStmt.stmts);
 				return collect_file_decls(ctx, ws->else_stmt->BlockStmt.stmts);
-			case AstNode_WhenStmt:
+			case Ast_WhenStmt:
 				return collect_file_decls_from_when_stmt(ctx, &ws->else_stmt->WhenStmt);
 				return collect_file_decls_from_when_stmt(ctx, &ws->else_stmt->WhenStmt);
 			default:
 			default:
 				error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
 				error(ws->else_stmt, "Invalid 'else' statement in 'when' statement");
@@ -2765,7 +2765,7 @@ bool collect_file_decls_from_when_stmt(CheckerContext *ctx, AstNodeWhenStmt *ws)
 	return false;
 	return false;
 }
 }
 
 
-bool collect_file_decls(CheckerContext *ctx, Array<AstNode *> const &decls) {
+bool collect_file_decls(CheckerContext *ctx, Array<Ast *> const &decls) {
 	GB_ASSERT(ctx->scope->is_file);
 	GB_ASSERT(ctx->scope->is_file);
 
 
 	if (collect_checked_packages_from_decl_list(ctx->checker, decls)) {
 	if (collect_checked_packages_from_decl_list(ctx->checker, decls)) {
@@ -2773,7 +2773,7 @@ bool collect_file_decls(CheckerContext *ctx, Array<AstNode *> const &decls) {
 	}
 	}
 
 
 	for_array(i, decls) {
 	for_array(i, decls) {
-		AstNode *decl = decls[i];
+		Ast *decl = decls[i];
 		switch (decl->kind) {
 		switch (decl->kind) {
 		case_ast_node(vd, ValueDecl, decl);
 		case_ast_node(vd, ValueDecl, decl);
 			check_collect_value_decl(ctx, decl);
 			check_collect_value_decl(ctx, decl);
@@ -2814,7 +2814,7 @@ bool collect_file_decls(CheckerContext *ctx, Array<AstNode *> const &decls) {
 		case_end;
 		case_end;
 
 
 		case_ast_node(ce, CallExpr, decl);
 		case_ast_node(ce, CallExpr, decl);
-			if (ce->proc->kind == AstNode_BasicDirective) {
+			if (ce->proc->kind == Ast_BasicDirective) {
 				Operand o = {};
 				Operand o = {};
 				check_expr(ctx, &o, decl);
 				check_expr(ctx, &o, decl);
 			}
 			}
@@ -2975,11 +2975,11 @@ void check_import_entities(Checker *c) {
 
 
 			add_curr_ast_file(&ctx, f);
 			add_curr_ast_file(&ctx, f);
 			for_array(j, f->scope->delayed_imports) {
 			for_array(j, f->scope->delayed_imports) {
-				AstNode *decl = f->scope->delayed_imports[j];
+				Ast *decl = f->scope->delayed_imports[j];
 				check_add_import_decl(&ctx, decl);
 				check_add_import_decl(&ctx, decl);
 			}
 			}
 			for_array(j, f->scope->delayed_directives) {
 			for_array(j, f->scope->delayed_directives) {
-				AstNode *expr = f->scope->delayed_directives[j];
+				Ast *expr = f->scope->delayed_directives[j];
 				Operand o = {};
 				Operand o = {};
 				check_expr(&ctx, &o, expr);
 				check_expr(&ctx, &o, expr);
 			}
 			}
@@ -3139,7 +3139,7 @@ void check_proc_info(Checker *c, ProcInfo pi) {
 	if (pt->is_polymorphic && !pt->is_poly_specialized) {
 	if (pt->is_polymorphic && !pt->is_poly_specialized) {
 		Token token = pi.token;
 		Token token = pi.token;
 		if (pi.poly_def_node != nullptr) {
 		if (pi.poly_def_node != nullptr) {
-			token = ast_node_token(pi.poly_def_node);
+			token = ast_token(pi.poly_def_node);
 		}
 		}
 		error(token, "Unspecialized polymorphic procedure '%.*s'", LIT(name));
 		error(token, "Unspecialized polymorphic procedure '%.*s'", LIT(name));
 		return;
 		return;
@@ -3260,7 +3260,7 @@ void check_parsed_files(Checker *c) {
 	for_array(i, c->info.untyped.entries) {
 	for_array(i, c->info.untyped.entries) {
 		auto *entry = &c->info.untyped.entries[i];
 		auto *entry = &c->info.untyped.entries[i];
 		HashKey key = entry->key;
 		HashKey key = entry->key;
-		AstNode *expr = cast(AstNode *)key.ptr;
+		Ast *expr = cast(Ast *)key.ptr;
 		ExprInfo *info = &entry->value;
 		ExprInfo *info = &entry->value;
 		if (info != nullptr && expr != nullptr) {
 		if (info != nullptr && expr != nullptr) {
 			if (is_type_typed(info->type)) {
 			if (is_type_typed(info->type)) {

+ 40 - 40
src/checker.hpp

@@ -167,7 +167,7 @@ struct Operand {
 	AddressingMode mode;
 	AddressingMode mode;
 	Type *         type;
 	Type *         type;
 	ExactValue     value;
 	ExactValue     value;
-	AstNode *      expr;
+	Ast *      expr;
 	BuiltinProcId  builtin_id;
 	BuiltinProcId  builtin_id;
 	Entity *       proc_group;
 	Entity *       proc_group;
 };
 };
@@ -175,7 +175,7 @@ struct Operand {
 
 
 struct BlockLabel {
 struct BlockLabel {
 	String   name;
 	String   name;
-	AstNode *label; //  AstNode_Label;
+	Ast *label; //  Ast_Label;
 };
 };
 
 
 struct AttributeContext {
 struct AttributeContext {
@@ -192,10 +192,10 @@ AttributeContext make_attribute_context(String link_prefix) {
 	return ac;
 	return ac;
 }
 }
 
 
-#define DECL_ATTRIBUTE_PROC(_name) bool _name(CheckerContext *c, AstNode *elem, String name, ExactValue value, AttributeContext *ac)
+#define DECL_ATTRIBUTE_PROC(_name) bool _name(CheckerContext *c, Ast *elem, String name, ExactValue value, AttributeContext *ac)
 typedef DECL_ATTRIBUTE_PROC(DeclAttributeProc);
 typedef DECL_ATTRIBUTE_PROC(DeclAttributeProc);
 
 
-void check_decl_attributes(CheckerContext *c, Array<AstNode *> const &attributes, DeclAttributeProc *proc, AttributeContext *ac);
+void check_decl_attributes(CheckerContext *c, Array<Ast *> const &attributes, DeclAttributeProc *proc, AttributeContext *ac);
 
 
 
 
 // DeclInfo is used to store information of certain declarations to allow for "any order" usage
 // DeclInfo is used to store information of certain declarations to allow for "any order" usage
@@ -206,11 +206,11 @@ struct DeclInfo {
 	Entity **         entities;
 	Entity **         entities;
 	isize             entity_count;
 	isize             entity_count;
 
 
-	AstNode *         type_expr;
-	AstNode *         init_expr;
-	Array<AstNode *>  init_expr_list;
-	Array<AstNode *>  attributes;
-	AstNode *         proc_lit;      // AstNode_ProcLit
+	Ast *         type_expr;
+	Ast *         init_expr;
+	Array<Ast *>  init_expr_list;
+	Array<Ast *>  attributes;
+	Ast *         proc_lit;      // Ast_ProcLit
 	Type *            gen_proc_type; // Precalculated
 	Type *            gen_proc_type; // Precalculated
 
 
 	PtrSet<Entity *>  deps;
 	PtrSet<Entity *>  deps;
@@ -224,16 +224,16 @@ struct ProcInfo {
 	Token     token;
 	Token     token;
 	DeclInfo *decl;
 	DeclInfo *decl;
 	Type *    type; // Type_Procedure
 	Type *    type; // Type_Procedure
-	AstNode * body; // AstNode_BlockStmt
+	Ast * body; // Ast_BlockStmt
 	u64       tags;
 	u64       tags;
 	bool      generated_from_polymorphic;
 	bool      generated_from_polymorphic;
-	AstNode * poly_def_node;
+	Ast * poly_def_node;
 };
 };
 
 
 
 
 
 
 struct Scope {
 struct Scope {
-	AstNode *        node;
+	Ast *        node;
 	Scope *          parent;
 	Scope *          parent;
 	Scope *          prev, *next;
 	Scope *          prev, *next;
 	Scope *          first_child;
 	Scope *          first_child;
@@ -242,8 +242,8 @@ struct Scope {
 	PtrSet<Entity *> implicit;
 	PtrSet<Entity *> implicit;
 	// Scope *          shared;
 	// Scope *          shared;
 
 
-	Array<AstNode *> delayed_directives;
-	Array<AstNode *> delayed_imports;
+	Array<Ast *> delayed_directives;
+	Array<Ast *> delayed_imports;
 	PtrSet<Scope *>  imported;
 	PtrSet<Scope *>  imported;
 	bool             is_proc;
 	bool             is_proc;
 	bool             is_global;
 	bool             is_global;
@@ -290,7 +290,7 @@ struct ImportGraphNode {
 
 
 
 
 struct ForeignContext {
 struct ForeignContext {
-	AstNode *             curr_library;
+	Ast *             curr_library;
 	ProcCallingConvention default_cc;
 	ProcCallingConvention default_cc;
 	String                link_prefix;
 	String                link_prefix;
 	bool                  in_export;
 	bool                  in_export;
@@ -301,8 +301,8 @@ typedef Array<Type *>   CheckerPolyPath;
 
 
 // CheckerInfo stores all the symbol information for a type-checked program
 // CheckerInfo stores all the symbol information for a type-checked program
 struct CheckerInfo {
 struct CheckerInfo {
-	Map<TypeAndValue>     types;           // Key: AstNode * | Expression -> Type (and value)
-	Map<ExprInfo>         untyped;         // Key: AstNode * | Expression -> ExprInfo
+	Map<TypeAndValue>     types;           // Key: Ast * | Expression -> Type (and value)
+	Map<ExprInfo>         untyped;         // Key: Ast * | Expression -> ExprInfo
 	Map<AstFile *>        files;           // Key: String (full path)
 	Map<AstFile *>        files;           // Key: String (full path)
 	Map<AstPackage *>     packages;        // Key: String (full path)
 	Map<AstPackage *>     packages;        // Key: String (full path)
 	Map<Entity *>         foreigns;        // Key: String
 	Map<Entity *>         foreigns;        // Key: String
@@ -310,7 +310,7 @@ struct CheckerInfo {
 	Array<Entity *>       entities;
 	Array<Entity *>       entities;
 	Array<DeclInfo *>     variable_init_order;
 	Array<DeclInfo *>     variable_init_order;
 
 
-	Map<Array<Entity *> > gen_procs;       // Key: AstNode * | Identifier -> Entity
+	Map<Array<Entity *> > gen_procs;       // Key: Ast * | Identifier -> Entity
 	Map<Array<Entity *> > gen_types;       // Key: Type *
 	Map<Array<Entity *> > gen_types;       // Key: Type *
 
 
 	Array<Type *>         type_info_types;
 	Array<Type *>         type_info_types;
@@ -368,7 +368,7 @@ struct Checker {
 
 
 
 
 
 
-HashKey hash_node     (AstNode *node)  { return hash_pointer(node); }
+HashKey hash_node     (Ast *node)  { return hash_pointer(node); }
 HashKey hash_ast_file (AstFile *file)  { return hash_pointer(file); }
 HashKey hash_ast_file (AstFile *file)  { return hash_pointer(file); }
 HashKey hash_entity   (Entity *e)      { return hash_pointer(e); }
 HashKey hash_entity   (Entity *e)      { return hash_pointer(e); }
 HashKey hash_type     (Type *t)        { return hash_pointer(t); }
 HashKey hash_type     (Type *t)        { return hash_pointer(t); }
@@ -377,19 +377,19 @@ HashKey hash_decl_info(DeclInfo *decl) { return hash_pointer(decl); }
 
 
 
 
 // CheckerInfo API
 // CheckerInfo API
-TypeAndValue type_and_value_of_expr (CheckerInfo *i, AstNode *expr);
-Type *       type_of_expr           (CheckerInfo *i, AstNode *expr);
-Entity *     entity_of_ident        (AstNode *identifier);
-Entity *     implicit_entity_of_node(CheckerInfo *i, AstNode *clause);
-Scope *      scope_of_node          (AstNode *node);
-DeclInfo *   decl_info_of_ident     (AstNode *ident);
+TypeAndValue type_and_value_of_expr (CheckerInfo *i, Ast *expr);
+Type *       type_of_expr           (CheckerInfo *i, Ast *expr);
+Entity *     entity_of_ident        (Ast *identifier);
+Entity *     implicit_entity_of_node(CheckerInfo *i, Ast *clause);
+Scope *      scope_of_node          (Ast *node);
+DeclInfo *   decl_info_of_ident     (Ast *ident);
 DeclInfo *   decl_info_of_entity    (Entity * e);
 DeclInfo *   decl_info_of_entity    (Entity * e);
 AstFile *    ast_file_of_filename   (CheckerInfo *i, String   filename);
 AstFile *    ast_file_of_filename   (CheckerInfo *i, String   filename);
 // IMPORTANT: Only to use once checking is done
 // IMPORTANT: Only to use once checking is done
 isize        type_info_index        (CheckerInfo *i, Type *   type, bool error_on_failure = true);
 isize        type_info_index        (CheckerInfo *i, Type *   type, bool error_on_failure = true);
 
 
 // Will return nullptr if not found
 // Will return nullptr if not found
-Entity *entity_of_node(CheckerInfo *i, AstNode *expr);
+Entity *entity_of_node(CheckerInfo *i, Ast *expr);
 
 
 
 
 Entity *scope_lookup_current(Scope *s, String name);
 Entity *scope_lookup_current(Scope *s, String name);
@@ -398,24 +398,24 @@ void    scope_lookup_parent (Scope *s, String name, Scope **scope_, Entity **ent
 Entity *scope_insert (Scope *s, Entity *entity);
 Entity *scope_insert (Scope *s, Entity *entity);
 
 
 
 
-ExprInfo *check_get_expr_info     (CheckerInfo *i, AstNode *expr);
-void      check_set_expr_info     (CheckerInfo *i, AstNode *expr, ExprInfo info);
-void      check_remove_expr_info  (CheckerInfo *i, AstNode *expr);
-void      add_untyped             (CheckerInfo *i, AstNode *expression, bool lhs, AddressingMode mode, Type *basic_type, ExactValue value);
-void      add_type_and_value      (CheckerInfo *i, AstNode *expression, AddressingMode mode, Type *type, ExactValue value);
-void      add_entity_use          (CheckerContext *c, AstNode *identifier, Entity *entity);
-void      add_implicit_entity     (CheckerContext *c, AstNode *node, Entity *e);
-void      add_entity_and_decl_info(CheckerContext *c, AstNode *identifier, Entity *e, DeclInfo *d);
+ExprInfo *check_get_expr_info     (CheckerInfo *i, Ast *expr);
+void      check_set_expr_info     (CheckerInfo *i, Ast *expr, ExprInfo info);
+void      check_remove_expr_info  (CheckerInfo *i, Ast *expr);
+void      add_untyped             (CheckerInfo *i, Ast *expression, bool lhs, AddressingMode mode, Type *basic_type, ExactValue value);
+void      add_type_and_value      (CheckerInfo *i, Ast *expression, AddressingMode mode, Type *type, ExactValue value);
+void      add_entity_use          (CheckerContext *c, Ast *identifier, Entity *entity);
+void      add_implicit_entity     (CheckerContext *c, Ast *node, Entity *e);
+void      add_entity_and_decl_info(CheckerContext *c, Ast *identifier, Entity *e, DeclInfo *d);
 void      add_type_info_type      (CheckerContext *c, Type *t);
 void      add_type_info_type      (CheckerContext *c, Type *t);
 
 
-void check_add_import_decl(CheckerContext *c, AstNode *decl);
-void check_add_foreign_import_decl(CheckerContext *c, AstNode *decl);
+void check_add_import_decl(CheckerContext *c, Ast *decl);
+void check_add_foreign_import_decl(CheckerContext *c, Ast *decl);
 
 
 
 
-bool check_arity_match(CheckerContext *c, AstNodeValueDecl *vd, bool is_global = false);
-void check_collect_entities(CheckerContext *c, Array<AstNode *> const &nodes);
-void check_collect_entities_from_when_stmt(CheckerContext *c, AstNodeWhenStmt *ws);
-void check_delayed_file_import_entity(CheckerContext *c, AstNode *decl);
+bool check_arity_match(CheckerContext *c, AstValueDecl *vd, bool is_global = false);
+void check_collect_entities(CheckerContext *c, Array<Ast *> const &nodes);
+void check_collect_entities_from_when_stmt(CheckerContext *c, AstWhenStmt *ws);
+void check_delayed_file_import_entity(CheckerContext *c, Ast *decl);
 
 
 CheckerTypePath *new_checker_type_path();
 CheckerTypePath *new_checker_type_path();
 void destroy_checker_type_path(CheckerTypePath *tp);
 void destroy_checker_type_path(CheckerTypePath *tp);

+ 7 - 7
src/docs.cpp

@@ -1,6 +1,6 @@
 // Generates Documentation
 // Generates Documentation
 
 
-gbString expr_to_string(AstNode *expression);
+gbString expr_to_string(Ast *expression);
 
 
 String alloc_comment_group_string(gbAllocator a, CommentGroup g) {
 String alloc_comment_group_string(gbAllocator a, CommentGroup g) {
 	isize len = 0;
 	isize len = 0;
@@ -33,9 +33,9 @@ String alloc_comment_group_string(gbAllocator a, CommentGroup g) {
 }
 }
 
 
 #if 0
 #if 0
-void print_type_spec(AstNode *spec) {
+void print_type_spec(Ast *spec) {
 	ast_node(ts, TypeSpec, spec);
 	ast_node(ts, TypeSpec, spec);
-	GB_ASSERT(ts->name->kind == AstNode_Ident);
+	GB_ASSERT(ts->name->kind == Ast_Ident);
 	String name = ts->name->Ident.string;
 	String name = ts->name->Ident.string;
 	if (name.len == 0) {
 	if (name.len == 0) {
 		return;
 		return;
@@ -46,8 +46,8 @@ void print_type_spec(AstNode *spec) {
 	gb_printf("type %.*s\n", LIT(name));
 	gb_printf("type %.*s\n", LIT(name));
 }
 }
 
 
-void print_proc_decl(AstNodeProcDecl *pd) {
-	GB_ASSERT(pd->name->kind == AstNode_Ident);
+void print_proc_decl(AstProcDecl *pd) {
+	GB_ASSERT(pd->name->kind == Ast_Ident);
 	String name = pd->name->Ident.string;
 	String name = pd->name->Ident.string;
 	if (name.len == 0) {
 	if (name.len == 0) {
 		return;
 		return;
@@ -89,7 +89,7 @@ void print_proc_decl(AstNodeProcDecl *pd) {
 	gb_printf("\n\n");
 	gb_printf("\n\n");
 }
 }
 #endif
 #endif
-void print_declaration(AstNode *decl) {
+void print_declaration(Ast *decl) {
 }
 }
 
 
 void generate_documentation(Parser *parser) {
 void generate_documentation(Parser *parser) {
@@ -100,7 +100,7 @@ void generate_documentation(Parser *parser) {
 	// 	gb_printf("%.*s\n", LIT(fullpath));
 	// 	gb_printf("%.*s\n", LIT(fullpath));
 
 
 	// 	for_array(decl_index, file->decls) {
 	// 	for_array(decl_index, file->decls) {
-	// 		AstNode *decl = file->decls[decl_index];
+	// 		Ast *decl = file->decls[decl_index];
 	// 		print_declaration(decl);
 	// 		print_declaration(decl);
 	// 	}
 	// 	}
 	// }
 	// }

+ 6 - 6
src/entity.cpp

@@ -65,14 +65,14 @@ struct Entity {
 	Token       token;
 	Token       token;
 	Scope *     scope;
 	Scope *     scope;
 	Type *      type;
 	Type *      type;
-	AstNode *   identifier; // Can be nullptr
+	Ast *   identifier; // Can be nullptr
 	DeclInfo *  decl_info;
 	DeclInfo *  decl_info;
 	DeclInfo *  parent_proc_decl; // nullptr if in file/global scope
 	DeclInfo *  parent_proc_decl; // nullptr if in file/global scope
 	AstPackage *pkg;
 	AstPackage *pkg;
 
 
 	// TODO(bill): Cleanup how `using` works for entities
 	// TODO(bill): Cleanup how `using` works for entities
 	Entity *    using_parent;
 	Entity *    using_parent;
-	AstNode *   using_expr;
+	Ast *   using_expr;
 
 
 	isize       order_in_src;
 	isize       order_in_src;
 	String      deprecated_message;
 	String      deprecated_message;
@@ -87,7 +87,7 @@ struct Entity {
 			ExactValue default_value;
 			ExactValue default_value;
 			String     thread_local_model;
 			String     thread_local_model;
 			Entity *   foreign_library;
 			Entity *   foreign_library;
-			AstNode *  foreign_library_ident;
+			Ast *  foreign_library_ident;
 			String     link_name;
 			String     link_name;
 			String     link_prefix;
 			String     link_prefix;
 			bool       is_foreign;
 			bool       is_foreign;
@@ -106,7 +106,7 @@ struct Entity {
 		struct {
 		struct {
 			u64          tags;
 			u64          tags;
 			Entity *     foreign_library;
 			Entity *     foreign_library;
-			AstNode *    foreign_library_ident;
+			Ast *    foreign_library_ident;
 			String       link_name;
 			String       link_name;
 			String       link_prefix;
 			String       link_prefix;
 			bool         is_foreign;
 			bool         is_foreign;
@@ -130,7 +130,7 @@ struct Entity {
 		i32 Nil;
 		i32 Nil;
 		struct {
 		struct {
 			String   name;
 			String   name;
-			AstNode *node;
+			Ast *node;
 		} Label;
 		} Label;
 	};
 	};
 };
 };
@@ -295,7 +295,7 @@ Entity *alloc_entity_nil(String name, Type *type) {
 	return entity;
 	return entity;
 }
 }
 
 
-Entity *alloc_entity_label(Scope *scope, Token token, Type *type, AstNode *node) {
+Entity *alloc_entity_label(Scope *scope, Token token, Type *type, Ast *node) {
 	Entity *entity = alloc_entity(Entity_Label, scope, token, type);
 	Entity *entity = alloc_entity(Entity_Label, scope, token, type);
 	entity->Label.node = node;
 	entity->Label.node = node;
 	entity->state = EntityState_Resolved;
 	entity->state = EntityState_Resolved;

+ 5 - 5
src/exact_value.cpp

@@ -3,7 +3,7 @@
 // TODO(bill): Big numbers
 // TODO(bill): Big numbers
 // IMPORTANT TODO(bill): This needs to be completely fixed!!!!!!!!
 // IMPORTANT TODO(bill): This needs to be completely fixed!!!!!!!!
 
 
-struct AstNode;
+struct Ast;
 struct HashKey;
 struct HashKey;
 struct Type;
 struct Type;
 struct Entity;
 struct Entity;
@@ -37,8 +37,8 @@ struct ExactValue {
 		f64           value_float;
 		f64           value_float;
 		i64           value_pointer;
 		i64           value_pointer;
 		Complex128    value_complex;
 		Complex128    value_complex;
-		AstNode *     value_compound;
-		AstNode *     value_procedure;
+		Ast *     value_compound;
+		Ast *     value_procedure;
 		Entity *      value_entity;
 		Entity *      value_entity;
 	};
 	};
 };
 };
@@ -73,7 +73,7 @@ HashKey hash_exact_value(ExactValue v) {
 }
 }
 
 
 
 
-ExactValue exact_value_compound(AstNode *node) {
+ExactValue exact_value_compound(Ast *node) {
 	ExactValue result = {ExactValue_Compound};
 	ExactValue result = {ExactValue_Compound};
 	result.value_compound = node;
 	result.value_compound = node;
 	return result;
 	return result;
@@ -123,7 +123,7 @@ ExactValue exact_value_pointer(i64 ptr) {
 	return result;
 	return result;
 }
 }
 
 
-ExactValue exact_value_procedure(AstNode *node) {
+ExactValue exact_value_procedure(Ast *node) {
 	ExactValue result = {ExactValue_Procedure};
 	ExactValue result = {ExactValue_Procedure};
 	result.value_procedure = node;
 	result.value_procedure = node;
 	return result;
 	return result;

File diff suppressed because it is too large
+ 131 - 131
src/ir.cpp


+ 4 - 4
src/ir_print.cpp

@@ -709,7 +709,7 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
 			bool *visited = gb_alloc_array(m->tmp_allocator, bool, value_count);
 			bool *visited = gb_alloc_array(m->tmp_allocator, bool, value_count);
 
 
 			if (cl->elems.count > 0) {
 			if (cl->elems.count > 0) {
-				if (cl->elems[0]->kind == AstNode_FieldValue) {
+				if (cl->elems[0]->kind == Ast_FieldValue) {
 					isize elem_count = cl->elems.count;
 					isize elem_count = cl->elems.count;
 					for (isize i = 0; i < elem_count; i++) {
 					for (isize i = 0; i < elem_count; i++) {
 						ast_node(fv, FieldValue, cl->elems[i]);
 						ast_node(fv, FieldValue, cl->elems[i]);
@@ -765,13 +765,13 @@ void ir_print_exact_value(irFileBuffer *f, irModule *m, ExactValue value, Type *
 	}
 	}
 	case ExactValue_Procedure: {
 	case ExactValue_Procedure: {
 		irValue **found = nullptr;
 		irValue **found = nullptr;
-		AstNode *expr = value.value_procedure;
+		Ast *expr = value.value_procedure;
 		GB_ASSERT(expr != nullptr);
 		GB_ASSERT(expr != nullptr);
 
 
-		if (expr->kind == AstNode_ProcLit) {
+		if (expr->kind == Ast_ProcLit) {
 			found = map_get(&m->anonymous_proc_lits, hash_pointer(expr));
 			found = map_get(&m->anonymous_proc_lits, hash_pointer(expr));
 		} else {
 		} else {
-			GB_ASSERT(expr->kind == AstNode_Ident);
+			GB_ASSERT(expr->kind == Ast_Ident);
 			Entity *e = entity_of_ident(expr);
 			Entity *e = entity_of_ident(expr);
 			GB_ASSERT(e != nullptr);
 			GB_ASSERT(e != nullptr);
 			found = map_get(&m->values, hash_entity(e));
 			found = map_get(&m->values, hash_entity(e));

File diff suppressed because it is too large
+ 253 - 253
src/parser.cpp


+ 267 - 267
src/parser.hpp

@@ -1,4 +1,4 @@
-struct AstNode;
+struct Ast;
 struct Scope;
 struct Scope;
 struct Type;
 struct Type;
 struct Entity;
 struct Entity;
@@ -52,7 +52,7 @@ struct AstFile {
 	AstPackage *        pkg;
 	AstPackage *        pkg;
 	Scope *             scope;
 	Scope *             scope;
 
 
-	AstNode *           pkg_decl;
+	Ast *           pkg_decl;
 	String              fullpath;
 	String              fullpath;
 	Tokenizer           tokenizer;
 	Tokenizer           tokenizer;
 	Array<Token>        tokens;
 	Array<Token>        tokens;
@@ -71,12 +71,12 @@ struct AstFile {
 	bool                allow_type;
 	bool                allow_type;
 	isize               when_level;
 	isize               when_level;
 
 
-	Array<AstNode *>    decls;
-	Array<AstNode *>    imports; // 'import' 'using import'
+	Array<Ast *>    decls;
+	Array<Ast *>    imports; // 'import' 'using import'
 	isize               directive_count;
 	isize               directive_count;
 
 
 
 
-	AstNode *           curr_proc;
+	Ast *           curr_proc;
 	// DeclInfo *          decl_info;   // NOTE(bill): Created in checker
 	// DeclInfo *          decl_info;   // NOTE(bill): Created in checker
 	isize               error_count;
 	isize               error_count;
 
 
@@ -173,192 +173,192 @@ enum StmtAllowFlag {
 	StmtAllowFlag_Context = 1<<2,
 	StmtAllowFlag_Context = 1<<2,
 };
 };
 
 
-#define AST_NODE_KINDS \
-	AST_NODE_KIND(Ident,          "identifier",      struct { \
+#define AST_KINDS \
+	AST_KIND(Ident,          "identifier",      struct { \
 		Token   token;  \
 		Token   token;  \
 		Entity *entity; \
 		Entity *entity; \
 	}) \
 	}) \
-	AST_NODE_KIND(Implicit,       "implicit",        Token) \
-	AST_NODE_KIND(Undef,          "undef",           Token) \
-	AST_NODE_KIND(BasicLit,       "basic literal",   struct { \
+	AST_KIND(Implicit,       "implicit",        Token) \
+	AST_KIND(Undef,          "undef",           Token) \
+	AST_KIND(BasicLit,       "basic literal",   struct { \
 		Token token; \
 		Token token; \
 	}) \
 	}) \
-	AST_NODE_KIND(BasicDirective, "basic directive", struct { \
+	AST_KIND(BasicDirective, "basic directive", struct { \
 		Token  token; \
 		Token  token; \
 		String name; \
 		String name; \
 	}) \
 	}) \
-	AST_NODE_KIND(Ellipsis,       "ellipsis", struct { \
+	AST_KIND(Ellipsis,       "ellipsis", struct { \
 		Token    token; \
 		Token    token; \
-		AstNode *expr; \
-	}) \
-	AST_NODE_KIND(ProcGroup, "procedure group", struct { \
-		Token            token; \
-		Token            open;  \
-		Token            close; \
-		Array<AstNode *> args; \
-	}) \
-	AST_NODE_KIND(ProcLit, "procedure literal", struct { \
-		AstNode *    type; \
-		AstNode *    body; \
-		u64          tags; \
+		Ast *expr; \
+	}) \
+	AST_KIND(ProcGroup, "procedure group", struct { \
+		Token        token; \
+		Token        open;  \
+		Token        close; \
+		Array<Ast *> args;  \
+	}) \
+	AST_KIND(ProcLit, "procedure literal", struct { \
+		Ast *type; \
+		Ast *body; \
+		u64  tags; \
 		ProcInlining inlining; \
 		ProcInlining inlining; \
 	}) \
 	}) \
-	AST_NODE_KIND(CompoundLit, "compound literal", struct { \
-		AstNode *type; \
-		Array<AstNode *> elems; \
+	AST_KIND(CompoundLit, "compound literal", struct { \
+		Ast *type; \
+		Array<Ast *> elems; \
 		Token open, close; \
 		Token open, close; \
 	}) \
 	}) \
-AST_NODE_KIND(_ExprBegin,  "",  struct {}) \
-	AST_NODE_KIND(BadExpr,      "bad expression",         struct { Token begin, end; }) \
-	AST_NODE_KIND(TagExpr,      "tag expression",         struct { Token token, name; AstNode *expr; }) \
-	AST_NODE_KIND(RunExpr,      "run expression",         struct { Token token, name; AstNode *expr; }) \
-	AST_NODE_KIND(UnaryExpr,    "unary expression",       struct { Token op; AstNode *expr; }) \
-	AST_NODE_KIND(BinaryExpr,   "binary expression",      struct { Token op; AstNode *left, *right; } ) \
-	AST_NODE_KIND(ParenExpr,    "parentheses expression", struct { AstNode *expr; Token open, close; }) \
-	AST_NODE_KIND(SelectorExpr, "selector expression",    struct { Token token; AstNode *expr, *selector; }) \
-	AST_NODE_KIND(IndexExpr,    "index expression",       struct { AstNode *expr, *index; Token open, close; }) \
-	AST_NODE_KIND(DerefExpr,    "dereference expression", struct { Token op; AstNode *expr; }) \
-	AST_NODE_KIND(SliceExpr,    "slice expression", struct { \
-		AstNode *expr; \
+AST_KIND(_ExprBegin,  "",  struct {}) \
+	AST_KIND(BadExpr,      "bad expression",         struct { Token begin, end; }) \
+	AST_KIND(TagExpr,      "tag expression",         struct { Token token, name; Ast *expr; }) \
+	AST_KIND(RunExpr,      "run expression",         struct { Token token, name; Ast *expr; }) \
+	AST_KIND(UnaryExpr,    "unary expression",       struct { Token op; Ast *expr; }) \
+	AST_KIND(BinaryExpr,   "binary expression",      struct { Token op; Ast *left, *right; } ) \
+	AST_KIND(ParenExpr,    "parentheses expression", struct { Ast *expr; Token open, close; }) \
+	AST_KIND(SelectorExpr, "selector expression",    struct { Token token; Ast *expr, *selector; }) \
+	AST_KIND(IndexExpr,    "index expression",       struct { Ast *expr, *index; Token open, close; }) \
+	AST_KIND(DerefExpr,    "dereference expression", struct { Token op; Ast *expr; }) \
+	AST_KIND(SliceExpr,    "slice expression", struct { \
+		Ast *expr; \
 		Token open, close; \
 		Token open, close; \
 		Token interval; \
 		Token interval; \
-		AstNode *low, *high; \
+		Ast *low, *high; \
 	}) \
 	}) \
-	AST_NODE_KIND(CallExpr,     "call expression", struct { \
-		AstNode *    proc; \
-		Array<AstNode *> args; \
+	AST_KIND(CallExpr,     "call expression", struct { \
+		Ast *        proc; \
+		Array<Ast *> args; \
 		Token        open; \
 		Token        open; \
 		Token        close; \
 		Token        close; \
 		Token        ellipsis; \
 		Token        ellipsis; \
 	}) \
 	}) \
-	AST_NODE_KIND(FieldValue,    "field value",         struct { Token eq; AstNode *field, *value; }) \
-	AST_NODE_KIND(TernaryExpr,   "ternary expression",  struct { AstNode *cond, *x, *y; }) \
-	AST_NODE_KIND(TypeAssertion, "type assertion",      struct { AstNode *expr; Token dot; AstNode *type; }) \
-	AST_NODE_KIND(TypeCast,      "type cast",           struct { Token token; AstNode *type, *expr; }) \
-	AST_NODE_KIND(AutoCast,      "auto_cast",           struct { Token token; AstNode *expr; }) \
-AST_NODE_KIND(_ExprEnd,       "", struct {}) \
-AST_NODE_KIND(_StmtBegin,     "", struct {}) \
-	AST_NODE_KIND(BadStmt,    "bad statement",                 struct { Token begin, end; }) \
-	AST_NODE_KIND(EmptyStmt,  "empty statement",               struct { Token token; }) \
-	AST_NODE_KIND(ExprStmt,   "expression statement",          struct { AstNode *expr; } ) \
-	AST_NODE_KIND(TagStmt,    "tag statement", struct { \
+	AST_KIND(FieldValue,    "field value",         struct { Token eq; Ast *field, *value; }) \
+	AST_KIND(TernaryExpr,   "ternary expression",  struct { Ast *cond, *x, *y; }) \
+	AST_KIND(TypeAssertion, "type assertion",      struct { Ast *expr; Token dot; Ast *type; }) \
+	AST_KIND(TypeCast,      "type cast",           struct { Token token; Ast *type, *expr; }) \
+	AST_KIND(AutoCast,      "auto_cast",           struct { Token token; Ast *expr; }) \
+AST_KIND(_ExprEnd,       "", struct {}) \
+AST_KIND(_StmtBegin,     "", struct {}) \
+	AST_KIND(BadStmt,    "bad statement",                 struct { Token begin, end; }) \
+	AST_KIND(EmptyStmt,  "empty statement",               struct { Token token; }) \
+	AST_KIND(ExprStmt,   "expression statement",          struct { Ast *expr; } ) \
+	AST_KIND(TagStmt,    "tag statement", struct { \
 		Token token; \
 		Token token; \
 		Token name; \
 		Token name; \
-		AstNode *stmt; \
+		Ast * stmt; \
 	}) \
 	}) \
-	AST_NODE_KIND(AssignStmt, "assign statement", struct { \
+	AST_KIND(AssignStmt, "assign statement", struct { \
 		Token op; \
 		Token op; \
-		Array<AstNode *> lhs, rhs; \
+		Array<Ast *> lhs, rhs; \
 	}) \
 	}) \
-	AST_NODE_KIND(IncDecStmt, "increment decrement statement", struct { \
+	AST_KIND(IncDecStmt, "increment decrement statement", struct { \
 		Token op; \
 		Token op; \
-		AstNode *expr; \
+		Ast *expr; \
 	}) \
 	}) \
-AST_NODE_KIND(_ComplexStmtBegin, "", struct {}) \
-	AST_NODE_KIND(BlockStmt, "block statement", struct { \
-		Array<AstNode *> stmts; \
+AST_KIND(_ComplexStmtBegin, "", struct {}) \
+	AST_KIND(BlockStmt, "block statement", struct { \
+		Array<Ast *> stmts; \
 		Token open, close; \
 		Token open, close; \
 	}) \
 	}) \
-	AST_NODE_KIND(IfStmt, "if statement", struct { \
-		Token token; \
-		AstNode *init; \
-		AstNode *cond; \
-		AstNode *body; \
-		AstNode *else_stmt; \
+	AST_KIND(IfStmt, "if statement", struct { \
+		Token token;     \
+		Ast * init;      \
+		Ast * cond;      \
+		Ast * body;      \
+		Ast * else_stmt; \
 	}) \
 	}) \
-	AST_NODE_KIND(WhenStmt, "when statement", struct { \
+	AST_KIND(WhenStmt, "when statement", struct { \
 		Token token; \
 		Token token; \
-		AstNode *cond; \
-		AstNode *body; \
-		AstNode *else_stmt; \
+		Ast *cond; \
+		Ast *body; \
+		Ast *else_stmt; \
 		bool is_cond_determined; \
 		bool is_cond_determined; \
 		bool determined_cond; \
 		bool determined_cond; \
 	}) \
 	}) \
-	AST_NODE_KIND(ReturnStmt, "return statement", struct { \
+	AST_KIND(ReturnStmt, "return statement", struct { \
 		Token token; \
 		Token token; \
-		Array<AstNode *> results; \
+		Array<Ast *> results; \
 	}) \
 	}) \
-	AST_NODE_KIND(ForStmt, "for statement", struct { \
-		Token    token; \
-		AstNode *label; \
-		AstNode *init; \
-		AstNode *cond; \
-		AstNode *post; \
-		AstNode *body; \
+	AST_KIND(ForStmt, "for statement", struct { \
+		Token token; \
+		Ast *label; \
+		Ast *init; \
+		Ast *cond; \
+		Ast *post; \
+		Ast *body; \
 	}) \
 	}) \
-	AST_NODE_KIND(RangeStmt, "range statement", struct { \
-		Token    token; \
-		AstNode *label; \
-		AstNode *val0; \
-		AstNode *val1; \
-		Token    in_token; \
-		AstNode *expr; \
-		AstNode *body; \
-	}) \
-	AST_NODE_KIND(CaseClause, "case clause", struct { \
+	AST_KIND(RangeStmt, "range statement", struct { \
+		Token token; \
+		Ast *label; \
+		Ast *val0; \
+		Ast *val1; \
+		Token in_token; \
+		Ast *expr; \
+		Ast *body; \
+	}) \
+	AST_KIND(CaseClause, "case clause", struct { \
 		Token token;             \
 		Token token;             \
-		Array<AstNode *> list;   \
-		Array<AstNode *> stmts;  \
+		Array<Ast *> list;   \
+		Array<Ast *> stmts;  \
 		Entity *implicit_entity; \
 		Entity *implicit_entity; \
 	}) \
 	}) \
-	AST_NODE_KIND(SwitchStmt, "switch statement", struct { \
-		Token    token;    \
-		AstNode *label;    \
-		AstNode *init;     \
-		AstNode *tag;      \
-		AstNode *body;     \
-		bool     complete; \
-	}) \
-	AST_NODE_KIND(TypeSwitchStmt, "type switch statement", struct { \
-		Token    token;    \
-		AstNode *label;    \
-		AstNode *tag;      \
-		AstNode *body;     \
-		bool     complete; \
-	}) \
-	AST_NODE_KIND(DeferStmt,  "defer statement",  struct { Token token; AstNode *stmt; }) \
-	AST_NODE_KIND(BranchStmt, "branch statement", struct { Token token; AstNode *label; }) \
-	AST_NODE_KIND(UsingStmt,  "using statement",  struct { \
-		Token token;   \
-		Array<AstNode *> list; \
+	AST_KIND(SwitchStmt, "switch statement", struct { \
+		Token token;    \
+		Ast *label;    \
+		Ast *init;     \
+		Ast *tag;      \
+		Ast *body;     \
+		bool complete; \
 	}) \
 	}) \
-	AST_NODE_KIND(PushContext, "context <- statement", struct { \
+	AST_KIND(TypeSwitchStmt, "type switch statement", struct { \
 		Token token;   \
 		Token token;   \
-		AstNode *expr; \
-		AstNode *body; \
-	}) \
-AST_NODE_KIND(_ComplexStmtEnd, "", struct {}) \
-AST_NODE_KIND(_StmtEnd,        "", struct {}) \
-AST_NODE_KIND(_DeclBegin,      "", struct {}) \
-	AST_NODE_KIND(BadDecl,     "bad declaration",     struct { Token begin, end; }) \
-	AST_NODE_KIND(ForeignBlockDecl, "foreign block declaration", struct { \
-		Token            token;           \
-		AstNode *        foreign_library; \
-		AstNode *        body;            \
-		Array<AstNode *> attributes;      \
-		CommentGroup *   docs;            \
-	}) \
-	AST_NODE_KIND(Label, "label", struct { 	\
+		Ast *label;    \
+		Ast *tag;      \
+		Ast *body;     \
+		bool complete; \
+	}) \
+	AST_KIND(DeferStmt,  "defer statement",  struct { Token token; Ast *stmt; }) \
+	AST_KIND(BranchStmt, "branch statement", struct { Token token; Ast *label; }) \
+	AST_KIND(UsingStmt,  "using statement",  struct { \
+		Token token; \
+		Array<Ast *> list; \
+	}) \
+	AST_KIND(PushContext, "context <- statement", struct { \
+		Token token; \
+		Ast *expr; \
+		Ast *body; \
+	}) \
+AST_KIND(_ComplexStmtEnd, "", struct {}) \
+AST_KIND(_StmtEnd,        "", struct {}) \
+AST_KIND(_DeclBegin,      "", struct {}) \
+	AST_KIND(BadDecl,     "bad declaration",     struct { Token begin, end; }) \
+	AST_KIND(ForeignBlockDecl, "foreign block declaration", struct { \
+		Token token;             \
+		Ast *foreign_library;    \
+		Ast *body;               \
+		Array<Ast *> attributes; \
+		CommentGroup *docs;      \
+	}) \
+	AST_KIND(Label, "label", struct { 	\
 		Token token; \
 		Token token; \
-		AstNode *name; \
-	}) \
-	AST_NODE_KIND(ValueDecl, "value declaration", struct { \
-		Array<AstNode *> names;        \
-		AstNode *        type;         \
-		Array<AstNode *> values;       \
-		Array<AstNode *> attributes;   \
-		CommentGroup *   docs;         \
-		CommentGroup *   comment;      \
-		bool             is_using;     \
-		bool             is_mutable;   \
-	}) \
-	AST_NODE_KIND(PackageDecl, "package declaration", struct { \
+		Ast *name; \
+	}) \
+	AST_KIND(ValueDecl, "value declaration", struct { \
+		Array<Ast *> names;       \
+		Ast *        type;        \
+		Array<Ast *> values;      \
+		Array<Ast *> attributes;  \
+		CommentGroup *docs;       \
+		CommentGroup *comment;    \
+		bool          is_using;   \
+		bool          is_mutable; \
+	}) \
+	AST_KIND(PackageDecl, "package declaration", struct { \
 		Token token;           \
 		Token token;           \
 		Token name;            \
 		Token name;            \
 		CommentGroup *docs;    \
 		CommentGroup *docs;    \
 		CommentGroup *comment; \
 		CommentGroup *comment; \
 	}) \
 	}) \
-	AST_NODE_KIND(ImportDecl, "import declaration", struct { \
+	AST_KIND(ImportDecl, "import declaration", struct { \
 		AstPackage *package;    \
 		AstPackage *package;    \
 		Token    token;         \
 		Token    token;         \
 		Token    relpath;       \
 		Token    relpath;       \
@@ -368,7 +368,7 @@ AST_NODE_KIND(_DeclBegin,      "", struct {}) \
 		CommentGroup *comment;  \
 		CommentGroup *comment;  \
 		bool     is_using;      \
 		bool     is_using;      \
 	}) \
 	}) \
-	AST_NODE_KIND(ForeignImportDecl, "foreign import declaration", struct { \
+	AST_KIND(ForeignImportDecl, "foreign import declaration", struct { \
 		Token    token;           \
 		Token    token;           \
 		Token    filepath;        \
 		Token    filepath;        \
 		Token    library_name;    \
 		Token    library_name;    \
@@ -377,170 +377,170 @@ AST_NODE_KIND(_DeclBegin,      "", struct {}) \
 		CommentGroup *docs;       \
 		CommentGroup *docs;       \
 		CommentGroup *comment;    \
 		CommentGroup *comment;    \
 	}) \
 	}) \
-AST_NODE_KIND(_DeclEnd,   "", struct {}) \
-	AST_NODE_KIND(Attribute, "attribute", struct { \
-		Token    token;         \
-		AstNode *type;          \
-		Array<AstNode *> elems; \
-		Token open, close;      \
-	}) \
-	AST_NODE_KIND(Field, "field", struct { \
-		Array<AstNode *> names;            \
-		AstNode *        type;             \
-		AstNode *        default_value;    \
-		u32              flags;            \
-		CommentGroup *   docs;             \
-		CommentGroup *   comment;          \
-	}) \
-	AST_NODE_KIND(FieldList, "field list", struct { \
+AST_KIND(_DeclEnd,   "", struct {}) \
+	AST_KIND(Attribute, "attribute", struct { \
+		Token token;        \
+		Ast *type;          \
+		Array<Ast *> elems; \
+		Token open, close;  \
+	}) \
+	AST_KIND(Field, "field", struct { \
+		Array<Ast *> names;         \
+		Ast *        type;          \
+		Ast *        default_value; \
+		u32              flags;     \
+		CommentGroup *   docs;      \
+		CommentGroup *   comment;   \
+	}) \
+	AST_KIND(FieldList, "field list", struct { \
+		Token token;       \
+		Array<Ast *> list; \
+	}) \
+	AST_KIND(UnionField, "union field", struct { \
+		Ast *name; \
+		Ast *list; \
+	}) \
+AST_KIND(_TypeBegin, "", struct {}) \
+	AST_KIND(TypeType, "type", struct { \
 		Token token; \
 		Token token; \
-		Array<AstNode *> list; \
-	}) \
-	AST_NODE_KIND(UnionField, "union field", struct { \
-		AstNode *name; \
-		AstNode *list; \
+		Ast *specialization; \
 	}) \
 	}) \
-AST_NODE_KIND(_TypeBegin, "", struct {}) \
-	AST_NODE_KIND(TypeType, "type", struct { \
+	AST_KIND(HelperType, "helper type", struct { \
 		Token token; \
 		Token token; \
-		AstNode *specialization; \
+		Ast *type; \
 	}) \
 	}) \
-	AST_NODE_KIND(HelperType, "helper type", struct { \
+	AST_KIND(DistinctType, "distinct type", struct { \
 		Token token; \
 		Token token; \
-		AstNode *type; \
+		Ast *type; \
 	}) \
 	}) \
-	AST_NODE_KIND(DistinctType, "distinct type", struct { \
-		Token token; \
-		AstNode *type; \
-	}) \
-	AST_NODE_KIND(PolyType, "polymorphic type", struct { \
+	AST_KIND(PolyType, "polymorphic type", struct { \
 		Token    token; \
 		Token    token; \
-		AstNode *type;  \
-		AstNode *specialization;  \
-	}) \
-	AST_NODE_KIND(ProcType, "procedure type", struct { \
-		Token    token;   \
-		AstNode *params;  \
-		AstNode *results; \
-		u64      tags;    \
+		Ast *type;  \
+		Ast *specialization;  \
+	}) \
+	AST_KIND(ProcType, "procedure type", struct { \
+		Token token;   \
+		Ast *params;  \
+		Ast *results; \
+		u64 tags;    \
 		ProcCallingConvention calling_convention; \
 		ProcCallingConvention calling_convention; \
-		bool     generic; \
+		bool generic; \
 	}) \
 	}) \
-	AST_NODE_KIND(PointerType, "pointer type", struct { \
+	AST_KIND(PointerType, "pointer type", struct { \
 		Token token; \
 		Token token; \
-		AstNode *type; \
+		Ast *type; \
 	}) \
 	}) \
-	AST_NODE_KIND(ArrayType, "array type", struct { \
+	AST_KIND(ArrayType, "array type", struct { \
 		Token token; \
 		Token token; \
-		AstNode *count; \
-		AstNode *elem; \
+		Ast *count; \
+		Ast *elem; \
 	}) \
 	}) \
-	AST_NODE_KIND(DynamicArrayType, "dynamic array type", struct { \
+	AST_KIND(DynamicArrayType, "dynamic array type", struct { \
 		Token token; \
 		Token token; \
-		AstNode *elem; \
-	}) \
-	AST_NODE_KIND(StructType, "struct type", struct { \
-		Token            token;               \
-		Array<AstNode *> fields;              \
-		isize            field_count;         \
-		AstNode *        polymorphic_params;  \
-		AstNode *        align;               \
-		bool             is_packed;           \
-		bool             is_raw_union;        \
-	}) \
-	AST_NODE_KIND(UnionType, "union type", struct { \
-		Token            token;    \
-		Array<AstNode *> variants; \
-		AstNode *        align;    \
-	}) \
-	AST_NODE_KIND(EnumType, "enum type", struct { \
-		Token            token; \
-		AstNode *        base_type; \
-		Array<AstNode *> fields; /* FieldValue */ \
-		bool             is_export; \
-	}) \
-	AST_NODE_KIND(BitFieldType, "bit field type", struct { \
-		Token            token; \
-		Array<AstNode *> fields; /* FieldValue with : */ \
-		AstNode *        align; \
-	}) \
-	AST_NODE_KIND(MapType, "map type", struct { \
-		Token    token; \
-		AstNode *count; \
-		AstNode *key; \
-		AstNode *value; \
-	}) \
-AST_NODE_KIND(_TypeEnd,  "", struct {})
-
-enum AstNodeKind {
-	AstNode_Invalid,
-#define AST_NODE_KIND(_kind_name_, ...) GB_JOIN2(AstNode_, _kind_name_),
-	AST_NODE_KINDS
-#undef AST_NODE_KIND
-	AstNode_Count,
+		Ast *elem; \
+	}) \
+	AST_KIND(StructType, "struct type", struct { \
+		Token token;              \
+		Array<Ast *> fields;      \
+		isize field_count;        \
+		Ast *polymorphic_params;  \
+		Ast *align;               \
+		bool is_packed;           \
+		bool is_raw_union;        \
+	}) \
+	AST_KIND(UnionType, "union type", struct { \
+		Token        token;    \
+		Array<Ast *> variants; \
+		Ast *        align;    \
+	}) \
+	AST_KIND(EnumType, "enum type", struct { \
+		Token        token; \
+		Ast *        base_type; \
+		Array<Ast *> fields; /* FieldValue */ \
+		bool         is_export; \
+	}) \
+	AST_KIND(BitFieldType, "bit field type", struct { \
+		Token        token; \
+		Array<Ast *> fields; /* FieldValue with : */ \
+		Ast *        align; \
+	}) \
+	AST_KIND(MapType, "map type", struct { \
+		Token token; \
+		Ast *count; \
+		Ast *key; \
+		Ast *value; \
+	}) \
+AST_KIND(_TypeEnd,  "", struct {})
+
+enum AstKind {
+	Ast_Invalid,
+#define AST_KIND(_kind_name_, ...) GB_JOIN2(Ast_, _kind_name_),
+	AST_KINDS
+#undef AST_KIND
+	Ast_COUNT,
 };
 };
 
 
-String const ast_node_strings[] = {
+String const ast_strings[] = {
 	{cast(u8 *)"invalid node", gb_size_of("invalid node")},
 	{cast(u8 *)"invalid node", gb_size_of("invalid node")},
-#define AST_NODE_KIND(_kind_name_, name, ...) {cast(u8 *)name, gb_size_of(name)-1},
-	AST_NODE_KINDS
-#undef AST_NODE_KIND
+#define AST_KIND(_kind_name_, name, ...) {cast(u8 *)name, gb_size_of(name)-1},
+	AST_KINDS
+#undef AST_KIND
 };
 };
 
 
 
 
-#define AST_NODE_KIND(_kind_name_, name, ...) typedef __VA_ARGS__ GB_JOIN2(AstNode, _kind_name_);
-	AST_NODE_KINDS
-#undef AST_NODE_KIND
+#define AST_KIND(_kind_name_, name, ...) typedef __VA_ARGS__ GB_JOIN2(Ast, _kind_name_);
+	AST_KINDS
+#undef AST_KIND
 
 
 
 
-isize const ast_node_sizes[] = {
+isize const ast_variant_sizes[] = {
 	0,
 	0,
-#define AST_NODE_KIND(_kind_name_, name, ...) gb_size_of(GB_JOIN2(AstNode, _kind_name_)),
-	AST_NODE_KINDS
-#undef AST_NODE_KIND
+#define AST_KIND(_kind_name_, name, ...) gb_size_of(GB_JOIN2(Ast, _kind_name_)),
+	AST_KINDS
+#undef AST_KIND
 };
 };
 
 
-struct AstNode {
-	AstNodeKind kind;
-	u32         stmt_state_flags;
-	AstFile *   file;
-	Scope *     scope;
-	bool        been_handled;
+struct Ast {
+	AstKind  kind;
+	u32      stmt_state_flags;
+	AstFile *file;
+	Scope *  scope;
+	bool     been_handled;
 
 
 	union {
 	union {
-#define AST_NODE_KIND(_kind_name_, name, ...) GB_JOIN2(AstNode, _kind_name_) _kind_name_;
-	AST_NODE_KINDS
-#undef AST_NODE_KIND
+#define AST_KIND(_kind_name_, name, ...) GB_JOIN2(Ast, _kind_name_) _kind_name_;
+	AST_KINDS
+#undef AST_KIND
 	};
 	};
 };
 };
 
 
 
 
-#define ast_node(n_, Kind_, node_) GB_JOIN2(AstNode, Kind_) *n_ = &(node_)->Kind_; GB_ASSERT_MSG((node_)->kind == GB_JOIN2(AstNode_, Kind_), \
+#define ast_node(n_, Kind_, node_) GB_JOIN2(Ast, Kind_) *n_ = &(node_)->Kind_; GB_ASSERT_MSG((node_)->kind == GB_JOIN2(Ast_, Kind_), \
 	"expected '%.*s' got '%.*s'", \
 	"expected '%.*s' got '%.*s'", \
-	LIT(ast_node_strings[GB_JOIN2(AstNode_, Kind_)]), LIT(ast_node_strings[(node_)->kind]))
-#define case_ast_node(n_, Kind_, node_) case GB_JOIN2(AstNode_, Kind_): { ast_node(n_, Kind_, node_);
+	LIT(ast_strings[GB_JOIN2(Ast_, Kind_)]), LIT(ast_strings[(node_)->kind]))
+#define case_ast_node(n_, Kind_, node_) case GB_JOIN2(Ast_, Kind_): { ast_node(n_, Kind_, node_);
 #ifndef case_end
 #ifndef case_end
 #define case_end } break;
 #define case_end } break;
 #endif
 #endif
 
 
 
 
-gb_inline bool is_ast_node_expr(AstNode *node) {
-	return gb_is_between(node->kind, AstNode__ExprBegin+1, AstNode__ExprEnd-1);
+gb_inline bool is_ast_expr(Ast *node) {
+	return gb_is_between(node->kind, Ast__ExprBegin+1, Ast__ExprEnd-1);
 }
 }
-gb_inline bool is_ast_node_stmt(AstNode *node) {
-	return gb_is_between(node->kind, AstNode__StmtBegin+1, AstNode__StmtEnd-1);
+gb_inline bool is_ast_stmt(Ast *node) {
+	return gb_is_between(node->kind, Ast__StmtBegin+1, Ast__StmtEnd-1);
 }
 }
-gb_inline bool is_ast_node_complex_stmt(AstNode *node) {
-	return gb_is_between(node->kind, AstNode__ComplexStmtBegin+1, AstNode__ComplexStmtEnd-1);
+gb_inline bool is_ast_complex_stmt(Ast *node) {
+	return gb_is_between(node->kind, Ast__ComplexStmtBegin+1, Ast__ComplexStmtEnd-1);
 }
 }
-gb_inline bool is_ast_node_decl(AstNode *node) {
-	return gb_is_between(node->kind, AstNode__DeclBegin+1, AstNode__DeclEnd-1);
+gb_inline bool is_ast_decl(Ast *node) {
+	return gb_is_between(node->kind, Ast__DeclBegin+1, Ast__DeclEnd-1);
 }
 }
-gb_inline bool is_ast_node_type(AstNode *node) {
-	return gb_is_between(node->kind, AstNode__TypeBegin+1, AstNode__TypeEnd-1);
+gb_inline bool is_ast_type(Ast *node) {
+	return gb_is_between(node->kind, Ast__TypeBegin+1, Ast__TypeEnd-1);
 }
 }
-gb_inline bool is_ast_node_when_stmt(AstNode *node) {
-	return node->kind == AstNode_WhenStmt;
+gb_inline bool is_ast_when_stmt(Ast *node) {
+	return node->kind == Ast_WhenStmt;
 }
 }
 
 
 gb_global Arena global_ast_arena = {};
 gb_global Arena global_ast_arena = {};
@@ -550,4 +550,4 @@ gbAllocator ast_allocator(void) {
 	return arena_allocator(arena);
 	return arena_allocator(arena);
 }
 }
 
 
-AstNode *alloc_ast_node(AstFile *f, AstNodeKind kind);
+Ast *alloc_ast_node(AstFile *f, AstKind kind);

+ 5 - 5
src/types.cpp

@@ -1,5 +1,5 @@
 struct Scope;
 struct Scope;
-struct AstNode;
+struct Ast;
 
 
 enum BasicKind {
 enum BasicKind {
 	Basic_Invalid,
 	Basic_Invalid,
@@ -81,7 +81,7 @@ struct BasicType {
 
 
 struct TypeStruct {
 struct TypeStruct {
 	Array<Entity *> fields;
 	Array<Entity *> fields;
-	AstNode *node;
+	Ast *node;
 	Scope *  scope;
 	Scope *  scope;
 
 
 	Array<i64> offsets;
 	Array<i64> offsets;
@@ -130,7 +130,7 @@ struct TypeStruct {
 	TYPE_KIND(Struct,  TypeStruct)                        \
 	TYPE_KIND(Struct,  TypeStruct)                        \
 	TYPE_KIND(Enum, struct {                              \
 	TYPE_KIND(Enum, struct {                              \
 		Array<Entity *> fields;                           \
 		Array<Entity *> fields;                           \
-		AstNode *node;                                    \
+		Ast *node;                                    \
 		Scope *  scope;                                   \
 		Scope *  scope;                                   \
 		Entity * names;                                   \
 		Entity * names;                                   \
 		Type *   base_type;                               \
 		Type *   base_type;                               \
@@ -141,7 +141,7 @@ struct TypeStruct {
 	})                                                    \
 	})                                                    \
 	TYPE_KIND(Union, struct {                             \
 	TYPE_KIND(Union, struct {                             \
 		Array<Type *> variants;                           \
 		Array<Type *> variants;                           \
-		AstNode *node;                                    \
+		Ast *node;                                    \
 		Scope *  scope;                                   \
 		Scope *  scope;                                   \
 		i64      variant_block_size;                      \
 		i64      variant_block_size;                      \
 		i64      custom_align;                            \
 		i64      custom_align;                            \
@@ -153,7 +153,7 @@ struct TypeStruct {
 		bool            are_offsets_set;                  \
 		bool            are_offsets_set;                  \
 	})                                                    \
 	})                                                    \
 	TYPE_KIND(Proc, struct {                              \
 	TYPE_KIND(Proc, struct {                              \
-		AstNode *node;                                    \
+		Ast *node;                                    \
 		Scope *  scope;                                   \
 		Scope *  scope;                                   \
 		Type *   params;  /* Type_Tuple */                \
 		Type *   params;  /* Type_Tuple */                \
 		Type *   results; /* Type_Tuple */                \
 		Type *   results; /* Type_Tuple */                \

Some files were not shown because too many files changed in this diff