intern identifiers

This commit is contained in:
2026-06-10 21:27:00 +02:00
parent d6e03b6f08
commit cdbe4fbc99
16 changed files with 497 additions and 182 deletions
+9 -9
View File
@@ -1,6 +1,7 @@
package ast
import "../source"
import "../symbol"
import "core:mem"
INVALID_ID :: -1
@@ -26,8 +27,8 @@ Expr_Kind :: enum {
Expr :: struct {
kind: Expr_Kind,
span: source.Span,
qualifier: string,
text: string,
qualifier: symbol.Id,
name: symbol.Id,
integer: i64,
left: int,
right: int,
@@ -36,7 +37,7 @@ Expr :: struct {
}
Param :: struct {
name: string,
name: symbol.Id,
span: source.Span,
type: Type_Syntax,
}
@@ -52,7 +53,7 @@ Stmt_Kind :: enum {
Stmt :: struct {
kind: Stmt_Kind,
span: source.Span,
name: string,
name: symbol.Id,
type: Type_Syntax,
immutable: bool,
expr: int,
@@ -61,7 +62,7 @@ Stmt :: struct {
Function :: struct {
span: source.Span,
name: string,
name: symbol.Id,
pkg: int,
file: int,
c_abi: bool,
@@ -73,7 +74,7 @@ Function :: struct {
Global :: struct {
span: source.Span,
name: string,
name: symbol.Id,
pkg: int,
file: int,
type: Type_Syntax,
@@ -84,7 +85,7 @@ Global :: struct {
Import :: struct {
span: source.Span,
alias: string,
alias: symbol.Id,
path: string,
pkg: int,
file: int,
@@ -101,7 +102,7 @@ File :: struct {
Package :: struct {
path: string,
name: string,
name: symbol.Id,
available: bool,
}
@@ -142,7 +143,6 @@ destroy_module :: proc(module: ^Module) {
}
for pkg in module.packages {
delete(pkg.path, module.allocator)
delete(pkg.name, module.allocator)
}
delete(module.exprs)
delete(module.statements)