Permalink
Browse files

implement comparison of boolean values

  • Loading branch information...
burakemir committed Mar 5, 2016
1 parent 7e2ac79 commit c3681e9a1bb4d41b768d8b44816abd5c5c3c12bb
Showing with 11 additions and 0 deletions.
  1. +3 −0 lib/interpreter.dart
  2. +8 −0 test/interpreter_test.dart
View
@@ -539,6 +539,9 @@ class InterpreterImpl extends InterpreterInterface {
case Primitive.EQUALS:
final arg0 = args[0];
final arg1 = args[1];
if (arg0.isPrim && arg1.isPrim) { // boolean values
return new ListNode.cons(boolToNode(arg0 == arg1), nodes);
}
if (arg0.isNum && arg1.isNum) {
return evalBinCmp(p, ensureNum(arg0), ensureNum(arg1), nodes, primEqualsNum);
}
@@ -221,6 +221,14 @@ class InterpreterTest {
new NumberNode.float(19.0)
])),
equals(Primitive.TRUE));
expect(
interpreter.evalSequence(
ListNode.makeList([
Primitive.EQUALS,
Primitive.FALSE,
Primitive.FALSE
])),
equals(Primitive.TRUE));
});
test("eval first butfirst", () {
makeInterpreter();

0 comments on commit c3681e9

Please sign in to comment.