blob: 3527b83b0a3ad1011f3c9303533de2bc74c3088a [file] [log] [blame]
Ben Murdoch4a90d5f2016-03-22 12:00:34 +00001// 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.
4
5function Foo(a, b) {
6 this.a = a;
7 this.b = b;
8 var bname = "b";
9 this.x = this["a"] + this[bname];
10}
11
12var f1 = new Foo(3, 4);
13assertEquals(7, f1.x);
14
15// SMIs
16for (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
22for (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
28for (var i = 0; i < 6; i++) {
29 var f = new Foo(i + "", (i + 2) + "");
30 assertEquals((i + "") + ((i + 2) + ""), f.x);
31}