mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-07 11:16:42 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7a41cda14 | ||
|
|
34049f2fbd |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.0.26",
|
"version": "0.0.27",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "circom",
|
"name": "circom",
|
||||||
"version": "0.0.26",
|
"version": "0.0.27",
|
||||||
"description": "Language to generate logic circuits",
|
"description": "Language to generate logic circuits",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ function genFor(ctx, ast) {
|
|||||||
const body = gen(ctx, ast.body);
|
const body = gen(ctx, ast.body);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
ctx.scopes.pop();
|
ctx.scopes.pop();
|
||||||
return `for (${init};${condition};${step}) { \n${body}\n }\n`;
|
return `for (${init};bigInt(${condition}).neq(bigInt(0));${step}) { \n${body}\n }\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function genWhile(ctx, ast) {
|
function genWhile(ctx, ast) {
|
||||||
@@ -253,7 +253,7 @@ function genWhile(ctx, ast) {
|
|||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
const body = gen(ctx, ast.body);
|
const body = gen(ctx, ast.body);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
return `while (${condition}) {\n${body}\n}\n`;
|
return `while (bigInt(${condition}).neq(bigInt(0))) {\n${body}\n}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function genIf(ctx, ast) {
|
function genIf(ctx, ast) {
|
||||||
@@ -264,9 +264,9 @@ function genIf(ctx, ast) {
|
|||||||
if (ast.else) {
|
if (ast.else) {
|
||||||
const elseBody = gen(ctx, ast.else);
|
const elseBody = gen(ctx, ast.else);
|
||||||
if (ctx.error) return;
|
if (ctx.error) return;
|
||||||
return `if (${condition}) {\n${thenBody}\n} else {\n${elseBody}\n}\n`;
|
return `if (bigInt(${condition}).neq(bigInt(0))) {\n${thenBody}\n} else {\n${elseBody}\n}\n`;
|
||||||
} else {
|
} else {
|
||||||
return `if (${condition}) {\n${thenBody}\n}\n`;
|
return `if (bigInt(${condition}).neq(bigInt(0))) {\n${thenBody}\n}\n`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user