mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-08 03:36:45 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
859c98d2a4 | ||
|
|
8048a5ef7d |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.0.27",
|
"version": "0.0.28",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.0.27",
|
"version": "0.0.28",
|
||||||
"description": "Language to generate logic circuits",
|
"description": "Language to generate logic circuits",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
10
src/exec.js
10
src/exec.js
@@ -397,6 +397,12 @@ function execInstantiateComponet(ctx, vr, fn) {
|
|||||||
|
|
||||||
function execFunctionCall(ctx, ast) {
|
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);
|
const scopeLevel = getScopeLevel(ctx, ast.name);
|
||||||
if (scopeLevel == -1) return error(ctx, ast, "Function not defined: " + ast.name);
|
if (scopeLevel == -1) return error(ctx, ast, "Function not defined: " + ast.name);
|
||||||
const fnc = getScope(ctx, ast.name);
|
const fnc = getScope(ctx, ast.name);
|
||||||
@@ -750,7 +756,7 @@ function execAnd(ctx, ast) {
|
|||||||
if (!a.value || !b.value) return { type: "NUMBER" };
|
if (!a.value || !b.value) return { type: "NUMBER" };
|
||||||
return {
|
return {
|
||||||
type: "NUMBER",
|
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" };
|
if (!a.value || !b.value) return { type: "NUMBER" };
|
||||||
return {
|
return {
|
||||||
type: "NUMBER",
|
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)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user