summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ast.nim4
-rw-r--r--compiler/nversion.nim6
-rw-r--r--compiler/semexprs.nim4
-rw-r--r--compiler/semfold.nim4
-rw-r--r--compiler/semmagic.nim3
-rw-r--r--compiler/transf.nim14
6 files changed, 19 insertions, 16 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim
index ec309ba1a..62f2d105f 100644
--- a/compiler/ast.nim
+++ b/compiler/ast.nim
@@ -566,8 +566,8 @@ type
     mBool, mChar, mString, mCstring,
     mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, mStmt, mTypeDesc,
     mVoidType, mPNimrodNode, mShared, mGuarded, mLock, mSpawn, mDeepCopy,
-    mIsMainModule, mCompileDate, mCompileTime, mNimrodVersion, mNimrodMajor,
-    mNimrodMinor, mNimrodPatch, mCpuEndian, mHostOS, mHostCPU, mAppType,
+    mIsMainModule, mCompileDate, mCompileTime, mProcCall, 
+    mCpuEndian, mHostOS, mHostCPU, mAppType,
     mNaN, mInf, mNegInf,
     mCompileOption, mCompileOptionArg,
     mNLen, mNChild, mNSetChild, mNAdd, mNAddMultiple, mNDel, mNKind,
diff --git a/compiler/nversion.nim b/compiler/nversion.nim
index 910ebfb59..8dc4b90b2 100644
--- a/compiler/nversion.nim
+++ b/compiler/nversion.nim
@@ -12,10 +12,6 @@
 
 const 
   MaxSetElements* = 1 shl 16  # (2^16) to support unicode character sets?
-  VersionMajor* = 0
-  VersionMinor* = 10
-  VersionPatch* = 1
-  VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch
-
+  VersionAsString* = system.NimVersion
   RodFileVersion* = "1215"       # modify this if the rod-format changes!
 
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 544d59491..3ca80a9b1 100644
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -1649,6 +1649,10 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
       else:
         result.typ = result[1].typ
       result.add instantiateCreateFlowVarCall(c, result[1].typ, n.info).newSymNode
+  of mProcCall:
+    result = setMs(n, s)
+    result.sons[1] = semExpr(c, n.sons[1])
+    result.typ = n[1].typ
   else: result = semDirectOp(c, n, flags)
 
 proc semWhen(c: PContext, n: PNode, semCheck = true): PNode =
diff --git a/compiler/semfold.nim b/compiler/semfold.nim
index 1e92fb832..c7ae42548 100644
--- a/compiler/semfold.nim
+++ b/compiler/semfold.nim
@@ -613,10 +613,6 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
       of mIsMainModule: result = newIntNodeT(ord(sfMainModule in m.flags), n)
       of mCompileDate: result = newStrNodeT(times.getDateStr(), n)
       of mCompileTime: result = newStrNodeT(times.getClockStr(), n)
-      of mNimrodVersion: result = newStrNodeT(VersionAsString, n)
-      of mNimrodMajor: result = newIntNodeT(VersionMajor, n)
-      of mNimrodMinor: result = newIntNodeT(VersionMinor, n)
-      of mNimrodPatch: result = newIntNodeT(VersionPatch, n)
       of mCpuEndian: result = newIntNodeT(ord(CPU[targetCPU].endian), n)
       of mHostOS: result = newStrNodeT(toLower(platform.OS[targetOS].name), n)
       of mHostCPU: result = newStrNodeT(platform.CPU[targetCPU].name.toLower, n)
diff --git a/compiler/semmagic.nim b/compiler/semmagic.nim
index a72a6ab7d..d6c420955 100644
--- a/compiler/semmagic.nim
+++ b/compiler/semmagic.nim
@@ -130,4 +130,7 @@ proc magicsAfterOverloadResolution(c: PContext, n: PNode,
   of mShallowCopy: result = semShallowCopy(c, n, flags)
   of mNBindSym: result = semBindSym(c, n)
   of mLocals: result = semLocals(c, n)
+  of mProcCall:
+    result = n
+    result.typ = n[1].typ
   else: result = n
diff --git a/compiler/transf.nim b/compiler/transf.nim
index 6196512ba..3409acb74 100644
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -582,7 +582,7 @@ proc getMergeOp(n: PNode): PSym =
   else: discard
 
 proc flattenTreeAux(d, a: PNode, op: PSym) = 
-  var op2 = getMergeOp(a)
+  let op2 = getMergeOp(a)
   if op2 != nil and
       (op2.id == op.id or op.magic != mNone and op2.magic == op.magic): 
     for i in countup(1, sonsLen(a)-1): flattenTreeAux(d, a.sons[i], op)
@@ -590,7 +590,7 @@ proc flattenTreeAux(d, a: PNode, op: PSym) =
     addSon(d, copyTree(a))
   
 proc flattenTree(root: PNode): PNode = 
-  var op = getMergeOp(root)
+  let op = getMergeOp(root)
   if op != nil: 
     result = copyNode(root)
     addSon(result, copyTree(root.sons[0]))
@@ -600,8 +600,9 @@ proc flattenTree(root: PNode): PNode =
 
 proc transformCall(c: PTransf, n: PNode): PTransNode = 
   var n = flattenTree(n)
-  var op = getMergeOp(n)
-  if (op != nil) and (op.magic != mNone) and (sonsLen(n) >= 3): 
+  let op = getMergeOp(n)
+  let magic = getMagic(n)
+  if op != nil and op.magic != mNone and n.len >= 3: 
     result = newTransNode(nkCall, n, 0)
     add(result, transform(c, n.sons[0]))
     var j = 1
@@ -616,9 +617,12 @@ proc transformCall(c: PTransf, n: PNode): PTransNode =
           inc(j)
       add(result, a.PTransNode)
     if len(result) == 2: result = result[1]
-  elif getMagic(n) == mNBindSym:
+  elif magic == mNBindSym:
     # for bindSym(myconst) we MUST NOT perform constant folding:
     result = n.PTransNode
+  elif magic == mProcCall:
+    # but do not change to its dispatcher:
+    result = transformSons(c, n[1])
   else:
     let s = transformSons(c, n).PNode
     # bugfix: check after 'transformSons' if it's still a method call: