mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-26 08:31:44 +00:00
saves/loads flags of nkIdent node
This commit is contained in:
@@ -266,11 +266,14 @@ proc fromNif(c: var DecodeContext; n: var Cursor): PNode =
|
||||
result.flags = flags
|
||||
skipParRi n
|
||||
of nkIdent:
|
||||
inc n
|
||||
let info = c.fromNifLineInfo(n)
|
||||
incExpect n, {DotToken, Ident}
|
||||
let flags = fromNifNodeFlags n
|
||||
let typ = c.fromNifType n
|
||||
expect n, Ident
|
||||
result = newIdentNode(c.graph.cache.getIdent(pool.strings[n.litId]), c.fromNifLineInfo(n))
|
||||
result = newIdentNode(c.graph.cache.getIdent(pool.strings[n.litId]), info)
|
||||
inc n
|
||||
result.flags = flags
|
||||
result.typ = typ
|
||||
skipParRi n
|
||||
of nkSym:
|
||||
|
||||
@@ -147,11 +147,9 @@ proc toNif(c: var EncodeContext; n: PNode) =
|
||||
c.dest.writeNodeFlags(n.flags)
|
||||
c.dest.addParRi
|
||||
of nkIdent:
|
||||
let info = c.toNif n.info
|
||||
c.dest.addParLe pool.tags.getOrIncl(toNifTag(nkIdent)), info
|
||||
c.toNif n.typ
|
||||
c.dest.addIdent n.ident.s
|
||||
c.dest.addParRi
|
||||
# nkIdent uses flags and typ when it is a generic parameter
|
||||
c.withNode n:
|
||||
c.dest.addIdent n.ident.s
|
||||
of nkSym:
|
||||
when false:
|
||||
echo "nkSym: ", n.sym.name.s
|
||||
|
||||
@@ -257,7 +257,7 @@ proc eql(x, y: PNode; c: var EqlContext): bool =
|
||||
echo "node kind mismatch: ", x.kind, "/", y.kind
|
||||
result = false
|
||||
elif x.flags != y.flags:
|
||||
echo "node flag mismatch: ", x.flags, "/", y.flags
|
||||
echo "node flag mismatch: ", x.flags, "/", y.flags, " at ", `$`(c.confX, x.info)
|
||||
debug(x)
|
||||
debug(y)
|
||||
result = false
|
||||
@@ -338,7 +338,7 @@ proc testNifEncDec(graph: ModuleGraph; src: string) =
|
||||
let n2 = loadNifFromBuffer(nif, graphForLoad)
|
||||
#debug(n2)
|
||||
var c = EqlContext(confX: graph.config, confY: graphForLoad.config)
|
||||
assert eql(n, n2, c)
|
||||
assert eql(n, n2, c), "test failed: " & $fullPath
|
||||
|
||||
var conf = newConfigRefForTest()
|
||||
var cache = newIdentCache()
|
||||
|
||||
Reference in New Issue
Block a user