tests/auto/qml/ecmascripttests/test262/test/language/expressions/arrow-function/arrow/capturing-closure-variables-2.js
raw| 1 | // Copyright 2015 Microsoft Corporation. All rights reserved. |
| 2 | // This code is governed by the license found in the LICENSE file. |
| 3 | |
| 4 | /*--- |
| 5 | description: Capturing closure variables - with |
| 6 | es6id: 14.2 |
| 7 | flags: [noStrict] |
| 8 | ---*/ |
| 9 | |
| 10 | function foo(){ |
| 11 | var a = {a : 10}; |
| 12 | with(a){ |
| 13 | return () => a; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | assert.sameValue(foo()(), 10, "Closure variable was captured incorrectly."); |