| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,28 @@ | |||
| 1 | + /* eslint-disable strict */ | ||
| 2 | + require('../common'); | ||
| 3 | + var assert = require('assert'); | ||
| 4 | + | ||
| 5 | + /* | ||
| 6 | + in node 0.10 a bug existed that caused strict functions to not capture | ||
| 7 | + their environment when evaluated. When run in 0.10 `test()` fails with a | ||
| 8 | + `ReferenceError`. See https://github.com/nodejs/node/issues/2245 for details. | ||
| 9 | + */ | ||
| 10 | + | ||
| 11 | + function test() { | ||
| 12 | + | ||
| 13 | + var code = [ | ||
| 14 | + 'var foo = {m: 1};', | ||
| 15 | + '', | ||
| 16 | + 'function bar() {', | ||
| 17 | + '\'use strict\';', | ||
| 18 | + 'return foo; // foo isn\'t captured in 0.10', | ||
| 19 | + '};' | ||
| 20 | + ].join('\n'); | ||
| 21 | + | ||
| 22 | + eval(code); | ||
| 23 | + | ||
| 24 | + return bar(); | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + assert.deepEqual(test(), {m: 1}); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments