Merge branch 'thejh-bugfix-1099' into stable

This commit is contained in:
Michael Ficarra 2011-03-27 23:47:01 -04:00
commit 90495b614f
4 changed files with 9 additions and 0 deletions

View File

@ -1719,6 +1719,9 @@
}
return _results;
}).call(this);
if (tests.length === 0) {
return 'false';
}
tests = tests.join(cnj);
if (o.level < LEVEL_OP) {
return tests;

View File

@ -1340,6 +1340,7 @@ exports.In = class In extends Base
[cmp, cnj] = if @negated then [' !== ', ' && '] else [' === ', ' || ']
tests = for item, i in @array.base.objects
(if i then ref else sub) + cmp + item.compile o, LEVEL_OP
return 'false' if tests.length is 0
tests = tests.join cnj
if o.level < LEVEL_OP then tests else "(#{tests})"

View File

@ -58,6 +58,7 @@ test "mixed shorthand objects in array lists", ->
eq arr[2].b, 1
eq arr[3], 'b'
test "array splats with nested arrays", ->
nonce = {}
a = [nonce]

View File

@ -184,6 +184,10 @@ test "#768: `in` should preserve evaluation order", ->
ok a() not in [b(),c()]
eq 3, share
test "#1099: empty array after `in` should compile to `false`", ->
eq 1, [5 in []].length
eq false, do -> return 0 in []
# Chained Comparison