You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i have been using nools for a while(v0.4.1) and i found a bug today.
when i compiled *.nools files using the command
nools compile -b test.nools > test.js
, i found the simple rule
function t(){
return 1;
}
rule 'r'{
when {
s: String;
n: Number from t();
}
then {
console.log('n is ', n);
}
}
i got the js file
this.rule("r", {
scope: scope
}, [ [ Number, "n", "true" ] ], function(facts, flow) {
var n = facts.n;
var console = scope.console;
var t = scope.t;
console.log("init");
});
"from test()" changed to "true"
i debugged and found the code in nools/lib/parser/nools/tokens.js:line158
rule.push(constraints);
should be changed into
constraints && rule.push(constraints);
i wish this could be resolved in feature because i cann't use compile in code which takes more time
The text was updated successfully, but these errors were encountered:
I would recommend to use from either with a constant, a fact or a set of facts. You're probably right about the evaluation problem of the from constraint.
i have been using nools for a while(v0.4.1) and i found a bug today.
when i compiled *.nools files using the command
nools compile -b test.nools > test.js
, i found the simple rule
function t(){
return 1;
}
rule 'r'{
when {
s: String;
n: Number from t();
}
then {
console.log('n is ', n);
}
}
i got the js file
this.rule("r", {
scope: scope
}, [ [ Number, "n", "true" ] ], function(facts, flow) {
var n = facts.n;
var console = scope.console;
var t = scope.t;
console.log("init");
});
"from test()" changed to "true"
i debugged and found the code in nools/lib/parser/nools/tokens.js:line158
rule.push(constraints);
should be changed into
constraints && rule.push(constraints);
i wish this could be resolved in feature because i cann't use compile in code which takes more time
The text was updated successfully, but these errors were encountered: