allowing parenthetical nodes to wrap statements without necessarily expression-izing them -- tests are passing ... we'll see how this works in practice.

This commit is contained in:
Jeremy Ashkenas
2010-02-17 19:19:51 -05:00
parent e2a71d3c2c
commit 2b5d596e10
4 changed files with 36 additions and 26 deletions

View File

@@ -859,12 +859,16 @@ ExistenceNode.compile_test: (o, variable) ->
ParentheticalNode: exports.ParentheticalNode: inherit Node, {
type: 'Paren'
constructor: (expressions) ->
@children: [@expressions: expressions]
constructor: (expression) ->
@children: [@expression: expression]
this
is_statement: ->
@expression.is_statement()
compile_node: (o) ->
code: @expressions.compile(o)
code: @expression.compile(o)
return code if @is_statement()
l: code.length
code: code.substr(o, l-1) if code.substr(l-1, 1) is ';'
'(' + code + ')'