diff options
Diffstat (limited to 'compiler/magicsys.nim')
-rw-r--r-- | compiler/magicsys.nim | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/compiler/magicsys.nim b/compiler/magicsys.nim index 604c5b537..71003371e 100644 --- a/compiler/magicsys.nim +++ b/compiler/magicsys.nim @@ -21,7 +21,7 @@ proc registerSysType*(g: ModuleGraph; t: PType) = if g.sysTypes[t.kind] == nil: g.sysTypes[t.kind] = t proc newSysType(g: ModuleGraph; kind: TTypeKind, size: int): PType = - result = newType(kind, g.systemModule) + result = newType(kind, nextId(g.idgen), g.systemModule) result.size = size result.align = size.int16 @@ -29,8 +29,8 @@ proc getSysSym*(g: ModuleGraph; info: TLineInfo; name: string): PSym = result = strTableGet(g.systemModule.tab, getIdent(g.cache, name)) if result == nil: localError(g.config, info, "system module needs: " & name) - result = newSym(skError, getIdent(g.cache, name), g.systemModule, g.systemModule.info, {}) - result.typ = newType(tyError, g.systemModule) + result = newSym(skError, getIdent(g.cache, name), nextId(g.idgen), g.systemModule, g.systemModule.info, {}) + result.typ = newType(tyError, nextId(g.idgen), g.systemModule) if result.kind == skAlias: result = result.owner proc getSysMagic*(g: ModuleGraph; info: TLineInfo; name: string, m: TMagic): PSym = @@ -45,8 +45,8 @@ proc getSysMagic*(g: ModuleGraph; info: TLineInfo; name: string, m: TMagic): PSy r = nextIdentIter(ti, g.systemModule.tab) if result != nil: return result localError(g.config, info, "system module needs: " & name) - result = newSym(skError, id, g.systemModule, g.systemModule.info, {}) - result.typ = newType(tyError, g.systemModule) + result = newSym(skError, id, nextId(g.idgen), g.systemModule, g.systemModule.info, {}) + result.typ = newType(tyError, nextId(g.idgen), g.systemModule) proc sysTypeFromName*(g: ModuleGraph; info: TLineInfo; name: string): PType = result = getSysSym(g, info, name).typ @@ -101,12 +101,12 @@ proc getIntLitType*(g: ModuleGraph; literal: PNode): PType = result = g.intTypeCache[value.int] if result == nil: let ti = getSysType(g, literal.info, tyInt) - result = copyType(ti, ti.owner, false) + result = copyType(ti, nextId(g.idgen), ti.owner) result.n = literal g.intTypeCache[value.int] = result else: let ti = getSysType(g, literal.info, tyInt) - result = copyType(ti, ti.owner, false) + result = copyType(ti, nextId(g.idgen), ti.owner) result.n = literal proc getFloatLitType*(g: ModuleGraph; literal: PNode): PType = @@ -114,17 +114,17 @@ proc getFloatLitType*(g: ModuleGraph; literal: PNode): PType = result = newSysType(g, tyFloat, size=8) result.n = literal -proc skipIntLit*(t: PType): PType {.inline.} = +proc skipIntLit*(t: PType; id: IdGenerator): PType {.inline.} = if t.n != nil and t.kind in {tyInt, tyFloat}: - result = copyType(t, t.owner, false) + result = copyType(t, nextId(id), t.owner) result.n = nil else: result = t -proc addSonSkipIntLit*(father, son: PType) = +proc addSonSkipIntLit*(father, son: PType; id: IdGenerator) = when not defined(nimNoNilSeqs): if isNil(father.sons): father.sons = @[] - let s = son.skipIntLit + let s = son.skipIntLit(id) father.sons.add(s) propagateToOwner(father, s) @@ -181,13 +181,13 @@ proc resetNimScriptSymbols*(g: ModuleGraph) = initStrTable(g.exposed) proc getMagicEqSymForType*(g: ModuleGraph; t: PType; info: TLineInfo): PSym = case t.kind of tyInt, tyInt8, tyInt16, tyInt32, tyInt64, - tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64: + tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64: result = getSysMagic(g, info, "==", mEqI) - of tyEnum: + of tyEnum: result = getSysMagic(g, info, "==", mEqEnum) - of tyBool: + of tyBool: result = getSysMagic(g, info, "==", mEqB) - of tyRef, tyPtr, tyPointer: + of tyRef, tyPtr, tyPointer: result = getSysMagic(g, info, "==", mEqRef) of tyString: result = getSysMagic(g, info, "==", mEqStr) |