clean up tyBigNum remnants
This commit is contained in:
parent
6dc6dc5f95
commit
f488ed973d
8 changed files with 21 additions and 21 deletions
|
|
@ -317,6 +317,10 @@ type
|
||||||
TTypeKind* = enum # order is important!
|
TTypeKind* = enum # order is important!
|
||||||
# Don't forget to change hti.nim if you make a change here
|
# Don't forget to change hti.nim if you make a change here
|
||||||
# XXX put this into an include file to avoid this issue!
|
# XXX put this into an include file to avoid this issue!
|
||||||
|
# several types are no longer used (guess which), but a
|
||||||
|
# spot in the sequence is kept for backwards compatibility
|
||||||
|
# (apparently something with bootstrapping)
|
||||||
|
# if you need to add a type, they can apparently be reused
|
||||||
tyNone, tyBool, tyChar,
|
tyNone, tyBool, tyChar,
|
||||||
tyEmpty, tyArrayConstr, tyNil, tyExpr, tyStmt, tyTypeDesc,
|
tyEmpty, tyArrayConstr, tyNil, tyExpr, tyStmt, tyTypeDesc,
|
||||||
tyGenericInvocation, # ``T[a, b]`` for types to invoke
|
tyGenericInvocation, # ``T[a, b]`` for types to invoke
|
||||||
|
|
@ -345,9 +349,9 @@ type
|
||||||
tyInt, tyInt8, tyInt16, tyInt32, tyInt64, # signed integers
|
tyInt, tyInt8, tyInt16, tyInt32, tyInt64, # signed integers
|
||||||
tyFloat, tyFloat32, tyFloat64, tyFloat128,
|
tyFloat, tyFloat32, tyFloat64, tyFloat128,
|
||||||
tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64,
|
tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64,
|
||||||
tyBigNum,
|
tyUnused0,
|
||||||
tyConst, tyMutable, tyVarargs,
|
tyConst, tyMutable, tyVarargs,
|
||||||
tyUnused # kept for enum ordinal compatibility
|
tyUnused
|
||||||
tyProxy # used as errornous type (for idetools)
|
tyProxy # used as errornous type (for idetools)
|
||||||
|
|
||||||
tyBuiltInTypeClass #\
|
tyBuiltInTypeClass #\
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ proc getUniqueType*(key: PType): PType =
|
||||||
# produced instead of ``NI``.
|
# produced instead of ``NI``.
|
||||||
result = key
|
result = key
|
||||||
of tyEmpty, tyNil, tyExpr, tyStmt, tyPointer, tyString,
|
of tyEmpty, tyNil, tyExpr, tyStmt, tyPointer, tyString,
|
||||||
tyCString, tyNone, tyBigNum, tyVoid:
|
tyCString, tyNone, tyVoid:
|
||||||
result = gCanonicalTypes[k]
|
result = gCanonicalTypes[k]
|
||||||
if result == nil:
|
if result == nil:
|
||||||
gCanonicalTypes[k] = key
|
gCanonicalTypes[k] = key
|
||||||
|
|
@ -153,7 +153,7 @@ proc getUniqueType*(key: PType): PType =
|
||||||
else:
|
else:
|
||||||
# ugh, we need the canon here:
|
# ugh, we need the canon here:
|
||||||
result = slowSearch(key, k)
|
result = slowSearch(key, k)
|
||||||
of tyUnused: internalError("getUniqueType")
|
of tyUnused, tyUnused0: internalError("getUniqueType")
|
||||||
|
|
||||||
proc tableGetType*(tab: TIdTable, key: PType): RootRef =
|
proc tableGetType*(tab: TIdTable, key: PType): RootRef =
|
||||||
# returns nil if we need to declare this type
|
# returns nil if we need to declare this type
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ proc declareGlobal(p: PProc; id: int; r: Rope) =
|
||||||
|
|
||||||
const
|
const
|
||||||
MappedToObject = {tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray,
|
MappedToObject = {tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray,
|
||||||
tySet, tyBigNum, tyVarargs}
|
tySet, tyVarargs}
|
||||||
|
|
||||||
proc mapType(typ: PType): TJSTypeKind =
|
proc mapType(typ: PType): TJSTypeKind =
|
||||||
let t = skipTypes(typ, abstractInst)
|
let t = skipTypes(typ, abstractInst)
|
||||||
|
|
@ -158,8 +158,7 @@ proc mapType(typ: PType): TJSTypeKind =
|
||||||
of tyFloat..tyFloat128: result = etyFloat
|
of tyFloat..tyFloat128: result = etyFloat
|
||||||
of tySet: result = etyObject # map a set to a table
|
of tySet: result = etyObject # map a set to a table
|
||||||
of tyString, tySequence: result = etySeq
|
of tyString, tySequence: result = etySeq
|
||||||
of tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray, tyBigNum,
|
of tyObject, tyArray, tyArrayConstr, tyTuple, tyOpenArray, tyVarargs:
|
||||||
tyVarargs:
|
|
||||||
result = etyObject
|
result = etyObject
|
||||||
of tyNil: result = etyNull
|
of tyNil: result = etyNull
|
||||||
of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvocation,
|
of tyGenericInst, tyGenericParam, tyGenericBody, tyGenericInvocation,
|
||||||
|
|
@ -171,7 +170,7 @@ proc mapType(typ: PType): TJSTypeKind =
|
||||||
else: result = etyNone
|
else: result = etyNone
|
||||||
of tyProc: result = etyProc
|
of tyProc: result = etyProc
|
||||||
of tyCString: result = etyString
|
of tyCString: result = etyString
|
||||||
of tyUnused: internalError("mapType")
|
of tyUnused, tyUnused0: internalError("mapType")
|
||||||
|
|
||||||
proc mapType(p: PProc; typ: PType): TJSTypeKind =
|
proc mapType(p: PProc; typ: PType): TJSTypeKind =
|
||||||
if p.target == targetPHP: result = etyObject
|
if p.target == targetPHP: result = etyObject
|
||||||
|
|
|
||||||
|
|
@ -224,12 +224,12 @@ proc liftBodyAux(c: var TLiftCtx; t: PType; body, x, y: PNode) =
|
||||||
of tyFromExpr, tyProxy, tyBuiltInTypeClass, tyUserTypeClass,
|
of tyFromExpr, tyProxy, tyBuiltInTypeClass, tyUserTypeClass,
|
||||||
tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything,
|
tyUserTypeClassInst, tyCompositeTypeClass, tyAnd, tyOr, tyNot, tyAnything,
|
||||||
tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt,
|
tyMutable, tyGenericParam, tyGenericBody, tyNil, tyExpr, tyStmt,
|
||||||
tyTypeDesc, tyGenericInvocation, tyBigNum, tyConst, tyForward:
|
tyTypeDesc, tyGenericInvocation, tyConst, tyForward:
|
||||||
internalError(c.info, "assignment requested for type: " & typeToString(t))
|
internalError(c.info, "assignment requested for type: " & typeToString(t))
|
||||||
of tyOrdinal, tyRange,
|
of tyOrdinal, tyRange,
|
||||||
tyGenericInst, tyFieldAccessor, tyStatic, tyVar:
|
tyGenericInst, tyFieldAccessor, tyStatic, tyVar:
|
||||||
liftBodyAux(c, lastSon(t), body, x, y)
|
liftBodyAux(c, lastSon(t), body, x, y)
|
||||||
of tyUnused: internalError("liftBodyAux")
|
of tyUnused, tyUnused0: internalError("liftBodyAux")
|
||||||
|
|
||||||
proc newProcType(info: TLineInfo; owner: PSym): PType =
|
proc newProcType(info: TLineInfo; owner: PSym): PType =
|
||||||
result = newType(tyProc, owner)
|
result = newType(tyProc, owner)
|
||||||
|
|
|
||||||
|
|
@ -925,7 +925,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
|
||||||
|
|
||||||
case a.kind
|
case a.kind
|
||||||
of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString,
|
of tyEmpty, tyChar, tyBool, tyNil, tyPointer, tyString, tyCString,
|
||||||
tyInt..tyBigNum, tyStmt, tyExpr, tyVoid:
|
tyInt..tyUInt64, tyStmt, tyExpr, tyVoid:
|
||||||
result = sameFlags(a, b)
|
result = sameFlags(a, b)
|
||||||
of tyStatic, tyFromExpr:
|
of tyStatic, tyFromExpr:
|
||||||
result = exprStructuralEquivalent(a.n, b.n) and sameFlags(a, b)
|
result = exprStructuralEquivalent(a.n, b.n) and sameFlags(a, b)
|
||||||
|
|
@ -980,7 +980,7 @@ proc sameTypeAux(x, y: PType, c: var TSameTypeClosure): bool =
|
||||||
sameValue(a.n.sons[1], b.n.sons[1])
|
sameValue(a.n.sons[1], b.n.sons[1])
|
||||||
of tyGenericInst: discard
|
of tyGenericInst: discard
|
||||||
of tyNone: result = false
|
of tyNone: result = false
|
||||||
of tyUnused: internalError("sameFlags")
|
of tyUnused, tyUnused0: internalError("sameFlags")
|
||||||
|
|
||||||
proc sameBackendType*(x, y: PType): bool =
|
proc sameBackendType*(x, y: PType): bool =
|
||||||
var c = initSameTypeClosure()
|
var c = initSameTypeClosure()
|
||||||
|
|
@ -1121,7 +1121,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||||
result = t
|
result = t
|
||||||
of tyNil:
|
of tyNil:
|
||||||
if kind != skConst: result = t
|
if kind != skConst: result = t
|
||||||
of tyString, tyBool, tyChar, tyEnum, tyInt..tyBigNum, tyCString, tyPointer:
|
of tyString, tyBool, tyChar, tyEnum, tyInt..tyUInt64, tyCString, tyPointer:
|
||||||
result = nil
|
result = nil
|
||||||
of tyOrdinal:
|
of tyOrdinal:
|
||||||
if kind != skParam: result = t
|
if kind != skParam: result = t
|
||||||
|
|
@ -1161,7 +1161,7 @@ proc typeAllowedAux(marker: var IntSet, typ: PType, kind: TSymKind,
|
||||||
# for now same as error node; we say it's a valid type as it should
|
# for now same as error node; we say it's a valid type as it should
|
||||||
# prevent cascading errors:
|
# prevent cascading errors:
|
||||||
result = nil
|
result = nil
|
||||||
of tyUnused: internalError("typeAllowedAux")
|
of tyUnused, tyUnused0: internalError("typeAllowedAux")
|
||||||
|
|
||||||
proc typeAllowed*(t: PType, kind: TSymKind): PType =
|
proc typeAllowed*(t: PType, kind: TSymKind): PType =
|
||||||
# returns 'nil' on success and otherwise the part of the type that is
|
# returns 'nil' on success and otherwise the part of the type that is
|
||||||
|
|
@ -1252,8 +1252,7 @@ proc computeSizeAux(typ: PType, a: var BiggestInt): BiggestInt =
|
||||||
if typ.callConv == ccClosure: result = 2 * ptrSize
|
if typ.callConv == ccClosure: result = 2 * ptrSize
|
||||||
else: result = ptrSize
|
else: result = ptrSize
|
||||||
a = ptrSize
|
a = ptrSize
|
||||||
of tyNil, tyCString, tyString, tySequence, tyPtr, tyRef, tyVar, tyOpenArray,
|
of tyNil, tyCString, tyString, tySequence, tyPtr, tyRef, tyVar, tyOpenArray:
|
||||||
tyBigNum:
|
|
||||||
let base = typ.lastSon
|
let base = typ.lastSon
|
||||||
if base == typ or (base.kind == tyTuple and base.size==szIllegalRecursion):
|
if base == typ or (base.kind == tyTuple and base.size==szIllegalRecursion):
|
||||||
result = szIllegalRecursion
|
result = szIllegalRecursion
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,6 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
|
||||||
of tyUInt16: result = atomicType("uint16", mUint16)
|
of tyUInt16: result = atomicType("uint16", mUint16)
|
||||||
of tyUInt32: result = atomicType("uint32", mUint32)
|
of tyUInt32: result = atomicType("uint32", mUint32)
|
||||||
of tyUInt64: result = atomicType("uint64", mUint64)
|
of tyUInt64: result = atomicType("uint64", mUint64)
|
||||||
of tyBigNum: result = atomicType("bignum", mNone)
|
|
||||||
of tyConst: result = mapTypeToBracket("const", mNone, t, info)
|
of tyConst: result = mapTypeToBracket("const", mNone, t, info)
|
||||||
of tyMutable: result = mapTypeToBracket("mutable", mNone, t, info)
|
of tyMutable: result = mapTypeToBracket("mutable", mNone, t, info)
|
||||||
of tyVarargs: result = mapTypeToBracket("varargs", mVarargs, t, info)
|
of tyVarargs: result = mapTypeToBracket("varargs", mVarargs, t, info)
|
||||||
|
|
@ -291,7 +290,7 @@ proc mapTypeToAstX(t: PType; info: TLineInfo;
|
||||||
result.add atomicType("static", mNone)
|
result.add atomicType("static", mNone)
|
||||||
if t.n != nil:
|
if t.n != nil:
|
||||||
result.add t.n.copyTree
|
result.add t.n.copyTree
|
||||||
of tyUnused: internalError("mapTypeToAstX")
|
of tyUnused, tyUnused0: internalError("mapTypeToAstX")
|
||||||
|
|
||||||
proc opMapTypeToAst*(t: PType; info: TLineInfo): PNode =
|
proc opMapTypeToAst*(t: PType; info: TLineInfo): PNode =
|
||||||
result = mapTypeToAstX(t, info, false, true)
|
result = mapTypeToAstX(t, info, false, true)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ type
|
||||||
nnkBreakState
|
nnkBreakState
|
||||||
|
|
||||||
NimNodeKinds* = set[NimNodeKind]
|
NimNodeKinds* = set[NimNodeKind]
|
||||||
NimTypeKind* = enum
|
NimTypeKind* = enum # some types are no longer used, see ast.nim
|
||||||
ntyNone, ntyBool, ntyChar, ntyEmpty,
|
ntyNone, ntyBool, ntyChar, ntyEmpty,
|
||||||
ntyArrayConstr, ntyNil, ntyExpr, ntyStmt,
|
ntyArrayConstr, ntyNil, ntyExpr, ntyStmt,
|
||||||
ntyTypeDesc, ntyGenericInvocation, ntyGenericBody, ntyGenericInst,
|
ntyTypeDesc, ntyGenericInvocation, ntyGenericBody, ntyGenericInst,
|
||||||
|
|
@ -90,7 +90,7 @@ type
|
||||||
ntyInt8, ntyInt16, ntyInt32, ntyInt64,
|
ntyInt8, ntyInt16, ntyInt32, ntyInt64,
|
||||||
ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128,
|
ntyFloat, ntyFloat32, ntyFloat64, ntyFloat128,
|
||||||
ntyUInt, ntyUInt8, ntyUInt16, ntyUInt32, ntyUInt64,
|
ntyUInt, ntyUInt8, ntyUInt16, ntyUInt32, ntyUInt64,
|
||||||
ntyBigNum,
|
ntyUnused0,
|
||||||
ntyConst, ntyMutable, ntyVarargs,
|
ntyConst, ntyMutable, ntyVarargs,
|
||||||
ntyUnused,
|
ntyUnused,
|
||||||
ntyError,
|
ntyError,
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,6 @@ type
|
||||||
tyUInt16,
|
tyUInt16,
|
||||||
tyUInt32,
|
tyUInt32,
|
||||||
tyUInt64,
|
tyUInt64,
|
||||||
tyBigNum,
|
|
||||||
|
|
||||||
TNimNodeKind = enum nkNone, nkSlot, nkList, nkCase
|
TNimNodeKind = enum nkNone, nkSlot, nkList, nkCase
|
||||||
TNimNode {.codegenType.} = object
|
TNimNode {.codegenType.} = object
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue