From 0f138abeddf2c65558084b583e836c389ce8e3c5 Mon Sep 17 00:00:00 2001 From: CPunch Date: Mon, 30 Nov 2020 12:40:36 -0600 Subject: [PATCH] minor refactoring --- src/cvm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cvm.c b/src/cvm.c index acac5ee..71d22c5 100644 --- a/src/cvm.c +++ b/src/cvm.c @@ -465,7 +465,7 @@ bool cosmoV_execute(CState *state) { break; } case OP_NOT: { - cosmoV_pushValue(state, cosmoV_newBoolean(isFalsey(cosmoV_pop(state)))); + cosmoV_pushBoolean(state, isFalsey(cosmoV_pop(state))); break; } case OP_NEGATE: { // pop 1 value off the stack & try to negate @@ -473,7 +473,7 @@ bool cosmoV_execute(CState *state) { if (val->type == COSMO_TNUMBER) { cosmoV_pop(state); - cosmoV_pushValue(state, cosmoV_newNumber(-(val->val.num))); + cosmoV_pushNumber(state, -(val->val.num)); } else { cosmoV_error(state, "Expected number, got %s!", cosmoV_typeStr(*val)); } @@ -591,7 +591,7 @@ bool cosmoV_execute(CState *state) { StkPtr valA = cosmoV_pop(state); // compare & push - cosmoV_pushValue(state, cosmoV_newBoolean(cosmoV_equal(*valA, *valB))); + cosmoV_pushBoolean(state, cosmoV_equal(*valA, *valB)); break; } case OP_GREATER: { @@ -610,8 +610,8 @@ bool cosmoV_execute(CState *state) { BINARYOP(cosmoV_newBoolean, <=) break; } - case OP_TRUE: cosmoV_pushValue(state, cosmoV_newBoolean(true)); break; - case OP_FALSE: cosmoV_pushValue(state, cosmoV_newBoolean(false)); break; + case OP_TRUE: cosmoV_pushBoolean(state, true); break; + case OP_FALSE: cosmoV_pushBoolean(state, false); break; case OP_NIL: cosmoV_pushValue(state, cosmoV_newNil()); break; case OP_RETURN: { return true;