mattbierner / atum

Javascript Interpreter in Functional-Style Javascript
MIT License
19 stars 2 forks source link

Not Initializing Declaration Bindings in Correct order #159

Closed mattbierner closed 10 years ago

mattbierner commented 10 years ago

10.5 specifies how the bindings should be initialized for code (This is completely absurd by the way).

Currently, the fn decls and var decls are inited together but this should be split with the arguments binding init in the middle.

mattbierner commented 10 years ago

Example:

function f(x) { function x(){ return 10; } return x; }
f(1)()

Should return 10 but throws because f(1) returns 1 and not the inner fn.

This works fine:

function f(x) { var x = function() { return 10; }; return x; }
f(1)()