Click or drag to resize

CodeObject Class

The common base class of all code objects.
Inheritance Hierarchy
SystemObject
  Nova.CodeDOMCodeObject
    More...

Namespace:  Nova.CodeDOM
Assembly:  Nova.CodeDOM (in Nova.CodeDOM.dll) Version: 7.44.8391.13415
Syntax
C#
public abstract class CodeObject : ICloneable, 
	IDisposable

The CodeObject type exposes the following members.

Constructors
  NameDescription
Protected methodCodeObject
Initializes a new instance of the CodeObject class
Protected methodCodeObject(CodeObject)
Create a code object from an existing one, copying members.
Protected methodCodeObject(Parser, CodeObject)
Parse a code object.
Top
Properties
  NameDescription
Public property_AsString
This property is just to make debugging easier.
Public propertyAnnotations
Annotations (comments, attributes, directives, messages) associated with the current code object.
Public propertyColumnNumber
The column number associated with the CodeObject (if any, 0 if none).
Public propertyComment
The comment for the code object (if any).
Public propertyDocComment
The documentation comment for the code object (if any).
Public propertyEOLComment
The End-Of-Line comment for the code object (if any).
Public propertyHasAnnotations
True if the code object has any annotations.
Public propertyHasAttributes
True if the code object has any attributes.
Public propertyHasComments
True if the code object has any comments of any kind.
Public propertyHasCompilerDirectives
True if the code object has any compiler directive annotations.
Public propertyHasDocComments
True if the code object has any documentation comments.
Public propertyHasEOLComments
True if the code object has any EOL comments.
Public propertyHasEOLOrPostAnnotations
True if the code object has any EOL or Postfix annotations.
Public propertyHasErrors
True if the code object has any error messages.
Public propertyHasFirstOnLineAnnotations
True if the code object has any annotations on separate lines.
Public propertyHasInfixComments
True if the code object has any Infix comments.
Public propertyHasMessages
True if the code object has any generated messages.
Public propertyHasNoIndentation
Determines if the code object has no indentation.
Public propertyHasNonEOLComments
True if the code object has any regular (non-doc) preceding (non-EOL, non-Infix, non-Postfix) comments.
Public propertyHasPostAnnotations
True if the code object has any postfix annotations.
Public propertyHasTerminator
Determines if the code object has a terminator character.
Public propertyHiddenRef
Any hidden reference to another CodeObject.
Public propertyInfixComment
The infix comment for the code object (if any).
Public propertyIsFirstOnLine
Determines if the code object appears as the first item on a line.
Public propertyIsFirstOnLineDefault
True if the code object defaults to starting on a new line.
Public propertyIsGenerated
Determines if the code object is generated.
Public propertyIsGroupingSet
Determines if the 'grouping' (has parens or braces) status has been set.
Public propertyIsNewLinesSet
Determines if the newline count has been set on the code object.
Public propertyIsRenderable
True if the CodeObject is renderable.
Public propertyIsSingleLine
Determines if the code object only requires a single line for display.
Public propertyIsSingleLineDefault
True if the code object only requires a single line for display by default.
Public propertyLineNumber
The line number associated with the CodeObject (if any, 0 if none).
Public propertyNewLines
The number of newlines preceding the object (0 to N).
Public propertyParent
The parent CodeObject.
Public propertyPostfixComment
The postfix comment for the code object (if any).
Top
Methods
  NameDescription
