diff options
| author | jmoenig <jens@moenig.org> | 2014-07-25 14:35:36 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2014-07-25 14:35:36 +0200 |
| commit | 3aae7c3ce478c3d5ba5cb716a67bf117d0a48a84 (patch) | |
| tree | a31b7e799bf8eb7b60fbf46b689856899ab62778 /threads.js | |
| parent | 54fec68d787f385f87683df5011bbcec8f0c3f77 (diff) | |
| download | snap-yow-3aae7c3ce478c3d5ba5cb716a67bf117d0a48a84.tar.gz snap-yow-3aae7c3ce478c3d5ba5cb716a67bf117d0a48a84.zip | |
new “JavaScript function” primitive
Go figure…
Diffstat (limited to 'threads.js')
| -rw-r--r-- | threads.js | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -83,7 +83,7 @@ ArgLabelMorph, localize, XML_Element, hex_sha512*/ // Global stuff //////////////////////////////////////////////////////// -modules.threads = '2014-July-24'; +modules.threads = '2014-July-25'; var ThreadManager; var Process; @@ -741,6 +741,13 @@ Process.prototype.reifyPredicate = function (topBlock, parameterNames) { return this.reify(topBlock, parameterNames); }; +Process.prototype.reportJSFunction = function (parmNames, body) { + return Function.apply( + Object.create(Function.prototype), + parmNames.asArray().concat([body]) + ); +}; + Process.prototype.doRun = function (context, args, isCustomBlock) { return this.evaluate(context, args, true, isCustomBlock); }; @@ -751,6 +758,9 @@ Process.prototype.evaluate = function ( isCommand ) { if (!context) {return null; } + if (context instanceof Function) { + return context.apply(this.homeContext.receiver, args.asArray()); + } if (context.isContinuation) { return this.runContinuation(context, args); } |
