assert working

This commit is contained in:
Jordi Baylina
2020-08-24 09:31:35 +02:00
parent f02ceb2508
commit aa2d768465
9 changed files with 100 additions and 19 deletions

View File

@@ -871,6 +871,12 @@ function genFunctionCall(ctx, ast) {
ctx.codeBuilder.log(toRefA_Fr1(ctx, ast.params[0], vRef));
return vRef;
}
if (ast.name == "assert") {
const strErr = ast.fileName + ":" + ast.first_line + ":" + ast.first_column;
const vRef = gen(ctx, ast.params[0]);
ctx.codeBuilder.checkAssert(toRefA_Fr1(ctx, ast.params[0], vRef), strErr);
return vRef;
}
const params = [];
for (let i=0; i<ast.params.length; i++) {
const pRef = gen(ctx, ast.params[i]);