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