summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/platform.nim7
-rw-r--r--compiler/plugins/locals.nim2
-rw-r--r--compiler/pragmas.nim2
-rw-r--r--compiler/semstmts.nim8
-rw-r--r--compiler/transf.nim11
5 files changed, 12 insertions, 18 deletions
diff --git a/compiler/platform.nim b/compiler/platform.nim
index 7eb897816..ef1d00e08 100644
--- a/compiler/platform.nim
+++ b/compiler/platform.nim
@@ -230,9 +230,6 @@ proc setTarget*(t: var Target; o: TSystemOS, c: TSystemCPU) =
   #echo "new Target: OS: ", o, " CPU: ", c
   t.targetCPU = c
   t.targetOS = o
-  # assume no cross-compiling
-  t.hostCPU = c
-  t.hostOS = o
   t.intSize = CPU[c].intSize div 8
   t.floatSize = CPU[c].floatSize div 8
   t.ptrSize = CPU[c].bit div 8
@@ -251,4 +248,6 @@ proc nameToCPU*(name: string): TSystemCPU =
   result = cpuNone
 
 proc setTargetFromSystem*(t: var Target) =
-  t.setTarget(nameToOS(system.hostOS), nameToCPU(system.hostCPU))
+  t.hostOS = nameToOS(system.hostOS)
+  t.hostCPU = nameToCPU(system.hostCPU)
+  t.setTarget(t.hostOS, t.hostCPU)
diff --git a/compiler/plugins/locals.nim b/compiler/plugins/locals.nim
index 0048ff985..4dd3e8f9c 100644
--- a/compiler/plugins/locals.nim
+++ b/compiler/plugins/locals.nim
@@ -29,7 +29,7 @@ proc semLocals*(c: PContext, n: PNode): PNode =
             {tyVarargs, tyOpenArray, tyTypeDesc, tyStatic, tyExpr, tyStmt, tyEmpty}:
 
         var field = newSym(skField, it.name, getCurrOwner(c), n.info)
-        field.typ = it.typ.skipTypes({tyGenericInst, tyVar})
+        field.typ = it.typ.skipTypes({tyVar})
         field.position = counter
         inc(counter)
 
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index b8dae8123..36c79bc9e 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -1110,7 +1110,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
         else: sym.flags.incl sfUsed
       of wLiftLocals: discard
       else: invalidPragma(c, it)
-    elif sym.kind in {skField,skProc,skFunc,skConverter,skMethod,skType}:
+    elif sym.kind in {skVar,skLet,skParam,skField,skProc,skFunc,skConverter,skMethod,skType}:
       n.sons[i] = semCustomPragma(c, it)
     else:
       illegalCustomPragma(c, it, sym)
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 87d144dc6..75a4198a5 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -495,12 +495,8 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
           # keep documentation information:
           b.comment = a.comment
         addSon(b, newSymNode(v))
-        # keep type desc for doc generator, but only if the user explicitly
-        # added it
-        if a.sons[length-2].kind != nkEmpty:
-          addSon(b, newNodeIT(nkType, a.info, typ))
-        else:
-          addSon(b, a.sons[length-2])
+        # keep type desc for doc generator
+        addSon(b, a.sons[length-2])
         addSon(b, copyTree(def))
         addToVarSection(c, result, n, b)
       else:
diff --git a/compiler/transf.nim b/compiler/transf.nim
index 0c3ddf27a..b31be71a3 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -935,12 +935,11 @@ proc transform(c: PTransf, n: PNode): PTransNode =
     else:
       result = transformSons(c, n)
   of nkIdentDefs, nkConstDef:
-    when true:
-      result = transformSons(c, n)
-    else:
-      result = n.PTransNode
-      let L = n.len-1
-      result[L] = transform(c, n.sons[L])
+    result = PTransNode(n)
+    result[0] = transform(c, n[0])
+    # Skip the second son since it only contains an unsemanticized copy of the
+    # variable type used by docgen
+    result[2] = transform(c, n[2])
     # XXX comment handling really sucks:
     if importantComments(c.graph.config):
       PNode(result).comment = n.comment