Skip to content

Commit

Permalink
remove dead magics part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
krux02 committed Mar 2, 2020
1 parent 165cbaa commit d796b3e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
8 changes: 4 additions & 4 deletions compiler/ast.nim
Original file line number Diff line number Diff line change
Expand Up @@ -639,16 +639,16 @@ type
mSwap, mIsNil, mArrToSeq,
mNewString, mNewStringOfCap, mParseBiggestFloat,
mMove, mWasMoved, mDestroy,
mDefault, mUnown, mAccessEnv, mAccessTypeInfo, mReset,
mDefault, mUnown, mAccessEnv, mReset,
mArray, mOpenArray, mRange, mSet, mSeq, mOpt, mVarargs,
mRef, mPtr, mVar, mDistinct, mVoid, mTuple,
mOrdinal,
mInt, mInt8, mInt16, mInt32, mInt64,
mUInt, mUInt8, mUInt16, mUInt32, mUInt64,
mFloat, mFloat32, mFloat64, mFloat128,
mBool, mChar, mString, mCstring,
mPointer, mEmptySet, mIntSetBaseType, mNil, mExpr, mStmt, mTypeDesc,
mVoidType, mPNimrodNode, mShared, mGuarded, mLock, mSpawn, mDeepCopy,
mPointer, mNil, mExpr, mStmt, mTypeDesc,
mVoidType, mPNimrodNode, mSpawn, mDeepCopy,
mIsMainModule, mCompileDate, mCompileTime, mProcCall,
mCpuEndian, mHostOS, mHostCPU, mBuildOS, mBuildCPU, mAppType,
mCompileOption, mCompileOptionArg,
Expand All @@ -661,7 +661,7 @@ type
mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, mNStrVal, mNSetIntVal,
mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, mNLineInfo,
mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mNSigHash, mNSizeOf,
mNBindSym, mLocals, mNCallSite,
mNBindSym, mNCallSite,
mEqIdent, mEqNimrodNode, mSameNodeType, mGetImpl, mNGenSym,
mNHint, mNWarning, mNError,
mInstantiationInfo, mGetTypeInfo,
Expand Down
5 changes: 0 additions & 5 deletions compiler/ccgexprs.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2273,11 +2273,6 @@ proc genMagicExpr(p: BProc, e: PNode, d: var TLoc, op: TMagic) =
of mMove: genMove(p, e, d)
of mDestroy: genDestroy(p, e)
of mAccessEnv: unaryExpr(p, e, d, "$1.ClE_0")
of mAccessTypeInfo:
var a: TLoc
var dummy: Rope
initLocExpr(p, e[1], a)
putIntoDest(p, d, e, rdMType(p, a, dummy))
of mSlice:
localError(p.config, e.info, "invalid context for 'toOpenArray'; " &
"'toOpenArray' is only valid within a call expression")
Expand Down
6 changes: 0 additions & 6 deletions compiler/semtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1898,10 +1898,6 @@ proc processMagicType(c: PContext, m: PSym) =
setMagicIntegral(c.config, m, tyCString, c.config.target.ptrSize)
rawAddSon(m.typ, getSysType(c.graph, m.info, tyChar))
of mPointer: setMagicIntegral(c.config, m, tyPointer, c.config.target.ptrSize)
of mEmptySet:
setMagicIntegral(c.config, m, tySet, 1)
rawAddSon(m.typ, newTypeS(tyEmpty, c))
of mIntSetBaseType: setMagicIntegral(c.config, m, tyRange, c.config.target.intSize)
of mNil: setMagicType(c.config, m, tyNil, c.config.target.ptrSize)
of mExpr:
if m.name.s == "auto":
Expand Down Expand Up @@ -1937,8 +1933,6 @@ proc processMagicType(c: PContext, m: PSym) =
incl m.typ.flags, tfHasAsgn
assert c.graph.sysTypes[tySequence] == nil
c.graph.sysTypes[tySequence] = m.typ
of mOpt:
setMagicType(c.config, m, tyOpt, szUncomputedSize)
of mOrdinal:
setMagicIntegral(c.config, m, tyOrdinal, szUncomputedSize)
rawAddSon(m.typ, newTypeS(tyNone, c))
Expand Down
2 changes: 1 addition & 1 deletion lib/core/macros.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ proc boolVal*(n: NimNode): bool {.compileTime, noSideEffect.} =
else: n == bindSym"true" # hacky solution for now

when defined(nimMacrosGetNodeId):
proc nodeID*(n: NimNode): int {.magic: NodeId.}
proc nodeID*(n: NimNode): int {.magic: "NodeId".}
## Returns the id of ``n``, when the compiler has been compiled
## with the flag ``-d:useNodeids``, otherwise returns ``-1``. This
## proc is for the purpose to debug the compiler only.
Expand Down
4 changes: 2 additions & 2 deletions lib/system/comparisons.nim
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ proc `<`*(x, y: int64): bool {.magic: "LtI", noSideEffect.}


proc `<=%`*(x, y: IntMax32): bool {.magic: "LeU", noSideEffect.}
proc `<=%`*(x, y: int64): bool {.magic: "LeU", noSideEffect.}
proc `<=%`*(x, y: int64): bool {.magic: "LeU64", noSideEffect.}
## Treats `x` and `y` as unsigned and compares them.
## Returns true if ``unsigned(x) <= unsigned(y)``.

proc `<%`*(x, y: IntMax32): bool {.magic: "LtU", noSideEffect.}
proc `<%`*(x, y: int64): bool {.magic: "LtU", noSideEffect.}
proc `<%`*(x, y: int64): bool {.magic: "LtU64", noSideEffect.}
## Treats `x` and `y` as unsigned and compares them.
## Returns true if ``unsigned(x) < unsigned(y)``.

Expand Down

0 comments on commit d796b3e

Please sign in to comment.