diff options
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/ast.nim | 4 | ||||
-rwxr-xr-x | compiler/ccgexprs.nim | 3 | ||||
-rwxr-xr-x | compiler/evals.nim | 8 | ||||
-rwxr-xr-x | compiler/semfold.nim | 5 |
4 files changed, 15 insertions, 5 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index fa7880c30..d1c10168a 100755 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -337,7 +337,9 @@ type mFields, mFieldPairs, mAppendStrCh, mAppendStrStr, mAppendSeqElem, mInRange, mInSet, mRepr, mExit, mSetLengthStr, mSetLengthSeq, mAssert, - mSwap, mIsNil, mArrToSeq, mCopyStr, mCopyStrLast, mNewString, mReset, + mSwap, mIsNil, mArrToSeq, mCopyStr, mCopyStrLast, + mNewString, mNewStringOfCap, + mReset, mArray, mOpenArray, mRange, mSet, mSeq, mOrdinal, mInt, mInt8, mInt16, mInt32, mInt64, mFloat, mFloat32, mFloat64, mBool, mChar, mString, mCstring, diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index 49afc3088..69c06fbb5 100755 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1457,7 +1457,8 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) = of mIncl, mExcl, mCard, mLtSet, mLeSet, mEqSet, mMulSet, mPlusSet, mMinusSet, mInSet: genSetOp(p, e, d, op) - of mNewString, mCopyStr, mCopyStrLast, mExit: genCall(p, e, d) + of mNewString, mNewStringOfCap, mCopyStr, mCopyStrLast, mExit: + genCall(p, e, d) of mReset: genReset(p, e) of mEcho: genEcho(p, e) of mArrToSeq: genArrToSeq(p, e, d) diff --git a/compiler/evals.nim b/compiler/evals.nim index 20d2a68be..6fcbd911a 100755 --- a/compiler/evals.nim +++ b/compiler/evals.nim @@ -990,7 +990,13 @@ proc evalMagicOrCall(c: PEvalContext, n: PNode): PNode = var a = result result = newNodeIT(nkStrLit, n.info, n.typ) result.strVal = newString(int(getOrdValue(a))) - else: + of mNewStringOfCap: + result = evalAux(c, n.sons[1], {}) + if isSpecial(result): return + var a = result + result = newNodeIT(nkStrLit, n.info, n.typ) + result.strVal = newString(0) + else: result = evalAux(c, n.sons[1], {}) if isSpecial(result): return var a = result diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 878c0a1a6..5b7f5603d 100755 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -205,7 +205,8 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = of mCompileOptionArg: result = newIntNodeT(Ord( testCompileOptionArg(getStr(a), getStr(b), n.info)), n) - of mNewString, mExit, mInc, ast.mDec, mEcho, mAssert, mSwap, mAppendStrCh, + of mNewString, mNewStringOfCap, + mExit, mInc, ast.mDec, mEcho, mAssert, mSwap, mAppendStrCh, mAppendStrStr, mAppendSeqElem, mSetLengthStr, mSetLengthSeq, mNLen..mNError, mEqRef: nil |