diff --git a/src/context.cpp b/src/context.cpp index 1ed70a8..fb5c07b 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -51,7 +51,7 @@ Value Context::eval(peg::Ast& ast) { for (int i=0; igetVar(*this, name); int op = (*nodes[1]).choice; auto v2 = getValue(eval(*nodes[2])); - Value result = Value(Nil()); + Value result = Nil(); // TODO: floats if (op == 0) { - result = Value(v1.getInt(cxt) * v2.getInt(cxt)); + result = v1.getInt(cxt) * v2.getInt(cxt); } else if (op == 1) { - result = Value(v1.getInt(cxt) % v2.getInt(cxt)); + result = v1.getInt(cxt) % v2.getInt(cxt); } else if (op == 2) { - result = Value(v1.getInt(cxt) + v2.getInt(cxt)); + result = v1.getInt(cxt) + v2.getInt(cxt); } else if (op == 3) { - result = Value(v1.getInt(cxt) - v2.getInt(cxt)); + result = v1.getInt(cxt) - v2.getInt(cxt); } else if (op == 4) { - result = Value(v1.getInt(cxt) & v2.getInt(cxt)); + result = v1.getInt(cxt) & v2.getInt(cxt); } else if (op == 5) { - result = Value(v1.getInt(cxt) ^ v2.getInt(cxt)); + result = v1.getInt(cxt) ^ v2.getInt(cxt); } else if (op == 6) { - result = Value(v1.getInt(cxt) | v2.getInt(cxt)); + result = v1.getInt(cxt) | v2.getInt(cxt); } else if (op == 7) { result = v2; } @@ -141,7 +141,7 @@ Value Context::eval(peg::Ast& ast) { } } else if (ast.name == "Block") { // TODO create new scope - Value result = Value(Nil()); + Value result = Nil(); for (int i=0; i