Espruino/tests/test_context1.js
Gordon Williams 386599fe75 Remove JSV_PARENTINFO, as it turns out JS doesn't keep track of function scopes anyway (fix #109)
Make 'this' a keyword (now faster, more memory efficient)
            Make 'Hardware' (root) the default value of 'this'
2013-12-03 17:39:02 +00:00

14 lines
303 B
JavaScript

// See https://github.com/espruino/Espruino/issues/109
var a = { hi : "Hello", b : function() { return this.hi; } };
function run(cb) { return cb(); }
var c = a.b;
var res = [
a.b(),
run(a.b),
c(),
run(c) ];
result = res[0]=="Hello" && res[1]===undefined && res[2]===undefined && res[3]===undefined;