mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
* removed dead code * beginnings of a rodfile reader * IC: record global VM state changes and pragma state changes * IC: replay pragmas and VM state changes * implemented rod load file simuation for easier, extensive testing * critical bugfix * IC: stress test logic; should also help with recursive module dependencies; WIP * IC: loading from .rod files begins to work reliably * removed ugly hacks * yet another silly mistake
45 lines
1.3 KiB
Nim
45 lines
1.3 KiB
Nim
#
|
|
#
|
|
# The Nim Compiler
|
|
# (c) Copyright 2018 Andreas Rumpf
|
|
#
|
|
# See the file "copying.txt", included in this
|
|
# distribution, for details about the copyright.
|
|
#
|
|
|
|
## This module implements helpers for the macro cache.
|
|
|
|
import lineinfos, ast, vmdef
|
|
|
|
proc append(c: PCtx; n: PNode) =
|
|
c.vmstateDiff.add((c.module, n))
|
|
|
|
proc recordInc*(c: PCtx; info: TLineInfo; key: string; by: BiggestInt) =
|
|
var recorded = newNodeI(nkReplayAction, info)
|
|
recorded.add newStrNode("inc", info)
|
|
recorded.add newStrNode(key, info)
|
|
recorded.add newIntNode(nkIntLit, by)
|
|
c.append(recorded)
|
|
|
|
proc recordPut*(c: PCtx; info: TLineInfo; key: string; k: string; val: PNode) =
|
|
var recorded = newNodeI(nkReplayAction, info)
|
|
recorded.add newStrNode("put", info)
|
|
recorded.add newStrNode(key, info)
|
|
recorded.add newStrNode(k, info)
|
|
recorded.add copyTree(val)
|
|
c.append(recorded)
|
|
|
|
proc recordAdd*(c: PCtx; info: TLineInfo; key: string; val: PNode) =
|
|
var recorded = newNodeI(nkReplayAction, info)
|
|
recorded.add newStrNode("add", info)
|
|
recorded.add newStrNode(key, info)
|
|
recorded.add copyTree(val)
|
|
c.append(recorded)
|
|
|
|
proc recordIncl*(c: PCtx; info: TLineInfo; key: string; val: PNode) =
|
|
var recorded = newNodeI(nkReplayAction, info)
|
|
recorded.add newStrNode("incl", info)
|
|
recorded.add newStrNode(key, info)
|
|
recorded.add copyTree(val)
|
|
c.append(recorded)
|