Debian Codegraph @

rhino/testsrc/doctests/tail-call-in-try.doctest

raw
1 // This Source Code Form is subject to the terms of the Mozilla Public
2 // License, v. 2.0. If a copy of the MPL was not distributed with this
3 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
4
5 // Fix bug reported in newsgroup:
6 // Tail call optimization was interfering with catching exceptions.
7 // The following program should print 7, but was resulting in an uncaught
8 // exception.
9 js> function g() {
10 > throw 3;
11 > }
12 js> function f() {
13 > try {
14 > return g();
15 > } catch (e) {
16 > return 7;
17 > }
18 > }
19 js> f()
20 7