]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/setter.js
8 for (var i
= 0; i
< 100; ++i
) {
10 o
.__defineSetter__("f", function(value
) { this.g_
+= 42 * value
; });
11 o
.__defineSetter__("g", function(value
) { this.g_
+= 43 * value
; });
12 o
.__defineSetter__("h", function(value
) { this.g_
+= 44 * value
; });
13 o
.__defineSetter__("i", function(value
) { this.g_
+= 45 * value
; });
14 o
.__defineSetter__("j", function(value
) { this.g_
+= 46 * value
; });
15 o
.__defineSetter__("k", function(value
) { this.g_
+= 47 * value
; });
17 if (o
.g_
!= 5 + 42 * 29 + 29 * 47 * 33)
18 throw "Error: bad result: " + o
.g_
;
21 // Test the case where those fields aren't setters anymore.
31 throw "Error: bad value of g_: " + o
.g_
;
33 throw "Error: bad value of f: " + o
.f
;
35 throw "Error: bad value of k: " + o
.k
;
37 // Test the case where they are setters but they're not the same setters.
39 o
.__defineSetter__("f", function(value
) { this.g_
+= 52 * value
; });
40 o
.__defineSetter__("g", function(value
) { this.g_
+= 53 * value
; });
41 o
.__defineSetter__("h", function(value
) { this.g_
+= 54 * value
; });
42 o
.__defineSetter__("i", function(value
) { this.g_
+= 55 * value
; });
43 o
.__defineSetter__("j", function(value
) { this.g_
+= 56 * value
; });
44 o
.__defineSetter__("k", function(value
) { this.g_
+= 57 * value
; });
46 if (o
.g_
!= 5 + 52 * 29 + 29 * 57 * 33)
47 throw "Error: bad result at end: " + o
.g_
;