Merge branch 'thejh-bugfix-1099' into stable
This commit is contained in:
commit
90495b614f
|
@ -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;
|
||||
|
|
|
@ -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})"
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue