OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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. | |
Michael Starzinger
2015/04/21 14:04:34
suggestion: Maybe call the files "named-load.js" a
| |
4 | |
5 function Foo(a, b) { | |
6 this.a = a; | |
7 this.b = b; | |
8 var bname = "b"; | |
9 this.x = this["a"] + this[bname]; | |
10 } | |
11 | |
12 var f1 = new Foo(3, 4); | |
13 assertEquals(7, f1.x); | |
14 | |
15 // SMIs | |
16 for (var i = 0; i < 6; i++) { | |
17 var f = new Foo(i, i + 2); | |
18 assertEquals(i + i + 2, f.x); | |
19 } | |
20 | |
21 // derbles | |
22 for (var i = 0.25; i < 6.25; i++) { | |
23 var f = new Foo(i, i + 2); | |
24 assertEquals(i + i + 2, f.x); | |
25 } | |
26 | |
27 // stirngs | |
28 for (var i = 0; i < 6; i++) { | |
29 var f = new Foo(i + "", (i + 2) + ""); | |
30 assertEquals((i + "") + ((i + 2) + ""), f.x); | |
31 } | |
OLD | NEW |