| 1 |
// Copyright 2009 the Sputnik authors. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
info: | |
| 6 |
While evaluating "for (ExpressionNoIn; FirstExpression; SecondExpression) |
| 7 |
Statement", ExpressionNoIn is evaulated first, FirstExpressoin is |
| 8 |
evaluated second |
| 9 |
es5id: 12.6.3_A3 |
| 10 |
description: Using "(function(){throw "FirstExpression"})()" as FirstExpression |
| 11 |
---*/ |
| 12 |
|
| 13 |
var __in__NotInExpression__, __in__NotInExpression__2, __in__for; |
| 14 |
|
| 15 |
////////////////////////////////////////////////////////////////////////////// |
| 16 |
//CHECK#1 |
| 17 |
try { |
| 18 |
for((function(){__in__NotInExpression__ = "checked";__in__NotInExpression__2 = "passed";})(); (function(){throw "FirstExpression"})(); (function(){throw "SecondExpression"})()) { |
| 19 |
__in__for="reached"; |
| 20 |
} |
| 21 |
throw new Test262Error('#1: (function(){throw "SecondExpression"} lead to throwing exception'); |
| 22 |
} catch (e) { |
| 23 |
if (e !== "FirstExpression") { |
| 24 |
throw new Test262Error('#1: When for (ExpressionNoIn ; FirstExpression ; SecondExpression) Statement is evaluated first evaluates ExpressionNoIn then FirstExpression'); |
| 25 |
} |
| 26 |
} |
| 27 |
// |
| 28 |
////////////////////////////////////////////////////////////////////////////// |
| 29 |
|
| 30 |
////////////////////////////////////////////////////////////////////////////// |
| 31 |
//CHECK#2 |
| 32 |
if ((__in__NotInExpression__ !== "checked")&(__in__NotInExpression__2!=="passed")) { |
| 33 |
throw new Test262Error('#2: (__in__NotInExpression__ === "checked")&(__in__NotInExpression__2==="passed")'); |
| 34 |
} |
| 35 |
// |
| 36 |
////////////////////////////////////////////////////////////////////////////// |
| 37 |
|
| 38 |
////////////////////////////////////////////////////////////////////////////// |
| 39 |
//CHECK#3 |
| 40 |
if (typeof __in__for !== "undefined") { |
| 41 |
throw new Test262Error('#3: typeof __in__for === "undefined". Actual: typeof __in__for ==='+ typeof __in__for ); |
| 42 |
} |
| 43 |
// |
| 44 |
////////////////////////////////////////////////////////////////////////////// |
| 45 |
|
| 46 |
reportCompare(0, 0); |