File tree Expand file tree Collapse file tree 2 files changed +16
-19
lines changed Expand file tree Collapse file tree 2 files changed +16
-19
lines changed Original file line number Diff line number Diff line change @@ -281,9 +281,15 @@ exports.Base = class Base
281
281
# **WARNING: DO NOT OVERRIDE THIS METHOD IN CHILD CLASSES.**
282
282
# Only override the component `ast*` methods as needed.
283
283
ast : (o , level ) ->
284
+ # Merge `level` into `o` and perform other universal checks.
284
285
o = @ astInitialize o, level
286
+ # Create serializable representation of this node.
285
287
astNode = @ astNode o
286
- @ astAddReturns astNode
288
+ # Mark AST nodes that correspond to expressions that (implicitly) return.
289
+ # We can’t do this as part of `astNode` because we need to assemble child
290
+ # nodes first before marking the parent being returned.
291
+ astNode .returns = yes if @astNode ? and @canBeReturned
292
+ astNode
287
293
288
294
astInitialize : (o , level ) ->
289
295
o = Object .assign {}, o
@@ -318,12 +324,6 @@ exports.Base = class Base
318
324
astLocationData : ->
319
325
jisonLocationDataToAstLocationData @locationData
320
326
321
- # Mark AST nodes that correspond to expressions that (implicitly) return.
322
- astAddReturns : (ast ) ->
323
- return ast unless ast?
324
- ast .returns = yes if @canBeReturned
325
- ast
326
-
327
327
# Determines whether an AST node needs an `ExpressionStatement` wrapper.
328
328
# Typically matches our `isStatement()` logic but this allows overriding.
329
329
isStatementAst : (o ) ->
You can’t perform that action at this time.
0 commit comments