parent
f1ce173283
commit
2951f89374
2 changed files with 5 additions and 2 deletions
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
# included from sem.nim
|
# included from sem.nim
|
||||||
|
|
||||||
|
from sugar import dup
|
||||||
|
|
||||||
type
|
type
|
||||||
ObjConstrContext = object
|
ObjConstrContext = object
|
||||||
typ: PType # The constructed type
|
typ: PType # The constructed type
|
||||||
|
|
@ -389,7 +391,8 @@ proc semObjConstr(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
# multiple times as long as they don't have closures.
|
# multiple times as long as they don't have closures.
|
||||||
result.typ.flags.incl tfHasOwned
|
result.typ.flags.incl tfHasOwned
|
||||||
if t.kind != tyObject:
|
if t.kind != tyObject:
|
||||||
return localErrorNode(c, result, "object constructor needs an object type")
|
return localErrorNode(c, result,
|
||||||
|
"object constructor needs an object type".dup(addDeclaredLoc(c.config, t)))
|
||||||
|
|
||||||
# Check if the object is fully initialized by recursively testing each
|
# Check if the object is fully initialized by recursively testing each
|
||||||
# field (if this is a case object, initialized fields in two different
|
# field (if this is a case object, initialized fields in two different
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ proc addDeclaredLocMaybe*(result: var string, conf: ConfigRef; sym: PSym) =
|
||||||
if optDeclaredLocs in conf.globalOptions and sym != nil:
|
if optDeclaredLocs in conf.globalOptions and sym != nil:
|
||||||
addDeclaredLoc(result, conf, sym)
|
addDeclaredLoc(result, conf, sym)
|
||||||
|
|
||||||
proc addDeclaredLoc(result: var string, conf: ConfigRef; typ: PType) =
|
proc addDeclaredLoc*(result: var string, conf: ConfigRef; typ: PType) =
|
||||||
let typ = typ.skipTypes(abstractInst - {tyRange})
|
let typ = typ.skipTypes(abstractInst - {tyRange})
|
||||||
result.add " [$1" % typ.kind.toHumanStr
|
result.add " [$1" % typ.kind.toHumanStr
|
||||||
if typ.sym != nil:
|
if typ.sym != nil:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue