From 8048a5ef7d459cbf523fe40c4cb0f955434dc461 Mon Sep 17 00:00:00 2001 From: Jordi Baylina Date: Mon, 3 Jun 2019 07:23:25 +0200 Subject: [PATCH] Fix and and or --- src/exec.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/exec.js b/src/exec.js index e553de1..867677c 100644 --- a/src/exec.js +++ b/src/exec.js @@ -397,6 +397,12 @@ function execInstantiateComponet(ctx, vr, fn) { function execFunctionCall(ctx, ast) { + if (ast.name == "log") { + const v = exec(ctx, ast.params[0]); + console.log(v.value.toString()); + return; + } + const scopeLevel = getScopeLevel(ctx, ast.name); if (scopeLevel == -1) return error(ctx, ast, "Function not defined: " + ast.name); const fnc = getScope(ctx, ast.name); @@ -750,7 +756,7 @@ function execAnd(ctx, ast) { if (!a.value || !b.value) return { type: "NUMBER" }; return { type: "NUMBER", - value: (a.value.neq(0) && a.value.neq(0)) ? bigInt(1) : bigInt(0) + value: (a.value.neq(0) && b.value.neq(0)) ? bigInt(1) : bigInt(0) }; } @@ -764,7 +770,7 @@ function execOr(ctx, ast) { if (!a.value || !b.value) return { type: "NUMBER" }; return { type: "NUMBER", - value: (a.value.neq(0) || a.value.neq(0)) ? bigInt(1) : bigInt(0) + value: (a.value.neq(0) || b.value.neq(0)) ? bigInt(1) : bigInt(0) }; }