Skip to content

Commit

Permalink
Fix signame dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-serrano committed Jan 5, 2024
1 parent a5f071e commit b0d2f98
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 32 deletions.
8 changes: 4 additions & 4 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* ------------------------------------------------------------- */
/* Author : Colin Vidal, Manuel Serrano */
/* Creation : Mon Jul 16 18:06:28 2018 */
/* Last change : Fri Dec 15 15:37:47 2023 (serrano) */
/* Copyright : 2018-23 Inria */
/* Last change : Fri Jan 5 16:49:45 2024 (serrano) */
/* Copyright : 2018-24 Inria */
/* ------------------------------------------------------------- */
/* HipHop compiler */
/*=====================================================================*/
Expand Down Expand Up @@ -84,7 +84,7 @@ class Circuit {
function getSignalObject(env, signame, ast_node) {

function unbound_error() {
throw error.TypeError(`${ast_node.tag}: unbound signal "${signame}".`,
throw error.TypeError(`${ast_node.tag}: unbound signal ${signame}`,
ast_node.loc);
}

Expand All @@ -95,7 +95,7 @@ function getSignalObject(env, signame, ast_node) {
if (sigprop.signal) {
return sigprop.signal;
} else {
throw error.TypeError(`${ast_node.tag}: wrong signal "${signame}".`,
throw error.TypeError(`${ast_node.tag}: wrong signal ${signame}`,
ast_node.loc);
}
}
Expand Down
5 changes: 2 additions & 3 deletions lib/hhc-compiler.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* ------------------------------------------------------------- */
/* Author : manuel serrano */
/* Creation : Wed Oct 25 08:13:33 2023 */
/* Last change : Sat Dec 23 14:58:37 2023 (serrano) */
/* Copyright : 2023 manuel serrano */
/* Last change : Fri Jan 5 10:29:53 2024 (serrano) */
/* Copyright : 2023-24 manuel serrano */
/* ------------------------------------------------------------- */
/* HipHop compiler */
/*=====================================================================*/
Expand Down Expand Up @@ -128,7 +128,6 @@ function compileHandler(err) {
"message": err.msg || err.message,
forceexit: true
});
throw "Syntax error.";
} else {
throw err;
}
Expand Down
14 changes: 9 additions & 5 deletions lib/hiphop-loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* ------------------------------------------------------------- */
/* Author : Manuel Serrano */
/* Creation : Fri Nov 17 08:15:59 2023 */
/* Last change : Tue Dec 12 09:43:53 2023 (serrano) */
/* Copyright : 2023 Manuel Serrano */
/* Last change : Fri Jan 5 10:49:33 2024 (serrano) */
/* Copyright : 2023-24 Manuel Serrano */
/* ------------------------------------------------------------- */
/* HipHop loader/resolver loaders. */
/*=====================================================================*/
Expand Down Expand Up @@ -102,9 +102,13 @@ async function HHcompile(url) {
return target;
} else {
const prog = compile(path);
await prog.output(target);
await prog.sourcemap(target);
return target;
if (prog) {
await prog.output(target);
await prog.sourcemap(target);
return target;
} else {
return false;
}
}
}

Expand Down
9 changes: 6 additions & 3 deletions preprocessor/hhaccess.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* ------------------------------------------------------------- */
/* Author : manuel serrano */
/* Creation : Wed Oct 25 10:36:55 2023 */
/* Last change : Thu Dec 14 08:11:08 2023 (serrano) */
/* Copyright : 2023 manuel serrano */
/* Last change : Fri Jan 5 21:21:11 2024 (serrano) */
/* Copyright : 2023-24 manuel serrano */
/* ------------------------------------------------------------- */
/* This is the version used by the nodejs port (see _hhaccess.hop) */
/* ------------------------------------------------------------- */
Expand Down Expand Up @@ -125,7 +125,7 @@ function nodeAccessors(node, axs, iscnt, hhname, accessors) {

switch (field.val) {
case "signame":
return sigaccess(loc, name, false, false);
return sigaccess(loc, name, true, false);
case "now":
return sigaccess(loc, name, false, false);
case "nowval":
Expand Down Expand Up @@ -208,6 +208,9 @@ function nodeAccessors(node, axs, iscnt, hhname, accessors) {
case "preval":
axs.val = true;
axs.pre = true;
case "signame":
axs.val = false;
axs.pre = true;
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion test/eval.hh.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ const prog = hh.eval(`hiphop module() {
} every(R.now)
}`);

const mach = new hh.ReactiveMachine(prog, "ABRO");
const mach = new hh.ReactiveMachine(prog, "EABRO");
30 changes: 15 additions & 15 deletions test/eval.out
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
ABRO> ;
EABRO> ;
--- Output:
ABRO> A B;
EABRO> A B;
--- Output: O
ABRO> A B;
EABRO> A B;
--- Output:
ABRO> R;
EABRO> R;
--- Output:
ABRO> A B;
EABRO> A B;
--- Output: O
ABRO> A B;
EABRO> A B;
--- Output:
ABRO> R;
EABRO> R;
--- Output:
ABRO> B;
EABRO> B;
--- Output:
ABRO> A;
EABRO> A;
--- Output: O
ABRO> A;
EABRO> A;
--- Output:
ABRO> B;
EABRO> B;
--- Output:
ABRO> R B;
EABRO> R B;
--- Output:
ABRO> A;
EABRO> A;
--- Output:
ABRO> ;
EABRO> ;
--- Output:
ABRO> B;
EABRO> B;
--- Output: O
2 changes: 1 addition & 1 deletion test/loopeach.hh.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ hiphop module prg() {
in I; out O;
do {
emit O();
} every( I.now )
} every(I.now)
}

export const mach = new hh.ReactiveMachine(prg, "loopeach");

0 comments on commit b0d2f98

Please sign in to comment.