mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-18 11:31:20 -05:00
better printing for OpNodes with running with --nodes
This commit is contained in:
@@ -111,9 +111,10 @@ exports.BaseNode: class BaseNode
|
||||
|
||||
# `toString` representation of the node, for inspecting the parse tree.
|
||||
# This is what `coffee --nodes` prints out.
|
||||
toString: (idt) ->
|
||||
toString: (idt, override) ->
|
||||
idt: or ''
|
||||
'\n' + idt + @class + (child.toString(idt + TAB) for child in @collectChildren()).join('')
|
||||
children: (child.toString idt + TAB for child in @collectChildren()).join('')
|
||||
'\n' + idt + (override or @class) + children
|
||||
|
||||
eachChild: (func) ->
|
||||
return unless @children
|
||||
@@ -1014,6 +1015,9 @@ exports.OpNode: class OpNode extends BaseNode
|
||||
isChainable: ->
|
||||
indexOf(@CHAINABLE, @operator) >= 0
|
||||
|
||||
toString: (idt) ->
|
||||
super(idt, @class + ' ' + @operator)
|
||||
|
||||
compileNode: (o) ->
|
||||
o.operation: true
|
||||
return @compileChain(o) if @isChainable() and @first.unwrap() instanceof OpNode and @first.unwrap().isChainable()
|
||||
|
||||
Reference in New Issue
Block a user