Public methodAccept
Accept the specified visitor object for the current code object and it's children.
Public methodAcceptAnnotations(IVisitor)
Accept the specified visitor object for all regular (non-EOL, non-Infix, non-Postfix) annotations (comments, attributes, compiler directives).
Public methodAcceptAnnotations(IVisitor, AnnotationFlags)
Accept the specified visitor object for all specified Infix or Postfix annotations (comments, compiler directives).
Public methodAcceptEOLComments
Accept the specified visitor object for all EOL comments.
Public methodAcceptInfixComments
Accept the specified visitor object for all Infix comments.
Public methodAcceptInfixEOLComments
Accept the specified visitor object for all Infix EOL comments.
Public methodStatic memberAdjustCommentIndentation
Adjust the content of the specified comment to compensate if it was outdented.
Public methodAssociateCommentWhenParsing
Determine if the specified comment should be associated with the current code object during parsing.
Public methodAsString
Render the entire code object as a string, using LFs for newlines.
Public methodAsText
Convert the code object to text with a trailing newline, and using CR/LF pairs for newlines (file format).
Public methodAsText(CodeWriter, CodeObjectRenderFlags)
Public methodAsText(CodeObjectRenderFlags, Boolean, StackCodeWriterAlignmentState)
Convert the code object to text using the specified flags and format (file or string).
Protected methodAsTextAfter
Public methodAsTextAnnotations(CodeWriter, CodeObjectRenderFlags)
Render all regular (non-EOL, non-Infix, non-Postfix, non-Message) annotations (comments, attributes, compiler directives).
Public methodAsTextAnnotations(CodeWriter, AnnotationFlags, CodeObjectRenderFlags)
Render all specified Infix or Postfix annotations (comments, compiler directives).
Protected methodAsTextBefore
Public methodAsTextEOLComments
Render all EOL comments.
Protected methodAsTextEvaluatedType
Public methodAsTextInfixComments
Render all Infix comments with the specified mask.
Public methodAsTextInfixEOLComments
Render all Infix EOL comments.
Public methodAsTextLeftMostAnnotations
Render all regular annotations on the current object, or the left most binary operator.
Public methodAsTextLength
Determine the length of the code object if converted to a string using the specified flags.
Public methodAttachAnnotation(Annotation, Boolean)
Attach an Annotation (Comment, DocComment, Attribute, CompilerDirective, or Message) to the CodeObject.
Public methodAttachAnnotation(Annotation, AnnotationFlags, Boolean)
Attach an Annotation to the CodeObject at the specified position.
Public methodAttachComment
Create a comment object and attach it to the code object.
Public methodAttachEOLComment
Create an EOL comment object and attach it to the code object.
Public methodAttachMessage
Create a message and attach it to the code object.
Public methodCalculateMetrics
Calculate metrics for this code object and its children.
Protected methodCheckForAlignment
Check for alignment of any EOL comments.
Public methodClone
Deep-clone the code object.
Protected methodCloneField(Object, Object)
Clone a field of a code object, including setting the parent.
Protected methodCloneFieldT(T, T)
Clone a field of a code object, including setting the parent.
Public methodCopyFormatting
Copy formatting from another code object.
Public methodCreateAnnotations
Create the list of child Annotations, or return the existing one.
Public methodCreateRef
Create a reference to the CodeObject.
Protected methodDefaultFormat
Default format the code object.
Protected methodDefaultFormatField
Default format the specified child field code object.
Public methodDefaultNewLines
Determine a default of 1 or 2 newlines when adding items to a Block.
Public methodDispose
Dispose the CodeObject.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodEvaluateTypeOrNamespace
Evaluate the type or namespace associated with the code object.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFindParentT
Find the parent object of the specified type.
Public methodFindParentMethod
Find the parent method (or anonymous method or lambda) of the current code object.
Public methodFindParentMethodOrType
Find the parent method (or anonymous method or lambda) or type of the current code object.
Public methodStatic memberForceReference
Call this method to force a reference to CodeObject, so that all static members are initialized, and settings are read from the config file. Call this before changing any static settings manually, or your changes will be overwritten when the config file is processed.
Public methodGetAllChildrenT
Get an enumerator for all children objects of type T in the CodeObject and in any child CodeObjects (recursively).
Public methodGetAttribute
Returns the first attribute expression (Call or ConstructorRef) with the specified name on the CodeObject.
Public methodGetComment
Get the comment that satisfies the specified predicate.
Public methodGetDescription
Get a short text description of the CodeObject. This is generally the shortest text representation that uniquely identifies objects, even if they have the same name, for example: type or return type, name, type parameters, parameters.
Public methodGetDocSummary
Returns the DocSummary documentation comment, or null if none exists.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetIndentLevel
Get the indent level of this object.
Public methodGetIndentSpaceCount
Get the current indent in spaces.
Public methodGetInferredType
Determine the type of an inferred ('var') type.
Public methodGetNamespace
Get the Namespace for this CodeObject.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodGetTypeRef
Get a TypeRef for the type with the specified full name, with caching (generally used for System types).
Public methodGetWorstMessageType
Get the type of the worst attached message.
Protected methodHasAnnotationT
Public methodHasAttribute
Returns true if the attribute with the specified name exists on the object, otherwise false.
Public methodHasUnresolvedRef
Returns true if the code object is an UnresolvedRef or has any UnresolvedRef children.
Protected methodIsChildIndented
Returns true if the specified child object is indented from the parent.
Protected methodIsChildPrefix
Returns true if the specified child object is prefixed to the current object.
Public methodStatic memberLoadSettings
Load settings for Nova.CodeDOM.dll types from the app config file.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodMoveAllComments
Move all (regular or EOL) comments from the specified token to the current code object, converting any EOL comments to regular comments (which will be rendered inline if necessary).
Public methodMoveAnnotations
Move any annotations from the specified location to the specified destination location.
Public methodMoveComments(Token)
Move any non-EOL comments from the specified token to the current code object.
Public methodMoveComments(Token, Boolean)
Move any non-EOL comments from the specified token to the current code object.
Public methodMoveCommentsAsPost
Move any non-EOL comments from the specified token to the current code object as Post comments.
Public methodMoveEOLAndPostAnnotations
Move any EOL or Postfix annotations from the specified code object to the current code object.
Public methodMoveEOLComment(CodeObject)
Move any EOL comment from the specified code object to the current code object.
Public methodMoveEOLComment(Token)
Move any EOL comment from the specified token to the current code object.
Public methodMoveEOLComment(Token, Boolean, Boolean)
Move any EOL comment from the specified token to the current code object.
Public methodMoveEOLCommentAsInfix
Move any EOL comment from the specified token to the current code object as an Infix EOL comment.
Public methodMoveFormatting(CodeObject)
Move formatting from the specified code object to the current object.
Public methodMoveFormatting(Token)
Move formatting from the specified token to the current object.
Public methodMovePrefixAnnotationsAs
Move any prefix annotations on the specified code object to the current code object as the specified type of annotation.
Protected methodNotifyListedAnnotationAdded
Propagate the listed annotation to the parent CodeUnit and above.
Protected methodNotifyListedAnnotationRemoved
Remove the listed annotation from the parent CodeUnit and above.
Protected methodParseAnnotations(Parser, CodeObject)
Parse annotations - specifically, compiler directives around things such as TypeParameters or ParameterDecls.
Protected methodParseAnnotations(Parser, CodeObject, Boolean, Boolean)
Parse any comments, attributes, compiler directives.
Protected methodParseExpectedToken
Parse the specified expected token, attaching a parse error to the current object if it doesn't exist.
Protected methodParseUnusedAnnotations
Parse annotations from the Unused list.
Public methodRemoveAllAnnotationsT
Remove all annotations of the specified type from this object.
Public methodRemoveAllAnnotationsWhereT
Remove all annotations from this object where the specified predicate is true.
Public methodRemoveAllMessages
Remove all messages from this object, or optionally only from the specified source.
Public methodRemoveAttribute
Remove the attribute expression with the specified name.
Public methodResolve(ResolveFlags)
Resolve all child symbolic references.
Public methodResolve(ResolveCategory, ResolveFlags)
Resolve all child symbolic references, using the specified ResolveCategory and ResolveFlags.
Public methodResolveAttributes
Resolve any attached attributes.
Public methodResolveDocComments
Resolve any references in attached documentation comments.
Public methodResolveGotoTargetUp
Resolve child code objects that match the specified name are valid goto targets, moving up the tree until a complete match is found.
Public methodResolveRefUp
Resolve child code objects that match the specified name, moving up the tree until a complete match is found.
Public methodResolveRefUpSkipMethodBody
Similar to ResolveRefUp(String, Resolver), but skips trying to resolve the symbol in the body or parameters of a method (used for resolving parameter types).
Protected methodSetField(Object, Object, Boolean)
Set a field of a code object, including setting the parent, and optional formatting.
Protected methodSetFieldT(ChildListT, ChildListT)
Set a ChildList collection field of a code object, including setting the parent.
Protected methodSetFieldT(T, T, Boolean)
Set a field of a code object, including setting the parent, and optional formatting.
Public methodStatic memberSetFirstOnLineForNonEOLComments
Set the newline flag for all non-EOL comments in the collection.
Protected methodSetFormatFlag
Protected methodSetLineCol(CodeObject)
Set the line and column numbers to those in the specified CodeObject.
Protected methodSetLineCol(Token)
Set the line and column numbers to those in the specified token.
Public methodSetNewLines
Special method to set the newline count without setting the NewLinesSet flag.
Protected methodSetStartLineCol
Set the starting line and column numbers to those in the specified token (used by some code objects with prefixes such as modifiers).
Public methodToString
Render the type of the code object and its description as a string.
(Overrides ObjectToString.)
Public methodUpdateAllDeclExpressions
Recursively update the dictionary of names in the specified Block by either adding or removing (as specified by the 2nd parameter) all appropriate nested INamedCodeObjects expressions in the current CodeObject tree (specifically implemented for LocalDeclExpr expression objects).
Protected methodUpdateLineCol
Update the line and column numbers according to the current positions in the CodeWriter, if the UpdateLineCol flag is set.
Top
Fields
  NameDescription
