moved eqproc to the correct magic position
also added mEqCString to evalOps so the test runs
This commit is contained in:
parent
e1c2aa2ddd
commit
becd55dced
3 changed files with 13 additions and 2 deletions
|
|
@ -302,12 +302,12 @@ const # magic checked op; magic unchecked op; checked op; unchecked op
|
||||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LeB
|
["", "", "($1 <= $2)", "($1 <= $2)"], # LeB
|
||||||
["", "", "($1 < $2)", "($1 < $2)"], # LtB
|
["", "", "($1 < $2)", "($1 < $2)"], # LtB
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqRef
|
["", "", "($1 == $2)", "($1 == $2)"], # EqRef
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqUntracedRef
|
["", "", "($1 == $2)", "($1 == $2)"], # EqUntracedRef
|
||||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LePtr
|
["", "", "($1 <= $2)", "($1 <= $2)"], # LePtr
|
||||||
["", "", "($1 < $2)", "($1 < $2)"], # LtPtr
|
["", "", "($1 < $2)", "($1 < $2)"], # LtPtr
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqCString
|
["", "", "($1 == $2)", "($1 == $2)"], # EqCString
|
||||||
["", "", "($1 != $2)", "($1 != $2)"], # Xor
|
["", "", "($1 != $2)", "($1 != $2)"], # Xor
|
||||||
|
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
||||||
["NegInt", "", "NegInt($1)", "-($1)"], # UnaryMinusI
|
["NegInt", "", "NegInt($1)", "-($1)"], # UnaryMinusI
|
||||||
["NegInt64", "", "NegInt64($1)", "-($1)"], # UnaryMinusI64
|
["NegInt64", "", "NegInt64($1)", "-($1)"], # UnaryMinusI64
|
||||||
["AbsInt", "", "AbsInt($1)", "Math.abs($1)"], # AbsI
|
["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)"], # LeB
|
||||||
["", "", "($1 < $2)", "($1 < $2)"], # LtB
|
["", "", "($1 < $2)", "($1 < $2)"], # LtB
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqRef
|
["", "", "($1 == $2)", "($1 == $2)"], # EqRef
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqUntracedRef
|
["", "", "($1 == $2)", "($1 == $2)"], # EqUntracedRef
|
||||||
["", "", "($1 <= $2)", "($1 <= $2)"], # LePtr
|
["", "", "($1 <= $2)", "($1 <= $2)"], # LePtr
|
||||||
["", "", "($1 < $2)", "($1 < $2)"], # LtPtr
|
["", "", "($1 < $2)", "($1 < $2)"], # LtPtr
|
||||||
["", "", "($1 == $2)", "($1 == $2)"], # EqCString
|
["", "", "($1 == $2)", "($1 == $2)"], # EqCString
|
||||||
["", "", "($1 != $2)", "($1 != $2)"], # Xor
|
["", "", "($1 != $2)", "($1 != $2)"], # Xor
|
||||||
|
["", "", "($1 == $2)", "($1 == $2)"], # EqProc
|
||||||
["NegInt", "", "NegInt($1)", "-($1)"], # UnaryMinusI
|
["NegInt", "", "NegInt($1)", "-($1)"], # UnaryMinusI
|
||||||
["NegInt64", "", "NegInt64($1)", "-($1)"], # UnaryMinusI64
|
["NegInt64", "", "NegInt64($1)", "-($1)"], # UnaryMinusI64
|
||||||
["AbsInt", "", "AbsInt($1)", "Math.abs($1)"], # AbsI
|
["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 mLtStr: result = newIntNodeT(ord(getStr(a) < getStr(b)), n)
|
||||||
of mLeStr: 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 mEqStr: result = newIntNodeT(ord(getStr(a) == getStr(b)), n)
|
||||||
|
of mEqCString: result = newIntNodeT(ord(getStr(a) == getStr(b)), n)
|
||||||
of mLtU, mLtU64:
|
of mLtU, mLtU64:
|
||||||
result = newIntNodeT(ord(`<%`(getOrdValue(a), getOrdValue(b))), n)
|
result = newIntNodeT(ord(`<%`(getOrdValue(a), getOrdValue(b))), n)
|
||||||
of mLeU, mLeU64:
|
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)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue