Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a lookup method on the Ctx, it's needed for code emitted for a pr…
…oto foo() {()}.
  • Loading branch information
pmurias committed Jan 24, 2015
1 parent 566743a commit ae81377
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/vm/js/nqp-runtime/runtime.js
Expand Up @@ -119,6 +119,17 @@ Ctx.prototype.lookup_dynamic = function(name) {
nqp code usually fallbacks to looking up of global */
};

Ctx.prototype.lookup = function(name, value) {
var ctx = this;
while (ctx) {
if (ctx.hasOwnProperty(name)) {
return ctx[name];
}
ctx = ctx.outer;
}
throw "Can't lookup: " + name;
};

Ctx.prototype.bind = function(name, value) {
var ctx = this;
while (ctx) {
Expand Down

0 comments on commit ae81377

Please sign in to comment.