Skip to content

Commit

Permalink
use a map instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed May 17, 2024
1 parent 173e9e6 commit 3020717
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions std/reflection.pr
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ export type TupleT = &struct {
elements: &[weak Type]
}

var types: &[Type]

type TypeKind = enum {
BOOL
WORD
Expand All @@ -175,13 +173,18 @@ type TypeKind = enum {
}

import io
import map

var types: &Map(size_t, Type)

// Type registry functions
def load_types(data: [uint8], num: size_t, strings: *char) {
let fp = io::open_memory_as_file(data, "r")
defer close(fp)

types = allocate_ref(Type, num)
if not types {
types = map::make(size_t, Type)
}

var index = 0
while index < num {
Expand Down

0 comments on commit 3020717

Please sign in to comment.