Implement parsing, evaluation, lexical this capture, and new rejection for arrow functions. Covers expression bodies, block bodies, zero/single/ multi-param forms, and backtracking disambiguation from grouping parens. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8 lines
172 B
JavaScript
8 lines
172 B
JavaScript
// Arrow functions capture `this` from the enclosing scope
|
|
function Obj() {
|
|
this.val = 100;
|
|
this.getVal = () => this.val;
|
|
}
|
|
var o = new Obj();
|
|
console.log(o.getVal());
|