CxNode

Description

abstract class Tinman.Core.Cx.CxNode

Derived from

PsiNode abstract
ICodeOutput
ICopyable<CxNode>

Extended by

CxArgument sealed
CxAttribute sealed
CxCase sealed
CxCodeUnit sealed
CxComponent abstract
CxContract abstract
CxContractExpression abstract
CxExpression abstract
CxItem sealed
CxLibrary sealed
CxLiteral abstract
CxMethodGroup sealed
CxParameter sealed
CxRegion sealed
CxStatement abstract
CxType abstract
CxTypeParameter sealed
CxVariable sealed
CxXmlDoc sealed
CxXmlDocBody sealed
CxXmlDocException sealed
CxXmlDocItem abstract
CxXmlDocParagraph sealed
CxXmlDocParameter sealed
CxXmlDocReference sealed
CxXmlDocSeeAlso sealed
CxXmlDocTypeParameter sealed
CxXmlDocValue sealed

Abstract base class for Code-X PSI nodes.

Code-X PSI nodes (except CxLibrary and CxMethodGroup) produce parseable source code, either via object.ToString or by using the ICodeOutput interface. Since Code-X is a subset of standard C#, the source code may also be used with C# development tools.

Often, a PSI node references another PSI node (for example, a type name that references a type declaration). These references must be resolved by using IPsiNode.Resolve. To check for unresolved references (and other problems), the IValidatableinterface may be used.

PSI nodes are effectively immutable: once created, they cannot be modified any more, with one exception: a node may contain a list of child nodes. In this case, a node may allow to append new child nodes after its creation, as long as the behaviour of both approaches (i.e. passing all child nodes at creation time vs. appending child nodes after creation) is equivalent. For example, by adding new CxCodeUnit objects to a CxLibrary object, already resolved references (e.g. a type name) will still resolve to the same PSI node (e.g. a type declaration), whereas unresolved references might now become resolvable.

Public / Methods

Accept


public abstract method Accept → (2)

visitor in : ICxNodeVisitor

[not-null]
The visitor object.

userData in : object

Optional user data object.

Accepts the given visitor.

Public / Attributes

Can​Have​Parent


[Constant]
public virtual attribute CanHaveParent → (get)

value : bool

true if Parent may return a non-null value,
false if Parent will always return null.

Checks if this PSI node can have a parent.

If the behaviour of a PSI node is independent of the parent node that contains it, this property returns false. In this case, the same PSI node object may be used as a child in multiple parent PSI node objects.

The default implementation returns true.

Enclosing​Code​Unit


public attribute EnclosingCodeUnit → (get)

value : CxCodeUnit

The enclosing PSI node, which may be this.

Returns the CxCodeUnit that contains this PSI node.

Enclosing​Declaration


public attribute EnclosingDeclaration → (get)

value : CxDeclaration

The enclosing PSI node, which may be this.

Returns the CxDeclaration that contains this PSI node.

Enclosing​Library


public attribute EnclosingLibrary → (get)

value : CxLibrary

The enclosing PSI node, which may be this.

Returns the CxLibrary that contains this PSI node.

Enclosing​Member


public attribute EnclosingMember → (get)

value : CxMember

The enclosing PSI node, which may be this.

Returns the CxMember that contains this PSI node.

Enclosing​Statement


public attribute EnclosingStatement → (get)

value : CxStatement

The enclosing PSI node, which may be this.

Returns the CxStatement that contains this PSI node.

Parent


public attribute Parent → (get)

value : CxNode

The parent node or null if this CxNode does not have a parent.

Returns the parent CxNode object.

After creating a CxNode object, its parent will always be null. When a CxNode object is aggregated by creating a parent CxNode object, its parent reference will be set accordingly. If a child object has already been attached to another parent, an independent copy will be created with ICopyable.Copy and that copy will then be aggregated. This way, the principle of immutability for PSI nodes is retained.

Protected / Constants

Context​Inner


protected constant ContextInner → ("xmldoc-para-inline":string)

Context value name for the boolean flag that depicts whether to output only the inner content of a CxXmlDocParagraph, omitting the enclosing <para/> tag.

See also

Context

Context​Whitespace


protected constant ContextWhitespace → ("xmldoc-item-whitespace":string)

Context object name for the Whitespace object that is used to output whitespaces in CxXmlDocBody content.

See also

Context

Protected / Methods

Context​Whitespace​Get


protected static method ContextWhitespaceGet → (1)

context in : Context

[not-null]
The context object.

returns → Whitespace

The Whitespace object.

Returns the Whitespace object in the given context in.