Skip to content

Commit

Permalink
Better aliases for 'ecmascript-5.1' interpreter; closes #6
Browse files Browse the repository at this point in the history
Previously the code only supported 'goja', which is a ridiculous
vestige from github.com/Comcast/sheens.  For backwards compatibility
(for code, documentation, and examples), "goja" still works.

"ecmascript" and "ecmascript-5.1" are now equivalent.
  • Loading branch information
jsccast committed May 29, 2018
1 parent 358cc59 commit 6be3f03
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/step.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,20 @@ function step(ctx,spec,state,message) {
var bs = current;
var emitted = [];

// The following strings are interpretered as aliases for our only
// actual interpreter, which is probably close to Ecmascript 5.1.
// "goja" is in this list for backwards compatability due to
// vestiges of github.com/Comcast/sheens history.
var interpreterAliases = ["ecmascript", "ecmascript-5.1", "goja"];

var node = spec.nodes[state.node];
if (!node) {
throw {error: "node not found", node: state.node};
}

var action = node.action;
if (action) {
if (action.interpreter != "goja") {
if (interpreterAliases.indexOf(action.interpreter) < 0) {
throw {error: "bad interpreter", interpreter: action.interpreter};
}
var evaled = sandboxedAction(ctx, bs, action.source);
Expand Down Expand Up @@ -56,7 +62,7 @@ function step(ctx,spec,state,message) {
bs = bss[0];
}
if (branch.guard) {
if (branch.guard.interpreter != "goja") {
if (interpreterAliases.indexOf(branch.guard.interpreter) < 0) {
throw {error: "bad guard interpreter", interpreter: branch.guard.interpreter};
}
var evaled = sandboxedAction(ctx, bs, branch.guard.source);
Expand Down

0 comments on commit 6be3f03

Please sign in to comment.