Debian Codegraph @

js/src/tests/test262/language/statements/try/cptn-try.js

raw
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 `try` 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 [...]
12 3. Else B.[[type]] is not throw,
13 a. Let C be B.
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
20 assert.sameValue(eval('1; try { } catch (err) { }'), undefined);
21 assert.sameValue(eval('2; try { 3; } catch (err) { }'), 3);
22 assert.sameValue(eval('4; try { } catch (err) { 5; }'), undefined);
23 assert.sameValue(eval('6; try { 7; } catch (err) { 8; }'), 7);
24
25 reportCompare(0, 0);