mirror of
https://github.com/arnaucube/circom.git
synced 2026-02-07 03:06:42 +01:00
compute block added
This commit is contained in:
@@ -116,6 +116,8 @@ function gen(ctx, ast) {
|
||||
return genFunctionCall(ctx, ast);
|
||||
} else if (ast.type == "BLOCK") {
|
||||
return genBlock(ctx, ast);
|
||||
} else if (ast.type == "COMPUTE") {
|
||||
return genCompute(ctx, ast);
|
||||
} else if (ast.type == "FOR") {
|
||||
return genFor(ctx, ast);
|
||||
} else if (ast.type == "WHILE") {
|
||||
@@ -256,6 +258,12 @@ function genWhile(ctx, ast) {
|
||||
return `while (bigInt(${condition}).neq(bigInt(0))) {\n${body}\n}\n`;
|
||||
}
|
||||
|
||||
function genCompute(ctx, ast) {
|
||||
const body = gen(ctx, ast.body);
|
||||
if (ctx.error) return;
|
||||
return `{\n${body}\n}\n`;
|
||||
}
|
||||
|
||||
function genIf(ctx, ast) {
|
||||
const condition = gen(ctx, ast.condition);
|
||||
if (ctx.error) return;
|
||||
|
||||
Reference in New Issue
Block a user