Skip to content

Commit

Permalink
just use object on arc/orc
Browse files Browse the repository at this point in the history
  • Loading branch information
metagn committed Oct 3, 2024
1 parent d6d031f commit d899d38
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions compiler/layeredtable.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type
nextLayer*: ref LayeredIdTableObj
previousLen*: int # used to track if bindings were added

const useRef = defined(gcMarkAndSweep)
const useRef = not defined(gcDestructors)

when useRef:
type LayeredIdTable* = ref LayeredIdTableObj
Expand Down Expand Up @@ -62,5 +62,8 @@ when not useRef:
template lookup*(typeMap: LayeredIdTableObj, key: PType): PType =
lookup(typeMap, key.itemId)

proc put*(typeMap: var LayeredIdTable, key, value: PType) {.inline.} =
typeMap.topLayer[key.itemId] = value
proc put(typeMap: var LayeredIdTable, key: ItemId, value: PType) {.inline.} =
typeMap.topLayer[key] = value

template put*(typeMap: var LayeredIdTable, key, value: PType) =
put(typeMap, key.itemId, value)

0 comments on commit d899d38

Please sign in to comment.