From 98e5beb936d8743b4d8e07fc47a0ab47e5f8a342 Mon Sep 17 00:00:00 2001 From: Araq Date: Sat, 24 Sep 2011 10:57:35 +0200 Subject: [PATCH] got rid of akPureObject --- compiler/ccgtypes.nim | 3 ++- lib/core/typeinfo.nim | 9 ++++----- lib/pure/marshal.nim | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 0123b69f96..20e3447b04 100755 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -77,7 +77,8 @@ proc mapType(typ: PType): TCTypeKind = of tySet: result = mapSetType(typ) of tyOpenArray, tyArrayConstr, tyArray: result = ctArray of tyObject, tyTuple: result = ctStruct - of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal: + of tyGenericBody, tyGenericInst, tyGenericParam, tyDistinct, tyOrdinal, + tyConst, tyMutable, tyIter: result = mapType(lastSon(typ)) of tyEnum: if firstOrd(typ) < 0: diff --git a/lib/core/typeinfo.nim b/lib/core/typeinfo.nim index b5e9e1a0f0..b216fee0c9 100755 --- a/lib/core/typeinfo.nim +++ b/lib/core/typeinfo.nim @@ -39,8 +39,7 @@ type akFloat = 36, ## any represents a float akFloat32 = 37, ## any represents a float32 akFloat64 = 38, ## any represents a float64 - akFloat128 = 39, ## any represents a float128 - akPureObject = 40 ## any represents an object that has no `type` field + akFloat128 = 39 ## any represents a float128 TAny* = object {.pure.} ## can represent any nimrod value; NOTE: the wrapped ## value can be modified with its wrapper! This means @@ -230,7 +229,7 @@ proc fieldsAux(p: pointer, n: ptr TNimNode, iterator fields*(x: TAny): tuple[name: string, any: TAny] = ## iterates over every active field of the any `x` that represents an object ## or a tuple. - assert x.rawType.kind in {tyTuple, tyPureObject, tyObject} + assert x.rawType.kind in {tyTuple, tyObject} var p = x.value var t = x.rawType # XXX BUG: does not work yet, however is questionable anyway @@ -282,7 +281,7 @@ proc `[]=`*(x: TAny, fieldName: string, value: TAny) = # XXX BUG: does not work yet, however is questionable anyway when false: if x.rawType.kind == tyObject: t = cast[ptr PNimType](x.value)[] - assert x.rawType.kind in {tyTuple, tyPureObject, tyObject} + assert x.rawType.kind in {tyTuple, tyObject} var n = getFieldNode(x.value, t.node, fieldname) if n != nil: assert n.typ == value.rawType @@ -296,7 +295,7 @@ proc `[]`*(x: TAny, fieldName: string): TAny = # XXX BUG: does not work yet, however is questionable anyway when false: if x.rawType.kind == tyObject: t = cast[ptr PNimType](x.value)[] - assert x.rawType.kind in {tyTuple, tyPureObject, tyObject} + assert x.rawType.kind in {tyTuple, tyObject} var n = getFieldNode(x.value, t.node, fieldname) if n != nil: result.value = x.value +!! n.offset diff --git a/lib/pure/marshal.nim b/lib/pure/marshal.nim index 354d70a71c..8b062ef26e 100755 --- a/lib/pure/marshal.nim +++ b/lib/pure/marshal.nim @@ -47,7 +47,7 @@ proc storeAny(s: PStream, a: TAny, stored: var TIntSet) = if i > 0: s.write(", ") storeAny(s, a[i], stored) s.write("]") - of akObject, akPureObject, akTuple: + of akObject, akTuple: s.write("{") var i = 0 for key, val in fields(a): @@ -138,7 +138,7 @@ proc loadAny(p: var TJsonParser, a: TAny, t: var TTable[biggestInt, pointer]) = else: raiseParseErr(p, "") else: raiseParseErr(p, "'[' expected for a seq") - of akObject, akPureObject, akTuple: + of akObject, akTuple: if a.kind == akObject: setObjectRuntimeType(a) if p.kind != jsonObjectStart: raiseParseErr(p, "'{' expected for an object") next(p)