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
CxGroup abstract
CxItem sealed
CxLibrary sealed
CxLiteral abstract
CxNamespace 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, CxNamespace and CxMethodGroup) produce parsable 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 IValidatable interface may be used.

PSI nodes are quasi immutable: once created, modifications may only be performed in specific ways, which are exposed as methods and/or properties in the API. A modification usually influences how references resolve to their target nodes. The respective modification method / property takes care of this, for example by clearing references where necessary.

Parent/child relations between PSI nodes are implemented with strong parent-to-child references and weak child-to-parent references. Therefore, the using code must retain a reference to the root PSI node, to make sure that all weak references remain valid.

Public / Methods

Accept


public abstract method Accept → (2)

visitor in : ICxNodeVisitor

[not-null]
The visitor object.

userData opt : object = null

Optional user data object.

Accepts the given visitor.

Attach​To


public method AttachTo → (1)

parent in : CxNode

[not-null]
The parent to attach to.

returns → CxNode

this

Attaches this node to the given parent in.

This node must not have a parent. Use this method to allow orphan nodes to resolve their reference using an existing PSI model.

Before returning true, this method calls IPsiNode.Resolve on this.

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​Namespace


public attribute EnclosingNamespace → (get)

value : CxNamespace

The enclosing PSI node, which may be this.

Returns the CxNamespace 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.