]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Exceptions/statement-003.js
2 File Name: statement-003
3 Corresponds To: 12.6.3-7-n.js
4 ECMA Section: 12.6.3 The for...in Statement
6 The production IterationStatement : for ( LeftHandSideExpression in Expression )
7 Statement is evaluated as follows:
9 1. Evaluate the Expression.
10 2. Call GetValue(Result(1)).
11 3. Call ToObject(Result(2)).
12 4. Let C be "normal completion".
13 5. Get the name of the next property of Result(3) that doesn't have the
14 DontEnum attribute. If there is no such property, go to step 14.
15 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
16 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
17 1. If Type(V) is not Reference, generate a runtime error.
19 3. If Result(2) is null, go to step 6.
20 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
21 for the property name and W for the value.
23 6. Call the [[Put]] method for the global object, passing
24 GetPropertyName(V) for the property name and W for the value.
26 8. Evaluate Statement.
27 9. If Result(8) is a value completion, change C to be "normal completion
28 after value V" where V is the value carried by Result(8).
29 10. If Result(8) is a break completion, go to step 14.
30 11. If Result(8) is a continue completion, go to step 5.
31 12. If Result(8) is a return completion, return Result(8).
35 Author: christine@netscape.com
36 Date: 11 september 1997
38 var SECTION
= "statement-003";
39 var VERSION
= "JS1_4";
40 var TITLE
= "The for..in statment";
43 writeHeaderToLog( SECTION
+ " "+ TITLE
);
45 var testcases
= new Array();
48 var result
= "Failed";
49 var exception
= "No exception thrown";
50 var expect
= "Passed";
53 var o
= new MyObject();
56 eval("for ( this in o) {\n"
57 + "result += this[p];\n"
61 exception
= e
.toString();
64 testcases
[tc
++] = new TestCase(
66 "bad left-hand side expression" +
67 " (threw " + exception
+")",