more fixes to get rid of tyPureObject
This commit is contained in:
parent
98e5beb936
commit
92543a3037
4 changed files with 8 additions and 8 deletions
|
|
@ -498,7 +498,7 @@ proc getTypeDescAux(m: BModule, typ: PType, check: var TIntSet): PRope =
|
||||||
if not isImportedType(t):
|
if not isImportedType(t):
|
||||||
appf(m.s[cfsTypes], "typedef NU8 $1[$2];$n",
|
appf(m.s[cfsTypes], "typedef NU8 $1[$2];$n",
|
||||||
[result, toRope(getSize(t))])
|
[result, toRope(getSize(t))])
|
||||||
of tyGenericInst, tyDistinct, tyOrdinal:
|
of tyGenericInst, tyDistinct, tyOrdinal, tyConst, tyMutable, tyIter:
|
||||||
result = getTypeDescAux(m, lastSon(t), check)
|
result = getTypeDescAux(m, lastSon(t), check)
|
||||||
else:
|
else:
|
||||||
InternalError("getTypeDescAux(" & $t.kind & ')')
|
InternalError("getTypeDescAux(" & $t.kind & ')')
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ proc storeAux(dest, src: Pointer, mt: PNimType, t: PRawChannel,
|
||||||
# XXX use dynamic type here!
|
# XXX use dynamic type here!
|
||||||
pint[] = mt
|
pint[] = mt
|
||||||
storeAux(dest, src, mt.node, t, mode)
|
storeAux(dest, src, mt.node, t, mode)
|
||||||
of tyTuple, tyPureObject:
|
of tyTuple:
|
||||||
storeAux(dest, src, mt.node, t, mode)
|
storeAux(dest, src, mt.node, t, mode)
|
||||||
of tyArray, tyArrayConstr:
|
of tyArray, tyArrayConstr:
|
||||||
for i in 0..(mt.size div mt.base.size)-1:
|
for i in 0..(mt.size div mt.base.size)-1:
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ include "system/hti"
|
||||||
proc isFatPointer(ti: PNimType): bool =
|
proc isFatPointer(ti: PNimType): bool =
|
||||||
# This has to be consistent with the code generator!
|
# This has to be consistent with the code generator!
|
||||||
return ti.base.kind notin {tyObject,
|
return ti.base.kind notin {tyObject,
|
||||||
tyArray, tyArrayConstr, tyPureObject, tyTuple,
|
tyArray, tyArrayConstr, tyTuple,
|
||||||
tyOpenArray, tySet, tyVar, tyRef, tyPtr}
|
tyOpenArray, tySet, tyVar, tyRef, tyPtr}
|
||||||
|
|
||||||
proc NimCopy(x: pointer, ti: PNimType): pointer {.compilerproc.}
|
proc NimCopy(x: pointer, ti: PNimType): pointer {.compilerproc.}
|
||||||
|
|
@ -439,7 +439,7 @@ proc NimCopy(x: pointer, ti: PNimType): pointer =
|
||||||
`result` = {};
|
`result` = {};
|
||||||
for (var key in `x`) { `result`[key] = `x`[key]; }
|
for (var key in `x`) { `result`[key] = `x`[key]; }
|
||||||
"""
|
"""
|
||||||
of tyPureObject, tyTuple, tyObject:
|
of tyTuple, tyObject:
|
||||||
if ti.base != nil: result = NimCopy(x, ti.base)
|
if ti.base != nil: result = NimCopy(x, ti.base)
|
||||||
elif ti.kind == tyObject:
|
elif ti.kind == tyObject:
|
||||||
asm "`result` = {m_type: `ti`};"
|
asm "`result` = {m_type: `ti`};"
|
||||||
|
|
|
||||||
|
|
@ -10,17 +10,17 @@ macro call(e: expr): expr =
|
||||||
|
|
||||||
macro dumpAST(n: stmt): stmt =
|
macro dumpAST(n: stmt): stmt =
|
||||||
# dump AST as a side-effect and return the inner node
|
# dump AST as a side-effect and return the inner node
|
||||||
echo n.prettyPrint
|
echo n.toLisp
|
||||||
echo n.toYaml
|
echo n.toYaml
|
||||||
|
|
||||||
var plusAst = getAst(plus(1, 2))
|
var plusAst = getAst(plus(1, 2))
|
||||||
echo plusAst.prettyPrint
|
echo plusAst.toLisp
|
||||||
|
|
||||||
var callAst = getAst(call())
|
var callAst = getAst(call())
|
||||||
echo callAst.prettyPrint
|
echo callAst.toLisp
|
||||||
|
|
||||||
var e = parseExpr("foo(bar + baz)")
|
var e = parseExpr("foo(bar + baz)")
|
||||||
echo e.prettyPrint
|
echo e.toLisp
|
||||||
|
|
||||||
result = n[1]
|
result = n[1]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue