yoya / js2-mode

Automatically exported from code.google.com/p/js2-mode
0 stars 0 forks source link

Variable defined in closure considered undefined #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Try the following test program:

var testColors = function () {
  var var1 = false;
  var fun1 = function () {
    var1 = true;
  };
  return {A: function () {fun1();}};
} ();

The var1 variable is colored Orange in the function fun1, and if you put
the mouse cursor on it it says "Undeclared Variable" in the minibuffer.  

What is the expected output? What do you see instead?

var1 is declared above fun1 and captured by the closure and so it should
not be called "Undeclared Variable".  I suspect it should not be colored
Orange as well (I'm not yet sure of the coloring scheme).

What version of the product are you using? On what operating system?

js2-20080406.el on GNU Emacs 23.0.60.1 (X11, gtk) on Mac OS X 10.4.11

Original issue reported on code.google.com by bob.spam...@gmail.com on 11 Apr 2008 at 1:59

GoogleCodeExporter commented 8 years ago
js2-get-defining-scope does walk up the parent chain if it doesn't find the 
variable
in the current scope, so perhaps the scope's parent field isn't being set 
correctly?

Original comment by dlb...@gmail.com on 14 Apr 2008 at 8:28

GoogleCodeExporter commented 8 years ago
Fixed in 20080413 release.

Original comment by steve.ye...@gmail.com on 14 Apr 2008 at 10:04