From c89875ce8cc2a98bbf79a1d22dcd278ade81fdee Mon Sep 17 00:00:00 2001 From: Sam Stephenson Date: Thu, 18 Jan 2007 22:59:23 +0000 Subject: [PATCH] prototype: Remove support for "throw $continue" in Enumerable. Use "return" instead. --- CHANGELOG | 2 ++ Rakefile | 2 +- src/enumerable.js | 6 +----- test/unit/enumerable.html | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index a3fc280..83ddcde 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Remove support for "throw $continue" in Enumerable. Use "return" instead. [sam] + * Update HEADER to reflect new URL. [sam] *1.5.0* (January 18, 2007) diff --git a/Rakefile b/Rakefile index 173c0c7..79195cf 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,7 @@ PROTOTYPE_ROOT = File.expand_path(File.dirname(__FILE__)) PROTOTYPE_SRC_DIR = File.join(PROTOTYPE_ROOT, 'src') PROTOTYPE_DIST_DIR = File.join(PROTOTYPE_ROOT, 'dist') PROTOTYPE_PKG_DIR = File.join(PROTOTYPE_ROOT, 'pkg') -PROTOTYPE_VERSION = '1.5.0' +PROTOTYPE_VERSION = '1.5.1_pre0' task :default => [:dist, :package, :clean_package_source] diff --git a/src/enumerable.js b/src/enumerable.js index 9a157bb..6019a7a 100644 --- a/src/enumerable.js +++ b/src/enumerable.js @@ -6,11 +6,7 @@ var Enumerable = { var index = 0; try { this._each(function(value) { - try { - iterator(value, index++); - } catch (e) { - if (e != $continue) throw e; - } + iterator(value, index++); }); } catch (e) { if (e != $break) throw e; diff --git a/test/unit/enumerable.html b/test/unit/enumerable.html index 8b36b29..3f9387f 100644 --- a/test/unit/enumerable.html +++ b/test/unit/enumerable.html @@ -64,10 +64,10 @@ assertEqual(2, result); }}, - testEachContinue: function() {with(this) { + testEachReturnActsAsContinue: function() {with(this) { var results = []; [1, 2, 3].each(function(value) { - if (value == 2) throw $continue; + if (value == 2) return; results.push(value); });