Skip to content

Commit

Permalink
implement comparison of boolean values
Browse files Browse the repository at this point in the history
  • Loading branch information
burakemir committed Mar 5, 2016
1 parent 7e2ac79 commit c3681e9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/interpreter.dart
Expand Up @@ -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);
}
Expand Down
8 changes: 8 additions & 0 deletions test/interpreter_test.dart
Expand Up @@ -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();
Expand Down

0 comments on commit c3681e9

Please sign in to comment.