jshint/jshint — pull request #425 by antonkovalyov (2012-01-20 01:06:00+00:00)
Title: Fixed undef:true to respect function hoisting

Related: GH-424, GH-367, GH-379.

My previous implementation checked only the immediate function scope and global scope, it didn't check parent environments. So this worked as expected:

```javascript
function A() {
B();
}

function B() {
}
```

While this didn't:

```javascript
function A() {
function B() {
C();
}

function C() {
}
}
```

This patch fixes that by checking all parent environments all the way up to the global scope (L4106). In addition to the fix I've added a regression test and made a tiny helper to load fixtures.

And because I am an awful computer programmer I accidentally included my commit that moves Backbone.js regression test to the regression/ directory. Oh well:

![](http://i.imgur.com/VhlQK.gif)