summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Gozde <johng@pandell.com>2013-04-23 10:34:07 -0600
committerJohn Gozde <johng@pandell.com>2013-04-23 10:34:07 -0600
commitd773a09d0f7daaad8bdba6f6668a622544ee6ebf (patch)
tree559428fa24d302b6577b7fb4ba6959e9a4a57872
parent7c540d219efc68105a0452b9830370b3ed33058d (diff)
downloadSlickGrid-d773a09d0f7daaad8bdba6f6668a622544ee6ebf.zip
SlickGrid-d773a09d0f7daaad8bdba6f6668a622544ee6ebf.tar.gz
SlickGrid-d773a09d0f7daaad8bdba6f6668a622544ee6ebf.tar.bz2
Fix inlining for evaluated return statements.
Applies the following regex changes: - Match closing brace and end-of-input as valid `return` terminators - Preserve captured return terminator in inlined function - Tolerate arbitrary spacing before return terminators
-rw-r--r--slick.dataview.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/slick.dataview.js b/slick.dataview.js
index 53806c1..bdeae0c 100644
--- a/slick.dataview.js
+++ b/slick.dataview.js
@@ -615,8 +615,8 @@
var filterBody = filterInfo.body
.replace(/return false\s*([;}]|$)/gi, "{ continue _coreloop; }$1")
.replace(/return true\s*([;}]|$)/gi, "{ _retval[_idx++] = $item$; continue _coreloop; }$1")
- .replace(/return ([^;}]+?);/gi,
- "{ if ($1) { _retval[_idx++] = $item$; }; continue _coreloop; }");
+ .replace(/return ([^;}]+?)\s*([;}]|$)/gi,
+ "{ if ($1) { _retval[_idx++] = $item$; }; continue _coreloop; }$2");
// This preserves the function template code after JS compression,
// so that replace() commands still work as expected.
@@ -647,8 +647,8 @@
var filterBody = filterInfo.body
.replace(/return false\s*([;}]|$)/gi, "{ continue _coreloop; }$1")
.replace(/return true\s*([;}]|$)/gi, "{ _cache[_i] = true;_retval[_idx++] = $item$; continue _coreloop; }$1")
- .replace(/return ([^;}]+?);/gi,
- "{ if ((_cache[_i] = $1)) { _retval[_idx++] = $item$; }; continue _coreloop; }");
+ .replace(/return ([^;}]+?)\s*([;}]|$)/gi,
+ "{ if ((_cache[_i] = $1)) { _retval[_idx++] = $item$; }; continue _coreloop; }$2");
// This preserves the function template code after JS compression,
// so that replace() commands still work as expected.