summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/ccgstmts.nim2
-rwxr-xr-xcompiler/ccgutils.nim10
-rwxr-xr-xcompiler/transf.nim3
3 files changed, 5 insertions, 10 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index c9b5832fb..d45035989 100755
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -17,7 +17,7 @@ proc genLineDir(p: BProc, t: PNode) =
   var line = toLinenumber(t.info) # BUGFIX
   if line < 0: 
     line = 0                  # negative numbers are not allowed in #line
-  if optLineDir in p.Options: 
+  if optLineDir in p.Options and line > 0: 
     appff(p.s[cpsStmts], "#line $2 \"$1\"$n", "; line $2 \"$1\"$n", 
           [toRope(toFilename(t.info)), toRope(line)])
   if ({optStackTrace, optEndb} * p.Options == {optStackTrace, optEndb}) and
diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim
index f1d66ca94..e0f714594 100755
--- a/compiler/ccgutils.nim
+++ b/compiler/ccgutils.nim
@@ -62,13 +62,10 @@ proc initTypeTables() =
   for i in countup(low(TTypeKind), high(TTypeKind)): InitIdTable(gTypeTable[i])
   
 proc GetUniqueType*(key: PType): PType = 
-  var 
-    t: PType
-    k: TTypeKind
   # this is a hotspot in the compiler!
   result = key
   if key == nil: return 
-  k = key.kind
+  var k = key.kind
   case k 
   of tyObject, tyEnum: 
     result = PType(IdTableGet(gTypeTable[k], key))
@@ -84,20 +81,19 @@ proc GetUniqueType*(key: PType): PType =
     # to be compared by their structure:
     if IdTableHasObjectAsKey(gTypeTable[k], key): return 
     for h in countup(0, high(gTypeTable[k].data)): 
-      t = PType(gTypeTable[k].data[h].key)
+      var t = PType(gTypeTable[k].data[h].key)
       if (t != nil) and sameType(t, key): 
         return t
     IdTablePut(gTypeTable[k], key, key)
 
 proc TableGetType*(tab: TIdTable, key: PType): PObject = 
-  var t: PType
   # returns nil if we need to declare this type
   result = IdTableGet(tab, key)
   if (result == nil) and (tab.counter > 0): 
     # we have to do a slow linear search because types may need
     # to be compared by their structure:
     for h in countup(0, high(tab.data)): 
-      t = PType(tab.data[h].key)
+      var t = PType(tab.data[h].key)
       if t != nil: 
         if sameType(t, key): 
           return tab.data[h].val
diff --git a/compiler/transf.nim b/compiler/transf.nim
index f0a8caadb..6c3aea0b3 100755
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -195,8 +195,7 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode =
     if it.kind == nkCommentStmt: 
       result[i] = PTransNode(it)
     elif it.kind == nkIdentDefs: 
-      if (it.sons[0].kind != nkSym):
-        InternalError(it.info, "transformVarSection")
+      if it.sons[0].kind != nkSym: InternalError(it.info, "transformVarSection")
       var newVar = copySym(it.sons[0].sym)
       incl(newVar.flags, sfFromGeneric) 
       # fixes a strange bug for rodgen: