Skip to content

Commit

Permalink
cleaned up and optimized fix for #1354 (d91ccd4)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra committed May 16, 2011
1 parent 004f13f commit 2ac7435
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
17 changes: 8 additions & 9 deletions lib/nodes.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions src/nodes.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -1349,12 +1349,13 @@ exports.In = class In extends Base
invert: NEGATE

compileNode: (o) ->
isArray = @array instanceof Value and @array.isArray()
splat = obj for obj in @array.base.objects when obj instanceof Splat if isArray
if isArray and not splat
@compileOrTest o
else
@compileLoopTest o
if @array instanceof Value and @array.isArray()
for obj in @array.base.objects when obj instanceof Splat
hasSplat = yes
break
# `compileOrTest` only if we have an array literal with no splats
return @compileOrTest o unless hasSplat
@compileLoopTest o

compileOrTest: (o) ->
[sub, ref] = @object.cache o, LEVEL_OP
Expand Down

0 comments on commit 2ac7435

Please sign in to comment.