summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-07-09 08:22:55 +0200
committerAraq <rumpf_a@web.de>2012-07-09 08:22:55 +0200
commit82b5e430cfab0b940f4f45516a373dee29001d69 (patch)
treebcb98472dece8be7190b3f4a29d9f3724afc11f1 /compiler
parent121d4e0fc2d05d7fd3ee8dab3a8c1663c9e5a5c3 (diff)
downloadNim-82b5e430cfab0b940f4f45516a373dee29001d69.tar.gz
'addSon' for types deprecated for 'int literal type' analysis (2)
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/semexprs.nim16
-rwxr-xr-xcompiler/semstmts.nim6
2 files changed, 11 insertions, 11 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 7aa723c52..0e764425a 100755
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -324,9 +324,9 @@ proc changeType(n: PNode, newType: PType) =
 proc semArrayConstr(c: PContext, n: PNode): PNode = 
   result = newNodeI(nkBracket, n.info)
   result.typ = newTypeS(tyArrayConstr, c)
-  addSon(result.typ, nil)     # index type
+  rawAddSon(result.typ, nil)     # index type
   if sonsLen(n) == 0: 
-    addSon(result.typ, newTypeS(tyEmpty, c)) # needs an empty basetype!
+    rawAddSon(result.typ, newTypeS(tyEmpty, c)) # needs an empty basetype!
   else: 
     var x = n.sons[0]
     var lastIndex: biggestInt = 0
@@ -351,7 +351,7 @@ proc semArrayConstr(c: PContext, n: PNode): PNode =
       n.sons[i] = semExprWithType(c, x)
       addSon(result, fitNode(c, typ, n.sons[i]))
       inc(lastIndex)
-    addSon(result.typ, typ)
+    addSonSkipIntLit(result.typ, typ)
   result.typ.sons[0] = makeRangeType(c, 0, sonsLen(result) - 1, n.info)
 
 proc fixAbstractType(c: PContext, n: PNode) = 
@@ -1151,7 +1151,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode =
   result = newNodeI(nkCurly, n.info)
   result.typ = newTypeS(tySet, c)
   if sonsLen(n) == 0: 
-    addSon(result.typ, newTypeS(tyEmpty, c))
+    rawAddSon(result.typ, newTypeS(tyEmpty, c))
   else: 
     # only semantic checking for all elements, later type checking:
     var typ: PType = nil
@@ -1178,7 +1178,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode =
       return 
     if lengthOrd(typ) > MaxSetElements: 
       typ = makeRangeType(c, 0, MaxSetElements - 1, n.info)
-    addSon(result.typ, typ)
+    addSonSkipIntLit(result.typ, typ)
     for i in countup(0, sonsLen(n) - 1): 
       var m: PNode
       if isRange(n.sons[i]):
@@ -1245,8 +1245,8 @@ proc semTupleFieldsConstr(c: PContext, n: PNode): PNode =
       localError(n.sons[i].info, errFieldInitTwice, id.s)
     n.sons[i].sons[1] = semExprWithType(c, n.sons[i].sons[1])
     var f = newSymS(skField, n.sons[i].sons[0], c)
-    f.typ = n.sons[i].sons[1].typ
-    addSon(typ, f.typ)
+    f.typ = skipIntLit(n.sons[i].sons[1].typ)
+    rawAddSon(typ, f.typ)
     addSon(typ.n, newSymNode(f))
     n.sons[i].sons[0] = newSymNode(f)
     addSon(result, n.sons[i])
@@ -1257,7 +1257,7 @@ proc semTuplePositionsConstr(c: PContext, n: PNode): PNode =
   var typ = newTypeS(tyTuple, c)  # leave typ.n nil!
   for i in countup(0, sonsLen(n) - 1): 
     n.sons[i] = semExprWithType(c, n.sons[i])
-    addSon(typ, n.sons[i].typ)
+    addSonSkipIntLit(typ, n.sons[i].typ)
   result.typ = typ
 
 proc semStmtListExpr(c: PContext, n: PNode): PNode = 
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index c67ccae46..99b68c121 100755
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -569,7 +569,7 @@ proc typeSectionRightSidePass(c: PContext, n: PNode) =
       # we fill it out later. For magic generics like 'seq', it won't be filled
       # so we use tyEmpty instead of nil to not crash for strange conversions
       # like: mydata.seq
-      addSon(s.typ, newTypeS(tyEmpty, c))
+      rawAddSon(s.typ, newTypeS(tyEmpty, c))
       s.ast = a
       inc c.InGenericContext
       var body = semTypeNode(c, a.sons[2], nil)
@@ -695,7 +695,7 @@ proc semLambda(c: PContext, n: PNode): PNode =
     ParamsTypeCheck(c, s.typ)
   else:
     s.typ = newTypeS(tyProc, c)
-    addSon(s.typ, nil)
+    rawAddSon(s.typ, nil)
   if n.sons[pragmasPos].kind != nkEmpty:
     pragma(c, s, n.sons[pragmasPos], lambdaPragmas)
   s.options = gOptions
@@ -746,7 +746,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
         # semParamList(c, n.sons[ParamsPos], nil, s)
   else: 
     s.typ = newTypeS(tyProc, c)
-    addSon(s.typ, nil)
+    rawAddSon(s.typ, nil)
   var proto = SearchForProc(c, s, c.tab.tos-2) # -2 because we have a scope
                                                # open for parameters
   if proto == nil: