Represents an abstract AST (abstract syntax tree) node implementation that is intended to be used as a base class for type-specific AST nodes.
- Inheritance:
- object object
- Derived:
-
Accessor
Body AccessorDeclaration Argument ArrayReallocate Attribute AttributeClause Argument AttributeSection CatchClause ClassBody CollectionElement CompilationUnit CompilationUnit ConstructorOption Body Designation DocumentationComment ElseIf EnumerationSection Body EventBody Expression ExternalAlias ExternalDirective Alias FixedDirective Section Size InterfaceBuffer Declarator Body LocalFunction MethodStatement Body Body NamespaceBody NamespaceDeclaration OperatorBody Ordering ParameterDeclaration Pattern PreprocessorDirective PropertyBody QualifiedName QueryOperator RangeVariable RangeDeclaration Variable ReturnDeclarator Type Statement StructureDeclaration Body SubPattern SwitchExpression SwitchArm Label SwitchSection TupleLiteral TypeDeclarator Declaration TypeMember TypeDeclaration Parameter UsingDirective UsingDirective VariableSection Declarator ArrayInitializer ArrayExpression Pattern AssignmentExpression AssignmentPattern AssignmentProperty AwaitExpression BinaryOperator BlockExpression Statement BreakStatement CallExpression CatchClause ClassBody ClassDeclaration ClassExpression CompilationUnit ConditionalExpression ContinueStatement DebuggerStatement DoStatement ExpressionStatement ForIn ForStatement Statement FunctionBody FunctionDeclaration FunctionExpression Identifier IfStatement ImportExpression InstanceExpression LabeledStatement LiteralExpression MemberAccess MethodDefinition ModuleDeclaration ModuleSpecifier ObjectCreation ObjectExpression Initializer ObjectExpression Pattern ParenthesizedExpression Property RestElement ReturnStatement SequenceExpression SuperExpression SwitchSection SwitchStatement TaggedTemplate ThrowExpression Statement TryStatement UnaryOperator VariableExpression Declaration VariableDeclarator WhileStatement WithStatement YieldExpression Argument CompilationUnit ComprehensionClause Decorator Expression IfBase Statement Parameter SliceCondition Item Statement TryStatement CDataExcept Clause Section Comment CompilationUnit Declaration Element ElementAttribute ElementContent EndTag ProcessingInstruction
- Implements:
-
IAst
Node
Constructors
AstNodeBase()
Initializes an instance of the class.
Properties
Children
Gets the list containing the child AST nodes of this AST node.
EndOffset
Gets or sets the end offset of this AST node, if known.
Property Value
- int?:
The end offset of this AST node, if known.
HasChildren
Gets whether the AST node contains any child AST nodes.
Property Value
- bool:
true
if the AST node contains any child AST nodes; otherwise,false
.
Id
Gets an integer value that identifies the type of AST node, if known.
Property Value
- int:
An integer value that identifies the type of AST node, if known.
Remarks
This class' default implementation always returns 0
.
Length
Gets the character length of this AST node, if known.
Property Value
- int:
The character length of this AST node, if known.
Parent
Gets or sets the parent IAst
Root
Gets the root IAst
StartOffset
Gets or sets the start offset of this AST node, if known.
Property Value
- int?:
The start offset of this AST node, if known.
Value
Gets or sets the string-based value for the AST node.
Property Value
- string:
The string-based value for the AST node.
Methods
Contains(int)
Returns whether the AST node contains the specified offset.
Parameter | Type | Description |
---|---|---|
offset | int | The offset to examine. |
Returns
- bool:
true
if the AST node contains the specified offset; otherwise,false
.
Remarks
This method returns false
if the offset falls on the Endfalse
if the AST node doesn't have known offsets.
FindChildNode(int)
Searches through the child nodes for a node that contains the specified offset.
Parameter | Type | Description |
---|---|---|
offset | int | The offset to check. |
Returns
FindDescendantNode(int)
Recursively searches through the descendant nodes for a node that contains the specified offset.
Parameter | Type | Description |
---|---|---|
offset | int | The offset to check. |
Returns
GetChildrenEnumerator()
Retrieves an IEnumerator
object that can iterate the child IAst
Returns
- IEnumerator<IAst
Node >: An
IEnumerator
object that can iterate the child IAstNode objects in this node.
ToString()
Returns a String
that represents the current Object
.
Returns
- string:
A
String
that represents the currentObject
.
ToTreeString(int)
Outputs the contents of the AST node in tree form.
Parameter | Type | Description |
---|---|---|
indentLevel | int | The indentation level. |
Returns
- string:
A string containing the tree form of the AST node.