| 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 | var __terminate_interpreter__ = new Continuation(); |
| 6 | var c; |
| 7 | |
| 8 | function fib(x) { |
| 9 | c = getContinuation(); |
| 10 | if(c != null) { |
| 11 | this.__terminate_interpreter__(null); |
| 12 | } |
| 13 | return x < 2 ? 1 : (fib(x-1) + fib(x-2)); |
| 14 | } |
| 15 | |
| 16 | function getContinuation() { |
| 17 | return new Continuation(); |
| 18 | } |
| 19 | |
| 20 | var result = fib(3); |