Protected field_annotations
Any Annotations (Comments, DocComments, Attributes, or Messages) associated with the CodeObject (null if none).
Protected field_columnNumber
The starting column number associated with the CodeObject if parsed from or written to text form.
Protected field_formatFlags
Formatting flags - for line feeds, braces, etc.
Protected field_lineNumber
The starting line number associated with the CodeObject if parsed from or written to text form.
Protected field_parent
The parent CodeObject.
Public fieldStatic memberAutoDetectTabs
Automatically detect and preserve tabs used for code indentation.
Public fieldStatic memberAutomaticCodeCleanup
Determines whether or not code cleanup is automatically performed during the parsing and/or resolving process.
Public fieldStatic memberAutomaticFormattingCleanup
Determines whether or not formatting cleanup is automatically performed during the parsing process.
Public fieldStatic memberMaximumLineLength
The maximum line length used for automatic formatting, such as code alignment and line wrapping.
Public fieldStatic memberTabSize
The tab size used for indentation of code.
Public fieldStatic memberUseTabs
Use tabs instead of spaces for indentation (ignored if AutoDetectTabs is true).
Top
See Also
Inheritance Hierarchy
SystemObject
  Nova.CodeDOMCodeObject
    Nova.CodeDOMAnnotation
    Nova.CodeDOMBlock
    Nova.CodeDOMConstraintClause
    Nova.CodeDOMExpression
    Nova.CodeDOMNamespace
    Nova.CodeDOMProject
    Nova.CodeDOMProjectConfiguration
    Nova.CodeDOMProjectFileItem
    Nova.CodeDOMQueryClauseBase
    Nova.CodeDOMReference
    Nova.CodeDOMSolution
    Nova.CodeDOMSolutionProjectEntry
    Nova.CodeDOMStatement
    Nova.CodeDOMTypeParameter
    Nova.CodeDOMTypeParameterConstraint