WIP: nothing works
This commit is contained in:
parent
700448f359
commit
abe0725ab1
3 changed files with 39 additions and 12 deletions
|
|
@ -144,9 +144,7 @@ proc semSet(c: PContext, n: PNode, prev: PType): PType =
|
||||||
localError(c.config, n.info, errXExpectsOneTypeParam % "set")
|
localError(c.config, n.info, errXExpectsOneTypeParam % "set")
|
||||||
addSonSkipIntLit(result, errorType(c))
|
addSonSkipIntLit(result, errorType(c))
|
||||||
|
|
||||||
proc semContainer(c: PContext, n: PNode, kind: TTypeKind, kindStr: string,
|
proc semContainerArg(c: PContext; n: PNode, kindStr: string; result: PType) =
|
||||||
prev: PType): PType =
|
|
||||||
result = newOrPrevType(kind, prev, c)
|
|
||||||
if sonsLen(n) == 2:
|
if sonsLen(n) == 2:
|
||||||
var base = semTypeNode(c, n.sons[1], nil)
|
var base = semTypeNode(c, n.sons[1], nil)
|
||||||
if base.kind == tyVoid:
|
if base.kind == tyVoid:
|
||||||
|
|
@ -156,6 +154,11 @@ proc semContainer(c: PContext, n: PNode, kind: TTypeKind, kindStr: string,
|
||||||
localError(c.config, n.info, errXExpectsOneTypeParam % kindStr)
|
localError(c.config, n.info, errXExpectsOneTypeParam % kindStr)
|
||||||
addSonSkipIntLit(result, errorType(c))
|
addSonSkipIntLit(result, errorType(c))
|
||||||
|
|
||||||
|
proc semContainer(c: PContext, n: PNode, kind: TTypeKind, kindStr: string,
|
||||||
|
prev: PType): PType =
|
||||||
|
result = newOrPrevType(kind, prev, c)
|
||||||
|
semContainerArg(c, n, kindStr, result)
|
||||||
|
|
||||||
proc semVarargs(c: PContext, n: PNode, prev: PType): PType =
|
proc semVarargs(c: PContext, n: PNode, prev: PType): PType =
|
||||||
result = newOrPrevType(tyVarargs, prev, c)
|
result = newOrPrevType(tyVarargs, prev, c)
|
||||||
if sonsLen(n) == 2 or sonsLen(n) == 3:
|
if sonsLen(n) == 2 or sonsLen(n) == 3:
|
||||||
|
|
@ -1505,6 +1508,26 @@ proc semTypeNode(c: PContext, n: PNode, prev: PType): PType =
|
||||||
of mSet: result = semSet(c, n, prev)
|
of mSet: result = semSet(c, n, prev)
|
||||||
of mOrdinal: result = semOrdinal(c, n, prev)
|
of mOrdinal: result = semOrdinal(c, n, prev)
|
||||||
of mSeq:
|
of mSeq:
|
||||||
|
let s = c.graph.sysTypes[tySequence]
|
||||||
|
assert s != nil
|
||||||
|
assert prev == nil
|
||||||
|
result = copyType(s, s.owner, keepId=false)
|
||||||
|
# XXX figure out why this has children already...
|
||||||
|
result.sons.setLen 0
|
||||||
|
result.n = nil
|
||||||
|
if c.config.selectedGc == gcDestructors:
|
||||||
|
result.flags = {tfHasAsgn}
|
||||||
|
else:
|
||||||
|
result.flags = {}
|
||||||
|
semContainerArg(c, n, "seq", result)
|
||||||
|
when false:
|
||||||
|
debugT = true
|
||||||
|
echo "Start!"
|
||||||
|
#debug result
|
||||||
|
assert(not containsGenericType(result))
|
||||||
|
debugT = false
|
||||||
|
echo "End!"
|
||||||
|
when false:
|
||||||
result = semContainer(c, n, tySequence, "seq", prev)
|
result = semContainer(c, n, tySequence, "seq", prev)
|
||||||
if c.config.selectedGc == gcDestructors:
|
if c.config.selectedGc == gcDestructors:
|
||||||
incl result.flags, tfHasAsgn
|
incl result.flags, tfHasAsgn
|
||||||
|
|
@ -1681,6 +1704,7 @@ proc processMagicType(c: PContext, m: PSym) =
|
||||||
of mString:
|
of mString:
|
||||||
setMagicType(c.config, m, tyString, c.config.target.ptrSize)
|
setMagicType(c.config, m, tyString, c.config.target.ptrSize)
|
||||||
rawAddSon(m.typ, getSysType(c.graph, m.info, tyChar))
|
rawAddSon(m.typ, getSysType(c.graph, m.info, tyChar))
|
||||||
|
when false:
|
||||||
if c.config.selectedGc == gcDestructors:
|
if c.config.selectedGc == gcDestructors:
|
||||||
incl m.typ.flags, tfHasAsgn
|
incl m.typ.flags, tfHasAsgn
|
||||||
of mCstring:
|
of mCstring:
|
||||||
|
|
@ -1724,6 +1748,8 @@ proc processMagicType(c: PContext, m: PSym) =
|
||||||
setMagicType(c.config, m, tySequence, 0)
|
setMagicType(c.config, m, tySequence, 0)
|
||||||
if c.config.selectedGc == gcDestructors:
|
if c.config.selectedGc == gcDestructors:
|
||||||
incl m.typ.flags, tfHasAsgn
|
incl m.typ.flags, tfHasAsgn
|
||||||
|
assert c.graph.sysTypes[tySequence] == nil
|
||||||
|
c.graph.sysTypes[tySequence] = m.typ
|
||||||
of mOpt:
|
of mOpt:
|
||||||
setMagicType(c.config, m, tyOpt, 0)
|
setMagicType(c.config, m, tyOpt, 0)
|
||||||
of mOrdinal:
|
of mOrdinal:
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ template frees(s) =
|
||||||
s.p.region.dealloc(s.p.region, s.p, contentSize(s.p.cap))
|
s.p.region.dealloc(s.p.region, s.p, contentSize(s.p.cap))
|
||||||
|
|
||||||
proc `=destroy`(s: var string) =
|
proc `=destroy`(s: var string) =
|
||||||
var a = cast[ptr NimStringV2[T]](addr s)
|
var a = cast[ptr NimStringV2](addr s)
|
||||||
frees(a)
|
frees(a)
|
||||||
a.len = 0
|
a.len = 0
|
||||||
a.p = nil
|
a.p = nil
|
||||||
|
|
|
||||||
|
|
@ -428,7 +428,8 @@ proc getStackTrace(e: ref Exception): string =
|
||||||
else:
|
else:
|
||||||
result = ""
|
result = ""
|
||||||
|
|
||||||
proc getStackTraceEntries*(e: ref Exception): seq[StackTraceEntry] =
|
when not defined(gcDestructors):
|
||||||
|
proc getStackTraceEntries*(e: ref Exception): seq[StackTraceEntry] =
|
||||||
## Returns the attached stack trace to the exception ``e`` as
|
## Returns the attached stack trace to the exception ``e`` as
|
||||||
## a ``seq``. This is not yet available for the JS backend.
|
## a ``seq``. This is not yet available for the JS backend.
|
||||||
shallowCopy(result, e.trace)
|
shallowCopy(result, e.trace)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue