diff options
author | Simon Hafner <hafnersimon@gmail.com> | 2013-09-26 15:05:00 -0500 |
---|---|---|
committer | Simon Hafner <hafnersimon@gmail.com> | 2013-09-26 15:05:00 -0500 |
commit | becd55dced7546ee4ba12cec5d849f76878059be (patch) | |
tree | ce6ab869ce60d2a594390d1db96d00db4f399f3a | |
parent | e1c2aa2ddd1e26243acdc1e46525eed8a6d9d81c (diff) | |
download | Nim-becd55dced7546ee4ba12cec5d849f76878059be.tar.gz |
moved eqproc to the correct magic position
also added mEqCString to evalOps so the test runs
-rw-r--r-- | compiler/jsgen.nim | 4 | ||||
-rw-r--r-- | compiler/semfold.nim | 1 | ||||
-rw-r--r-- | tests/js/testmagic.nim | 10 |
3 files changed, 13 insertions, 2 deletions
diff --git a/compiler/jsgen.nim b/compiler/jsgen.nim index eadad27d0..fec14870e 100644 --- a/compiler/jsgen.nim +++ b/compiler/jsgen.nim @@ -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 diff --git a/compiler/semfold.nim b/compiler/semfold.nim index ca06ea1b6..ebde9a2be 100644 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -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: diff --git a/tests/js/testmagic.nim b/tests/js/testmagic.nim new file mode 100644 index 000000000..c58496dfd --- /dev/null +++ b/tests/js/testmagic.nim @@ -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) |