mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-05-03 03:00:14 -04:00
Merge pull request #3322 from xixixao/issue1099
Fix #1099, remove in empty array optimization
This commit is contained in:
@@ -1719,7 +1719,7 @@ exports.In = class In extends Base
|
||||
invert: NEGATE
|
||||
|
||||
compileNode: (o) ->
|
||||
if @array instanceof Value and @array.isArray()
|
||||
if @array instanceof Value and @array.isArray() and @array.base.objects.length
|
||||
for obj in @array.base.objects when obj instanceof Splat
|
||||
hasSplat = yes
|
||||
break
|
||||
@@ -1728,7 +1728,6 @@ exports.In = class In extends Base
|
||||
@compileLoopTest o
|
||||
|
||||
compileOrTest: (o) ->
|
||||
return [@makeCode("#{!!@negated}")] if @array.base.objects.length is 0
|
||||
[sub, ref] = @object.cache o, LEVEL_OP
|
||||
[cmp, cnj] = if @negated then [' !== ', ' && '] else [' === ', ' || ']
|
||||
tests = []
|
||||
|
||||
Reference in New Issue
Block a user