upgrade enum discriminants
This commit is contained in:
@@ -254,6 +254,19 @@ Global :: struct {
|
||||
diagnostic: source.Diagnostic_Id,
|
||||
}
|
||||
|
||||
Enum_Value :: struct {
|
||||
expr: Expr_Id,
|
||||
span: source.Span,
|
||||
explicit: bool,
|
||||
}
|
||||
|
||||
Enum_Declaration :: struct {
|
||||
type: types.Type,
|
||||
pkg: Package_Id,
|
||||
file: File_Id,
|
||||
values: []Enum_Value,
|
||||
}
|
||||
|
||||
Import :: struct {
|
||||
span: source.Span,
|
||||
alias: symbol.Id,
|
||||
@@ -326,6 +339,7 @@ Module :: struct {
|
||||
statements: [dynamic]Stmt,
|
||||
functions: [dynamic]Function,
|
||||
globals: [dynamic]Global,
|
||||
enum_declarations: [dynamic]Enum_Declaration,
|
||||
imports: [dynamic]Import,
|
||||
aliases: [dynamic]Declaration_Alias,
|
||||
files: [dynamic]File,
|
||||
@@ -347,6 +361,7 @@ init_module :: proc(allocator := context.allocator) -> Module {
|
||||
module.statements.allocator = allocator
|
||||
module.functions.allocator = allocator
|
||||
module.globals.allocator = allocator
|
||||
module.enum_declarations.allocator = allocator
|
||||
module.imports.allocator = allocator
|
||||
module.aliases.allocator = allocator
|
||||
module.files.allocator = allocator
|
||||
@@ -382,6 +397,9 @@ destroy_module :: proc(module: ^Module) {
|
||||
for global in module.globals {
|
||||
delete(global.link_name, module.allocator)
|
||||
}
|
||||
for declaration in module.enum_declarations {
|
||||
delete(declaration.values, module.allocator)
|
||||
}
|
||||
for pkg in module.packages {
|
||||
delete(pkg.path, module.allocator)
|
||||
}
|
||||
@@ -400,6 +418,7 @@ destroy_module :: proc(module: ^Module) {
|
||||
delete(module.statements)
|
||||
delete(module.functions)
|
||||
delete(module.globals)
|
||||
delete(module.enum_declarations)
|
||||
delete(module.imports)
|
||||
delete(module.aliases)
|
||||
delete(module.files)
|
||||
|
||||
Reference in New Issue
Block a user