Skip to content

Commit

Permalink
[js] Add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
pmurias committed Mar 26, 2017
1 parent bb30a4d commit 91070a8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/vm/js/nqp-runtime/code-ref-with-statevars.js
@@ -0,0 +1,34 @@
var CodeRef = require('./code-ref.js');
class CodeRefWithStateVars extends CodeRef {
freshBlock() {
return this.closureTemplate();
}

$$clone() {
var clone = new CodeRefWithStateVars(this.name, undefined);
clone.$$call = this.freshBlock();
clone.codeObj = this.codeObj;
clone.staticCode = this.staticCode;
clone.closureTemplate = this.closureTemplate;
clone.outerCtx = this.outerCtx;
return clone;
}

closure(block) {
/* TODO cloning won't work with a closureTemplate */
throw 'CodeRefWithStateVars.closure NYI';
}

closureCtx(outerCtx) {
var closure = new CodeRefWithStateVars(this.name, this.cuid);
closure.codeObj = this.codeObj;
closure.$$call = this.freshBlock();
closure.closureTemplate = this.closureTemplate;
closure.staticCode = this;

closure.outerCtx = outerCtx;

return closure;
}
};
module.exports = CodeRefWithStateVars;

0 comments on commit 91070a8

Please sign in to comment.