forked from lix-project/lix
Let the ordering operators also work on strings
E.g. ‘"foo" < "bar"’ now works.
This commit is contained in:
parent
3d77b28eac
commit
8e74c0bfd1
|
@ -1032,7 +1032,10 @@ static void prim_div(EvalState & state, Value * * args, Value & v)
|
||||||
|
|
||||||
static void prim_lessThan(EvalState & state, Value * * args, Value & v)
|
static void prim_lessThan(EvalState & state, Value * * args, Value & v)
|
||||||
{
|
{
|
||||||
mkBool(v, state.forceInt(*args[0]) < state.forceInt(*args[1]));
|
state.forceValue(*args[0]);
|
||||||
|
state.forceValue(*args[1]);
|
||||||
|
CompareValues comp;
|
||||||
|
mkBool(v, comp(*args[0], *args[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
2185
|
2188
|
||||||
|
|
|
@ -50,6 +50,11 @@ let {
|
||||||
(if 2 > 1 == 1 < 2 then 1 else err)
|
(if 2 > 1 == 1 < 2 then 1 else err)
|
||||||
(if 1 + 2 * 3 >= 7 then 1 else err)
|
(if 1 + 2 * 3 >= 7 then 1 else err)
|
||||||
(if 1 + 2 * 3 < 7 then err else 1)
|
(if 1 + 2 * 3 < 7 then err else 1)
|
||||||
|
|
||||||
|
# Not integer, but so what.
|
||||||
|
(if "aa" < "ab" then 1 else err)
|
||||||
|
(if "aa" < "aa" then err else 1)
|
||||||
|
(if "foo" < "foobar" then 1 else err)
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue