Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jsonata.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ declare namespace jsonata {
}

interface Environment {
bind(name: string, value: any): void;
lookup(name: string): any;
bind(name: string | symbol, value: any): void;
lookup(name: string | symbol): any;
readonly timestamp: Date;
readonly async: boolean;
}
Expand Down
4 changes: 2 additions & 2 deletions src/jsonata.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var jsonata = (function() {
async function evaluate(expr, input, environment) {
var result;

var entryCallback = environment.lookup('__evaluate_entry');
var entryCallback = environment.lookup(Symbol.for('jsonata.__evaluate_entry'));
if(entryCallback) {
await entryCallback(expr, input, environment);
}
Expand Down Expand Up @@ -124,7 +124,7 @@ var jsonata = (function() {
result = await evaluateGroupExpression(expr.group, result, environment);
}

var exitCallback = environment.lookup('__evaluate_exit');
var exitCallback = environment.lookup(Symbol.for('jsonata.__evaluate_exit'));
if(exitCallback) {
await exitCallback(expr, input, environment, result);
}
Expand Down
4 changes: 2 additions & 2 deletions test/implementation-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,11 +1057,11 @@ function timeboxExpression(expr, timeout, maxDepth) {
};

// register callbacks
expr.assign("__evaluate_entry", function() {
expr.assign(Symbol.for('jsonata.__evaluate_entry'), function() {
depth++;
checkRunnaway();
});
expr.assign("__evaluate_exit", function() {
expr.assign(Symbol.for('jsonata.__evaluate_exit'), function() {
depth--;
checkRunnaway();
});
Expand Down
4 changes: 2 additions & 2 deletions test/run-test-suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ function timeboxExpression(expr, timeout, maxDepth) {
};

// register callbacks
expr.assign("__evaluate_entry", function(expr, input, env) {
expr.assign(Symbol.for('jsonata.__evaluate_entry'), function(expr, input, env) {
if (env.isParallelCall) return;
depth++;
checkRunnaway();
});
expr.assign("__evaluate_exit", function(expr, input, env) {
expr.assign(Symbol.for('jsonata.__evaluate_exit'), function(expr, input, env) {
if (env.isParallelCall) return;
depth--;
checkRunnaway();
Expand Down