cptn-catch.js (1169B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 es6id: 13.15.8 5 description: Completion value from `catch` clause of a try..catch statement 6 info: | 7 TryStatement : try Block Catch 8 9 1. Let B be the result of evaluating Block. 10 2. If B.[[type]] is throw, then 11 a. Let C be CatchClauseEvaluation of Catch with parameter B.[[value]]. 12 3. Else B.[[type]] is not throw, 13 [...] 14 4. If C.[[type]] is return, or C.[[type]] is throw, return Completion(C). 15 5. If C.[[value]] is not empty, return Completion(C). 16 6. Return Completion{[[type]]: C.[[type]], [[value]]: undefined, 17 [[target]]: C.[[target]]}. 18 19 13.15.7 Runtime Semantics: CatchClauseEvaluation 20 21 Catch : catch ( CatchParameter ) Block 22 23 [...] 24 7. Let B be the result of evaluating Block. 25 8. Set the running execution context’s LexicalEnvironment to oldEnv. 26 9. Return Completion(B). 27 ---*/ 28 29 assert.sameValue(eval('1; try { throw null; } catch (err) { }'), undefined); 30 assert.sameValue(eval('2; try { throw null; } catch (err) { 3; }'), 3); 31 32 reportCompare(0, 0);