mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 10:52:14 +00:00
moved eqproc to the correct magic position
also added mEqCString to evalOps so the test runs
This commit is contained in:
@@ -302,12 +302,12 @@ const # magic checked op; magic unchecked op; checked op; unchecked op
|
||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LeB
|
||||
["", "", "($1 < $2)", "($1 < $2)"], # LtB
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqRef
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqUntracedRef
|
||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LePtr
|
||||
["", "", "($1 < $2)", "($1 < $2)"], # LtPtr
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqCString
|
||||
["", "", "($1 != $2)", "($1 != $2)"], # Xor
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
||||
["NegInt", "", "NegInt($1)", "-($1)"], # UnaryMinusI
|
||||
["NegInt64", "", "NegInt64($1)", "-($1)"], # UnaryMinusI64
|
||||
["AbsInt", "", "AbsInt($1)", "Math.abs($1)"], # AbsI
|
||||
@@ -402,12 +402,12 @@ const # magic checked op; magic unchecked op; checked op; unchecked op
|
||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LeB
|
||||
["", "", "($1 < $2)", "($1 < $2)"], # LtB
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqRef
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqUntracedRef
|
||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LePtr
|
||||
["", "", "($1 < $2)", "($1 < $2)"], # LtPtr
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqCString
|
||||
["", "", "($1 != $2)", "($1 != $2)"], # Xor
|
||||
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
||||
["NegInt", "", "NegInt($1)", "-($1)"], # UnaryMinusI
|
||||
["NegInt64", "", "NegInt64($1)", "-($1)"], # UnaryMinusI64
|
||||
["AbsInt", "", "AbsInt($1)", "Math.abs($1)"], # AbsI
|
||||
|
||||
@@ -315,6 +315,7 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode =
|
||||
of mLtStr: result = newIntNodeT(ord(getStr(a) < getStr(b)), n)
|
||||
of mLeStr: result = newIntNodeT(ord(getStr(a) <= getStr(b)), n)
|
||||
of mEqStr: result = newIntNodeT(ord(getStr(a) == getStr(b)), n)
|
||||
of mEqCString: result = newIntNodeT(ord(getStr(a) == getStr(b)), n)
|
||||
of mLtU, mLtU64:
|
||||
result = newIntNodeT(ord(`<%`(getOrdValue(a), getOrdValue(b))), n)
|
||||
of mLeU, mLeU64:
|
||||
|
||||
10
tests/js/testmagic.nim
Normal file
10
tests/js/testmagic.nim
Normal file
@@ -0,0 +1,10 @@
|
||||
discard """
|
||||
cmd: "nimrod js --hints:on -r $# $#"
|
||||
output: '''true'''
|
||||
"""
|
||||
|
||||
# This file tests some magic
|
||||
|
||||
const foo = cstring("foo")
|
||||
const bar = cstring("foo")
|
||||
echo(foo == bar)
|
||||
Reference in New Issue
Block a user