Permalink
Browse files

uggggggggggggggggggggggggggggggggggg

  • Loading branch information...
1 parent a588590 commit b8f74f8a913a77f97b5d2da0eea08b9b1455bdbd @maxtaco committed with Jan 4, 2012
Showing with 34 additions and 29 deletions.
  1. +9 −3 lib/coffee-script/nodes.js
  2. +10 −16 lib/coffee-script/tamelib.js
  3. +8 −3 src/nodes.coffee
  4. +7 −7 test/tame.coffee
View
Oops, something went wrong.
Oops, something went wrong.
View
@@ -326,6 +326,11 @@ exports.Base = class Base
obj.tamePrequels.push { block : bb, retval : rv }
rv
+ tameUnwrap: (e) ->
+ e.tameContinuationBlock = @tameContinuationBlock
+ e.tamePrequels = @tamePrequels
+ e
+
isStatement : NO
jumps : NO
isComplex : YES
@@ -368,7 +373,7 @@ exports.Block = class Block extends Base
# If this Block consists of just a single node, unwrap it by pulling
# it back out.
unwrap: ->
- if @expressions.length is 1 then @expressions[0] else this
+ if @expressions.length is 1 then @tameUnwrap @expressions[0] else this
# Like unwrap, but will return if not a single
getSingle : ->
@@ -753,7 +758,7 @@ exports.Value = class Value extends Base
# The value can be unwrapped as its inner node, if there are no attached
# properties.
unwrap: ->
- if @properties.length then this else @base
+ if @properties.length then this else @tameUnwrap @base
# If this value is being used as a slot for the purposes of a defer
# then export it here
@@ -2425,7 +2430,7 @@ exports.Parens = class Parens extends Base
children: ['body']
- unwrap : -> @body
+ unwrap : -> @tameUnwrap @body
isComplex : -> @body.isComplex()
#tameWrapContinuation : YES
View
@@ -459,10 +459,10 @@ atest 'expressions + loops', (cb) ->
ok = false unless v == 9
cb(ok, {})
-#atest 'expressions + loops', (cb) ->
-# eat = (item, cb) ->
-# await delay defer()
-# cb item.length
-# lunch = ((await eat food, defer _) for food in ['toast', 'wine', 'pea'])
-# ok = (lunch[0] is 5 and lunch[1] is 4 and lunch[2] is 3)
-# cb(ok, {})
+atest 'expressions + loops', (cb) ->
+ eat = (item, cb) ->
+ await delay defer()
+ cb item.length
+ lunch = ((await eat food, defer _) for food in ['toast', 'wine', 'pea'])
+ ok = (lunch[0] is 5 and lunch[1] is 4 and lunch[2] is 3)
+ cb(ok, {})

0 comments on commit b8f74f8

Please sign in to comment.