Compare commits

...

2 Commits

Author SHA1 Message Date
Jordi Baylina
0df0ac712d 0.0.32 2019-09-15 10:48:02 +02:00
Jordi Baylina
67a35ee400 better info in runtime constraint assertion 2019-09-15 10:47:52 +02:00
4 changed files with 8 additions and 4 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "circom",
"version": "0.0.31",
"version": "0.0.32",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "circom",
"version": "0.0.31",
"version": "0.0.32",
"description": "Language to generate logic circuits",
"main": "index.js",
"directories": {

View File

@@ -1046,6 +1046,8 @@ function execSignalAssign(ctx, ast) {
}
function execConstrain(ctx, ast) {
ast.fileName = ctx.fileName;
ast.filePath = ctx.filePath;
const a = exec(ctx, ast.values[0]);
if (ctx.error) return;
const b = exec(ctx, ast.values[1]);

View File

@@ -422,11 +422,13 @@ function genConstrain(ctx, ast) {
if (ctx.error) return;
const b = gen(ctx, ast.values[1]);
if (ctx.error) return;
return `ctx.assert(${a}, ${b})`;
const strErr = ast.fileName +": "+ast.first_line;
return `ctx.assert(${a}, ${b}, \"${strErr}\")`;
}
function genSignalAssignConstrain(ctx, ast) {
return genVarAssignement(ctx, ast) + ";\n" + genConstrain(ctx, ast);
// return genVarAssignement(ctx, ast) + ";\n" + genConstrain(ctx, ast);
return genVarAssignement(ctx, ast);
}
function genVarAddAssignement(ctx, ast) {