]>
Commit | Line | Data |
---|---|---|
b37bf2e1 A |
1 | /** |
2 | File Name: statement-002.js | |
3 | Corresponds To: 12.6.3-1.js | |
4 | ECMA Section: 12.6.3 The for...in Statement | |
5 | Description: | |
6 | The production IterationStatement : for ( LeftHandSideExpression in Expression ) | |
7 | Statement is evaluated as follows: | |
8 | ||
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. | |
18 | 2. Call GetBase(V). | |
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. | |
22 | 5. Return. | |
23 | 6. Call the [[Put]] method for the global object, passing | |
24 | GetPropertyName(V) for the property name and W for the value. | |
25 | 7. Return. | |
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). | |
32 | 13. Go to step 5. | |
33 | 14. Return C. | |
34 | ||
35 | Author: christine@netscape.com | |
36 | Date: 11 september 1997 | |
37 | */ | |
38 | var SECTION = "statement-002"; | |
39 | var VERSION = "JS1_4"; | |
40 | var TITLE = "The for..in statment"; | |
41 | ||
42 | var testcases = new Array(); | |
43 | var tc = 0; | |
44 | ||
45 | startTest(); | |
46 | writeHeaderToLog( SECTION + " "+ TITLE); | |
47 | ||
48 | var result = "Failed"; | |
49 | var exception = "No exception thrown"; | |
50 | var expect = "Passed"; | |
51 | ||
52 | try { | |
53 | eval(" for ( var i, p in this) { result += this[p]; }"); | |
54 | } catch ( e ) { | |
55 | result = expect; | |
56 | exception = e.toString(); | |
57 | } | |
58 | ||
59 | testcases[tc++] = new TestCase( | |
60 | SECTION, | |
61 | "more than one member expression" + | |
62 | " (threw " + exception +")", | |
63 | expect, | |
64 | result ); | |
65 | ||
66 | test(); |