summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2012-03-23 00:16:29 +0100
committerAraq <rumpf_a@web.de>2012-03-23 00:16:29 +0100
commit0857efe5129f5479fdb51a8446fec90989b5aad3 (patch)
treea22664a5ea2edfde54a18bd14c38ab8a2ec2499c /compiler
parent3a5cf3d63a5f31809acf5c5f07d6f6a33c19af3d (diff)
downloadNim-0857efe5129f5479fdb51a8446fec90989b5aad3.tar.gz
some bugfixes for symbolfiles
Diffstat (limited to 'compiler')
-rwxr-xr-xcompiler/ast.nim5
-rwxr-xr-xcompiler/rodread.nim26
-rw-r--r--compiler/semmagic.nim2
3 files changed, 14 insertions, 19 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index a1b69bed8..7fd92d8fc 100755
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -227,9 +227,6 @@ type
     sfInnerProc,      # proc is an inner proc
     sfThread,         # proc will run as a thread
                       # variable is a thread variable
-    sfInline          # forced-inline procs
-    sfImmediate,      # macro or template is immediately expanded without
-                      # considering any possible overloads
     sfCompileTime,    # proc can be evaluated at compile time
     sfMerge,          # proc can be merged with itself
     sfDeadCodeElim,   # dead code elimination for the module is turned on
@@ -246,6 +243,8 @@ const
   sfFakeConst* = sfDeadCodeElim  # const cannot be put into a data section
   sfDispatcher* = sfDeadCodeElim # copied method symbol is the dispatcher
   sfNoInit* = sfMainModule       # don't generate code to init the variable
+  sfImmediate* = sfDeadCodeElim  # macro or template is immediately expanded
+                                 # without considering any possible overloads
 
 type
   TTypeKind* = enum  # order is important!
diff --git a/compiler/rodread.nim b/compiler/rodread.nim
index 3385ce942..c3123161b 100755
--- a/compiler/rodread.nim
+++ b/compiler/rodread.nim
@@ -535,7 +535,7 @@ proc cmdChangeTriggersRecompilation(old, new: TCommands): bool =
 proc processRodFile(r: PRodReader, crc: TCrc32) = 
   var 
     w: string
-    d, L, inclCrc: int
+    d, inclCrc: int
   while r.s[r.pos] != '\0': 
     var section = rdWord(r)
     if r.reason != rrNone: 
@@ -573,20 +573,17 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
     of "FILES": 
       inc(r.pos, 2)           # skip "(\10"
       inc(r.line)
-      L = 0
-      while r.s[r.pos] > '\x0A' and r.s[r.pos] != ')': 
-        setlen(r.files, L + 1)
+      while r.s[r.pos] != ')':
         var relativePath = decodeStr(r.s, r.pos)
         var resolvedPath = relativePath.findModule
-        r.files[L] = if resolvedPath.len > 0: resolvedPath else: relativePath
+        r.files.add(if resolvedPath.len > 0: resolvedPath else: relativePath)
         inc(r.pos)            # skip #10
         inc(r.line)
-        inc(L)
       if r.s[r.pos] == ')': inc(r.pos)
     of "INCLUDES": 
       inc(r.pos, 2)           # skip "(\10"
       inc(r.line)
-      while r.s[r.pos] > '\x0A' and r.s[r.pos] != ')': 
+      while r.s[r.pos] != ')': 
         w = r.files[decodeVInt(r.s, r.pos)]
         inc(r.pos)            # skip ' '
         inclCrc = decodeVInt(r.s, r.pos)
@@ -597,13 +594,10 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
           inc(r.pos)
           inc(r.line)
       if r.s[r.pos] == ')': inc(r.pos)
-    of "DEPS": 
+    of "DEPS":
       inc(r.pos)              # skip ':'
-      L = 0
       while r.s[r.pos] > '\x0A': 
-        setlen(r.modDeps, L + 1)
-        r.modDeps[L] = r.files[decodeVInt(r.s, r.pos)]
-        inc(L)
+        r.modDeps.add r.files[decodeVInt(r.s, r.pos)]
         if r.s[r.pos] == ' ': inc(r.pos)
     of "INTERF": 
       r.interfIdx = r.pos + 2
@@ -629,9 +623,11 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
     of "INIT": 
       r.initIdx = r.pos + 2   # "(\10"
       skipSection(r)
-    else: 
-      MsgWriteln("skipping section: " & section &
-                 " at " & $r.pos & " in " & r.filename)
+    else:
+      InternalError("invalid section: '" & section &
+                    "' at " & $r.line & " in " & r.filename)
+      #MsgWriteln("skipping section: " & section &
+      #           " at " & $r.line & " in " & r.filename)
       skipSection(r)
     if r.s[r.pos] == '\x0A': 
       inc(r.pos)
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim
index 932f36c2f..4f120e2ab 100644
--- a/compiler/semmagic.nim
+++ b/compiler/semmagic.nim
@@ -22,7 +22,7 @@ proc semSlurp(c: PContext, n: PNode, flags: TExprFlags): PNode =
     result = newStrNode(nkStrLit, content)
     result.typ = getSysType(tyString)
     result.info = n.info
-    c.slurpedFiles.add(filename)
+    c.slurpedFiles.add(a.strVal)
   except EIO:
     GlobalError(a.info, errCannotOpenFile, a.strVal)