AstNode

Base class for AST nodes that can have associated comments. Extends Node with support for leading and trailing comments.

Instance Members

leadingComments: Null<Array<Comment>>

Comments that appear before this node.


trailingComments: Null<Array<Comment>>

Comments that appear after this node.


type(): String
Returns
String

eachComment(handleComment: Function): Void
Name Type
handleComment Function

each(handleNode: Function): Void
Name Type
handleNode Function

toJson(): Dynamic

Converts the node and its comments to a JSON representation.

Returns Description
Dynamic Dynamic object containing node data and associated comments

new(id: NodeId, pos: Position, ?leadingComments: Array<Comment>, ?trailingComments: Array<Comment>): Void

Creates a new node that supports comments.

Name Type Default Description
id NodeId
pos Position Position in source where this node appears
leadingComments Array<Comment> (optional) Optional array of comments appearing before the node
trailingComments Array<Comment> (optional) Optional array of comments appearing after the node