diff options
Diffstat (limited to 'js/src/jit-test/lib/range.js')
-rw-r--r-- | js/src/jit-test/lib/range.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/src/jit-test/lib/range.js b/js/src/jit-test/lib/range.js new file mode 100644 index 000000000..e37c6351e --- /dev/null +++ b/js/src/jit-test/lib/range.js @@ -0,0 +1,22 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Library file for tests to load. + +function Range(start, stop) { + this.i = start; + this.stop = stop; +} +Range.prototype = { + __iterator__: function() { return this; }, + next: function() { + if (this.i >= this.stop) + throw StopIteration; + return this.i++; + } +}; + +function range(start, stop) { + return new Range(start, stop); +} |