OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --min-preparse-length=0 |
| 6 |
| 7 // The test functions in this file will be eagerly compiled. The functions |
| 8 // inside will be eagerly parsed but lazily compiled. |
| 9 |
| 10 (function TestLengths() { |
| 11 function inner(p1, p2, p3) { } |
| 12 assertEquals(3, inner.length); |
| 13 })(); |
| 14 |
| 15 (function TestAccessingContextVariables() { |
| 16 var in_context = 8; |
| 17 function inner() { return in_context; } |
| 18 assertEquals(8, inner()); |
| 19 })(); |
| 20 |
| 21 (function TestAccessingContextVariablesFromDeeper() { |
| 22 var in_context = 8; |
| 23 function inner() { |
| 24 function inner_inner() { |
| 25 function inner_inner_inner() { |
| 26 return in_context; |
| 27 } |
| 28 return inner_inner_inner; |
| 29 } |
| 30 return inner_inner; |
| 31 } |
| 32 assertEquals(8, inner()()()); |
| 33 })(); |
OLD | NEW |