Click or drag to resize

CodeUnit Class

Declares a unit of independent code that belongs to the root-level namespace (also known as a "compilation unit"). Usually is the contents of a source file, but it can optionally be in-memory only. A CodeUnit is essentially a NamespaceDecl of the global namespace.
Inheritance Hierarchy

Namespace:  Nova.CodeDOM
Assembly:  Nova.CodeDOM (in Nova.CodeDOM.dll) Version: 7.22.6858.39923
Syntax
C#
public class CodeUnit : NamespaceDecl, INamedCodeObject, 
	IFile, IComparable

The CodeUnit type exposes the following members.

Constructors
  NameDescription
Public methodCodeUnit(String, Project, String)
Create a new CodeUnit with the specified file name and parent Project.
Public methodCodeUnit(String, String, Project, String)
Create a new CodeUnit with the specified file name (or text source) and parent Project.
Top
Properties
  NameDescription
Public property_AsString
This property is just to make debugging easier.
(Inherited from CodeObject.)
Public propertyAnnotations
Annotations (comments, attributes, directives, messages) associated with the current code object.
(Inherited from CodeObject.)
Public propertyBody
The Block body.
(Inherited from BlockStatement.)
Public propertyCategory
The descriptive category of the code object.
Public propertyCode
The associated text source code if no file is being used.
Public propertyColumnNumber
The column number of a CodeUnit is normally 0, but may be set to a non-zero value to indicate the base offset of a code fragment being parsed within a larger code fragment or file. If the column is set to a non-zero value, NewLines will be automatically set to 0, and the first parsed token will have IsNewLine set to false.
(Overrides CodeObjectColumnNumber.)
Public propertyComment
The comment for the code object (if any).
(Inherited from CodeObject.)
Public propertyDocComment
The documentation comment for the code object (if any).
(Inherited from CodeObject.)
Public propertyEOLComment
The End-Of-Line comment for the code object (if any).
(Inherited from CodeObject.)
Public propertyExpression
The namespace Expression.
(Inherited from NamespaceDecl.)
Public propertyFileEncoding
The encoding of the file (normally UTF8).
Public propertyFileExists
True if the associated file exists.
Public propertyFileHasUTF8BOM
True if the file has a UTF8 byte-order-mark.
Public propertyFileName
The associated file name of the CodeUnit.
Public propertyFileUsingTabs
True if the associated file is formatted using tabs, otherwise false (using spaces).
Public propertyGlobalAlias
The implied global extern alias to the global RootNamespace.
Public propertyHasAnnotations
True if the code object has any annotations.
(Inherited from CodeObject.)
Public propertyHasArgument
True if the Statement has an argument.
(Overrides NamespaceDeclHasArgument.)
Public propertyHasArgumentParens
True if the Statement has parens around its argument.
(Inherited from NamespaceDecl.)
Public propertyHasAttributes
True if the code object has any attributes.
(Inherited from CodeObject.)
Public propertyHasBraces
True if the BlockStatement has braces.
(Inherited from BlockStatement.)
Public propertyHasBracesAlways
True if the BlockStatement always requires braces.
(Overrides BlockStatementHasBracesAlways.)
Public propertyHasComments
True if the code object has any comments of any kind.
(Inherited from CodeObject.)
Public propertyHasCompilerDirectives
True if the code object has any compiler directive annotations.
(Inherited from CodeObject.)
Public propertyHasDocComments
True if the code object has any documentation comments.
(Inherited from CodeObject.)
Public propertyHasEOLComments
True if the code object has any EOL comments.
(Inherited from CodeObject.)
Public propertyHasEOLOrPostAnnotations
True if the code object has any EOL or Postfix annotations.
(Inherited from CodeObject.)
Public propertyHasErrors
True if the code object has any error messages.
(Inherited from CodeObject.)
Public propertyHasFirstOnLineAnnotations
True if the code object has any annotations on separate lines.
(Inherited from CodeObject.)
Public propertyHasHeader
True for all BlockStatements that have a header (all except CodeUnit and BlockDecl).
(Overrides BlockStatementHasHeader.)
Public propertyHasInfixComments
True if the code object has any Infix comments.
(Inherited from CodeObject.)
Public propertyHasMessages
True if the code object has any generated messages.
(Inherited from CodeObject.)
Public propertyHasNoIndentation
Determines if the code object has no indentation.
(Inherited from CodeObject.)
Public propertyHasNonEOLComments
True if the code object has any regular (non-doc) preceeding (non-EOL, non-Infix, non-Postfix) comments.
(Inherited from CodeObject.)
Public propertyHasPostAnnotations
True if the code object has any postfix annotations.
(Inherited from CodeObject.)
Public propertyHasTerminator
Determines if the code object has a terminator character.
(Inherited from CodeObject.)
Public propertyHasTerminatorDefault
True if the Statement has a terminator character by default.
(Overrides BlockStatementHasTerminatorDefault.)
Public propertyHiddenRef
Any hidden reference to another CodeObject.
(Inherited from CodeObject.)
Public propertyInfixComment
The infix comment for the code object (if any).
(Inherited from CodeObject.)
Public propertyIsCompactIfEmptyDefault
True if the BlockStatement has compact empty braces by default.
(Inherited from BlockStatement.)
Public propertyIsCSharp
True if the CodeUnit contains C# code.
Public propertyIsEndFirstOnLine
True if the closing paren or bracket is on a new line.
(Inherited from Statement.)
Public propertyIsFile
True if the CodeUnit is associated with a file (as opposed to being only in memory).
Public propertyIsFirstOnLine
Determines if the code object appears as the first item on a line.
(Inherited from CodeObject.)
Public propertyIsFirstOnLineDefault
True if the code object defaults to starting on a new line.
(Inherited from CodeObject.)
Public propertyIsGenerated
Determines if the code object is generated.
(Inherited from CodeObject.)
Public propertyIsGroupingSet
Determines if the 'grouping' (has parens or braces) status has been set.
(Inherited from CodeObject.)
Public propertyIsMethodBodyLevel
True if a BlockStatement is at a method body level (contains general code statements). For example, anything at a MethodDeclBase level or lower in the code tree. Specifically, NOT a NamespaceDecl, TypeDecl, or PropertyDeclBase.
(Inherited from NamespaceDecl.)
Public propertyIsMultiPart
True for multi-part statements, such as try/catch/finally or if/else.
(Inherited from BlockStatement.)
Public propertyIsNew
True if the CodeUnit is newly created and hasn't been saved yet.
Public propertyIsNewLinesSet
Determines if the newline count has been set on the code object.
(Inherited from CodeObject.)
Public propertyIsRenderable
True if the CodeObject is renderable.
(Overrides CodeObjectIsRenderable.)
Public propertyIsSingleLine
Determines if the code object only requires a single line for display.
(Inherited from NamespaceDecl.)
Public propertyIsSingleLineDefault
True if the code object only requires a single line for display by default.
(Inherited from BlockStatement.)
Public propertyIsTopLevel
True if a BlockStatement is at the top level (those that have no header and no indent). For example, a CodeUnit, a BlockDecl with no parent or a DocComment or Project parent.
(Overrides BlockStatementIsTopLevel.)
Public propertyIsWorkflowCodeBesideFile
True if this is a workflow code-beside file.
Public propertyKeyword
The keyword associated with the Statement.
(Inherited from NamespaceDecl.)
Public propertyLineNumber
The line number of a CodeUnit is normally 0, but may be set to a non-zero value to indicate the base offset of a code fragment being parsed within a larger code fragment or file.
(Overrides CodeObjectLineNumber.)
Public propertyListedAnnotations
All 'listed' code annotations (Messages and special Comments) for this CodeUnit.
Public propertyName
The name of the CodeUnit. If associated with a file, this is the file name and extension.
Public propertyNamespace
The associated Namespace.
(Inherited from NamespaceDecl.)
Public propertyNewLines
The number of newlines preceeding the object (0 to N).
(Inherited from Statement.)
Public propertyParent
The parent CodeObject.
(Inherited from NamespaceDecl.)
Public propertyPostfixComment
The postfix comment for the code object (if any).
(Inherited from CodeObject.)
Public propertyProject
The parent Project.
Public propertyRequiresEmptyStatement
True if the BlockStatement requires an empty statement if it has an empty block with no braces.
(Overrides BlockStatementRequiresEmptyStatement.)
Public propertySLOC
"Source Lines Of Code" in the source (when first parsed).
Public propertyTerminator
The terminator character for the Statement.
(Inherited from Statement.)
Public propertyTotalLines
Total number of text lines in the source (when first parsed).
Top
Methods
  NameDescription
Public methodAccept
Accept the specified visitor object for the current code object and it's children.
(Overrides NamespaceDeclAccept(IVisitor).)
Public methodAcceptAnnotations(IVisitor)
Accept the specified visitor object for all regular (non-EOL, non-Infix, non-Postfix) annotations (comments, attributes, compiler directives).
(Inherited from CodeObject.)
Public methodAcceptAnnotations(IVisitor, AnnotationFlags)
Accept the specified visitor object for all specified Infix or Postfix annotations (comments, compiler directives).
(Inherited from CodeObject.)
Public methodAcceptEOLComments
Accept the specified visitor object for all EOL comments.
(Inherited from CodeObject.)
Public methodAcceptInfixComments
Accept the specified visitor object for all Infix comments.
(Inherited from CodeObject.)
Public methodAcceptInfixEOLComments
Accept the specified visitor object for all Infix EOL comments.
(Inherited from CodeObject.)
Public methodAdd(CodeObject)
Add multiple CodeObjects to the BlockStatement body.
(Inherited from BlockStatement.)
Public methodAdd(CodeObject)
Add a CodeObject to the NamespaceDecl body.
(Inherited from NamespaceDecl.)
Public methodAddRange
Add a collection of CodeObjects to the BlockStatement body.
(Inherited from BlockStatement.)
Public methodAddToDictionary
Add the CodeObject to the specified dictionary.
Public methodAssociateCommentWhenParsing
Determine if the specified comment should be associated with the current code object during parsing.
(Inherited from Statement.)
Public methodAsString
Render the entire code object as a string, using LFs for newlines.
(Inherited from CodeObject.)
Public methodAsText
Convert the code object to text with a trailing newline, and using CR/LF pairs for newlines (file format).
(Inherited from CodeObject.)
Public methodAsText(CodeWriter, CodeObjectRenderFlags) (Overrides StatementAsText(CodeWriter, CodeObjectRenderFlags).)
Public methodAsText(CodeObjectRenderFlags, Boolean, StackCodeWriterAlignmentState)
Convert the code object to text using the specified flags and format (file or string).
(Inherited from CodeObject.)
Protected methodAsTextAfter (Overrides BlockStatementAsTextAfter(CodeWriter, CodeObjectRenderFlags).)
Public methodAsTextAnnotations(CodeWriter, CodeObjectRenderFlags)
Render all regular (non-EOL, non-Infix, non-Postfix, non-Message) annotations (comments, attributes, compiler directives).
(Inherited from CodeObject.)
Public methodAsTextAnnotations(CodeWriter, AnnotationFlags, CodeObjectRenderFlags)
Render all specified Infix or Postfix annotations (comments, compiler directives).
(Inherited from CodeObject.)
Protected methodAsTextArgument (Inherited from NamespaceDecl.)
Protected methodAsTextArgumentPrefix (Inherited from Statement.)
Protected methodAsTextBefore (Inherited from CodeObject.)
Public methodAsTextEOLComments
Render all EOL comments.
(Inherited from CodeObject.)
Protected methodAsTextEvaluatedType (Inherited from CodeObject.)
Public methodAsTextInfixComments
Render all Infix comments with the specified mask.
(Inherited from CodeObject.)
Public methodAsTextInfixEOLComments
Render all Infix EOL comments.
(Inherited from CodeObject.)
Public methodAsTextLeftMostAnnotations
Render all regular annotations on the current object, or the left most binary operator.
(Inherited from CodeObject.)
Public methodAsTextLength
Determine the length of the code object if converted to a string using the specified flags.
(Inherited from CodeObject.)
Protected methodAsTextPrefix (Inherited from Statement.)
Protected methodAsTextStatement (Overrides StatementAsTextStatement(CodeWriter, CodeObjectRenderFlags).)
Protected methodAsTextSuffix (Inherited from Statement.)
Protected methodAsTextTerminator (Inherited from Statement.)
Public methodAttachAnnotation(Annotation, Boolean) (Inherited from CodeObject.)
Public methodAttachAnnotation(Annotation, AnnotationFlags, Boolean)
Attach an Annotation to the CodeObject at the specified position.
(Inherited from CodeObject.)
Public methodAttachComment
Create a comment object and attach it to the code object.
(Inherited from CodeObject.)
Public methodAttachEOLComment
Create an EOL comment object and attach it to the code object.
(Inherited from CodeObject.)
Public methodAttachMessage
Create a message and attach it to the code object.
(Inherited from CodeObject.)
Public methodCalculateMetrics
Calculate metrics for this code object and its children.
(Inherited from CodeObject.)
Protected methodCheckForAlignment
Check for alignment of any EOL comments.
(Inherited from CodeObject.)
Public methodClone
Deep-clone the code object.
(Inherited from NamespaceDecl.)
Protected methodCloneField(Object, Object)
Clone a field of a code object, including setting the parent.
(Inherited from CodeObject.)
Protected methodCloneFieldT(T, T)
Clone a field of a code object, including setting the parent.
(Inherited from CodeObject.)
Public methodCompareTo
Compare one CodeUnit to another.
Public methodContains
Check if the BlockStatement contains the specified CodeObject.
(Inherited from BlockStatement.)
Public methodCopyFormatting
Copy formatting from another code object.
(Inherited from CodeObject.)
Public methodCreateAnnotations
Create the list of child Annotations, or return the existing one.
(Inherited from CodeObject.)
Public methodCreateBody
Create a body if one doesn't exist yet.
(Inherited from BlockStatement.)
Protected methodStatic memberCreateDummyProject
Create a dummy parent Project for when a code unit or fragment is loaded directly without a project.
Public methodCreateRef
Create a reference to the CodeObject.
(Inherited from CodeObject.)
Protected methodDefaultFormat
Default format the code object.
(Inherited from BlockStatement.)
Protected methodDefaultFormatField (Inherited from Statement.)
Public methodDefaultNewLines
Determine a default of 1 or 2 newlines when adding items to a Block.
(Inherited from NamespaceDecl.)
Public methodDefineCompilerDirectiveSymbol
Define the specified compiler directive symbol.
Public methodDispose
Dispose the CodeObject.
(Inherited from CodeObject.)
Public methodEquals (Inherited from Object.)
Public methodEvaluateTypeOrNamespace
Evaluate the type or namespace associated with the code object.
(Inherited from CodeObject.)
Protected methodFinalize (Inherited from Object.)
Public methodFind(String)
Enumerate all children with the specified name.
(Inherited from BlockStatement.)
Public methodFindT
Enumerate all children of type T.
(Inherited from BlockStatement.)
Public methodFindFirstT
Find the first child object of type T.
(Inherited from BlockStatement.)
Public methodFindFirstT(String)
Find the first child object with the specified name and type.
(Inherited from BlockStatement.)
Public methodFindIndexOf
Find the index of the specified CodeObject in the BlockStatement.
(Inherited from BlockStatement.)
Public methodFindParentT
Find the parent object of the specified type.
(Inherited from CodeObject.)
Public methodFindParentMethod
Find the parent method (or anonymous method or lambda) of the current code object.
(Inherited from CodeObject.)
Public methodFindParentMethodOrType
Find the parent method (or anonymous method or lambda) or type of the current code object.
(Inherited from CodeObject.)
Public methodGetAllChildrenT
Get an enumerator for all children objects of type T in the CodeObject and in any child CodeObjects (recursively).
(Inherited from CodeObject.)
Public methodGetAttribute
Returns the first attribute expression (Call or ConstructorRef) with the specified name on the CodeObject.
(Inherited from CodeObject.)
Public methodGetComment
Get the comment that satisfies the specified predicate.
(Inherited from CodeObject.)
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.
(Inherited from CodeObject.)
Public methodGetDocSummary
Returns the DocSummary documentation comment, or null if none exists.
(Inherited from CodeObject.)
Public methodGetFullName
Get the full name of the INamedCodeObject, including any namespace name.
Public methodGetHashCode (Inherited from Object.)
Public methodGetIndentLevel
Get the indent level of this object.
(Overrides CodeObjectGetIndentLevel.)
Public methodGetIndentSpaceCount
Get the current indent in spaces.
(Inherited from CodeObject.)
Public methodGetInferredType
Determine the type of an inferred ('var') type.
(Inherited from CodeObject.)
Public methodGetMessageCounts
Calculate message counts.
Public methodGetNamespace
Get the Namespace for this CodeObject.
(Inherited from CodeObject.)
Public methodStatic memberGetSaveFileName
Get the name of the save file.
Public methodGetType (Inherited from Object.)
Public methodGetTypeDecls
Get all TypeDecls declared in the NamespaceDecl, or in any nested NamespaceDecls (recursively).
(Inherited from NamespaceDecl.)
Public methodGetTypeRef
Get a TypeRef for the type with the specified full name, with caching (generally used for System types).
(Inherited from CodeObject.)
Public methodGetWorstMessageType
Get the type of the worst attached message.
(Inherited from CodeObject.)
Protected methodHasAnnotationT (Inherited from CodeObject.)
Public methodHasAttribute
Returns true if the attribute with the specified name exists on the object, otherwise false.
(Inherited from CodeObject.)
Public methodHasUnresolvedRef
Returns true if the code object is an UnresolvedRef or has any UnresolvedRef children.
(Inherited from NamespaceDecl.)
Public methodInsert
Insert a CodeObject at the specified index in the BlockStatement body.
(Inherited from BlockStatement.)
Protected methodIsChildIndented
Returns true if the specified child object is indented from the parent.
(Overrides CodeObjectIsChildIndented(CodeObject).)
Protected methodIsChildPrefix
Returns true if the specified child object is prefixed to the current object.
(Inherited from CodeObject.)
Public methodIsCompilerDirectiveSymbolDefined
Determine if the specified compiler directive symbol exists.
Public methodStatic memberLoad
Load a CodeUnit directly from the specified source file (without a Project or Solution).
Public methodStatic memberLoadFragment
Load a fragment of code from the specified string.
Public methodLogAndAttachException
Log the specified exception and message and also attach it as an annotation.
Public methodLogAndAttachMessage
Log the specified text message and also attach it as an annotation.
Public methodLogException
Log the specified exception and message.
Public methodLogMessage
Log the specified text message with the specified severity level.
Public methodLogMessageCounts
Log message counts, and optionally errors and warnings (or all messages if detail logging is on).
Protected methodMemberwiseClone (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).
(Inherited from CodeObject.)
Public methodMoveAnnotations
Move any annotations from the specified location to the specified destination location.
(Inherited from CodeObject.)
Public methodMoveComments(Token)
Move any non-EOL comments from the specified token to the current code object.
(Inherited from CodeObject.)
Public methodMoveComments(Token, Boolean)
Move any non-EOL comments from the specified token to the current code object.
(Inherited from CodeObject.)
Public methodMoveCommentsAsPost
Move any non-EOL comments from the specified token to the current code object as Post comments.
(Inherited from CodeObject.)
Public methodMoveEOLAndPostAnnotations
Move any EOL or Postfix annotations from the specified code object to the current code object.
(Inherited from CodeObject.)
Public methodMoveEOLComment(CodeObject)
Move any EOL comment from the specified code object to the current code object.
(Inherited from CodeObject.)
Public methodMoveEOLComment(Token)
Move any EOL comment from the specified token to the current code object.
(Inherited from CodeObject.)
Public methodMoveEOLComment(Token, Boolean, Boolean)
Move any EOL comment from the specified token to the current code object.
(Inherited from CodeObject.)
Public methodMoveEOLCommentAsInfix
Move any EOL comment from the specified token to the current code object as an Infix EOL comment.
(Inherited from CodeObject.)
Public methodMoveFormatting(CodeObject)
Move formatting from the specified code object to the current object.
(Inherited from CodeObject.)
Public methodMoveFormatting(Token)
Move formatting from the specified token to the current object.
(Inherited from CodeObject.)
Public methodMovePrefixAnnotationsAsPost
Move any prefix annotations on the specified code object to the current code object as post annotations.
(Inherited from CodeObject.)
Protected methodNotifyListedAnnotationAdded
Add the listed annotation and propagate to the parent Project and above.
(Overrides CodeObjectNotifyListedAnnotationAdded(Annotation).)
Protected methodNotifyListedAnnotationRemoved
Remove the listed annotation and propagate to the parent Project and above.
(Overrides CodeObjectNotifyListedAnnotationRemoved(Annotation).)
Public methodParse
Parse the CodeUnit from its file.
Protected methodParseAnnotations(Parser, CodeObject)
Parse annotations - specifically, compiler directives around things such as TypeParameters or ParameterDecls.
(Inherited from CodeObject.)
Protected methodParseAnnotations(Parser, CodeObject, Boolean, Boolean)
Parse any comments, attributes, compiler directives.
(Inherited from CodeObject.)
Protected methodParseExpectedToken
Parse the specified expected token, attaching a parse error to the current object if it doesn't exist.
(Inherited from CodeObject.)
Protected methodParseKeywordAndArgument (Inherited from Statement.)
Protected methodParseKeywordArgumentBody (Inherited from BlockStatement.)
Public methodParseResolveLog
Parse and optionally resolve the CodeUnit (or fragment), and log statistics if requested.
Protected methodParseTerminator
Parse the terminator at the end of a Statement.
(Inherited from Statement.)
Protected methodParseTerminatorOrBody (Inherited from BlockStatement.)
Protected methodParseUnusedAnnotations
Parse annotations from the Unused list.
(Inherited from CodeObject.)
Protected methodParseUnusedType
This method is used when we must parse backwards through the Unused list to get a type.
(Inherited from Statement.)
Public methodReformatBlock
Reformat the Block body.
(Inherited from BlockStatement.)
Public methodRemove
Remove a CodeObject from the NamespaceDecl body.
(Inherited from NamespaceDecl.)
Public methodRemoveAll
Remove all CodeObjects from the BlockStatement body.
(Inherited from BlockStatement.)
Public methodRemoveAllAnnotationsT
Remove all annotations of the specified type from this object.
(Inherited from CodeObject.)
Public methodRemoveAllAnnotationsWhereT
Remove all annotations from this object where the specified predicate is true.
(Inherited from CodeObject.)
Public methodRemoveAllMessages
Remove all messages from this object, or optionally only from the specified source.
(Inherited from CodeObject.)
Public methodRemoveAt
Remove the CodeObject at the specified index from the BlockStatement.
(Inherited from BlockStatement.)
Public methodRemoveAttribute
Remove the attribute expression with the specified name.
(Inherited from CodeObject.)
Public methodRemoveFromDictionary
Remove the CodeObject from the specified dictionary.
Public methodReplace
Replace the specified CodeObject with a new one.
(Inherited from BlockStatement.)
Public methodResolve(ResolveFlags)
Resolve all child symbolic references in the CodeUnit, handling any exceptions.
(Overrides CodeObjectResolve(ResolveFlags).)
Public methodResolve(ResolveCategory, ResolveFlags)
Resolve all child symbolic references, using the specified ResolveCategory and ResolveFlags.
(Inherited from NamespaceDecl.)
Public methodResolveAttributes
Resolve any attached attributes.
(Inherited from CodeObject.)
Public methodResolveDocComments
Resolve any references in attached documentation comments.
(Inherited from CodeObject.)
Public methodResolveExtensionMethod
Resolve an extension method with the specified name.
(Inherited from NamespaceDecl.)
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.
(Inherited from BlockStatement.)
Public methodResolveIndexerRef
Resolve indexers.
(Inherited from BlockStatement.)
Protected methodResolveNamespaces (Overrides NamespaceDeclResolveNamespaces.)
Public methodResolveRef
Resolve child code objects that match the specified name.
(Inherited from BlockStatement.)
Public methodResolveRefUp
Resolve child code objects that match the specified name, moving up the tree until a complete match is found.
(Overrides NamespaceDeclResolveRefUp(String, Resolver).)
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).
(Inherited from CodeObject.)
Public methodSave
Save the CodeUnit.
Public methodSaveAs
Save the CodeUnit to the specified file name.
Protected methodSetField(Object, Object, Boolean)
Set a field of a code object, including setting the parent, and optional formatting.
(Inherited from CodeObject.)
Protected methodSetFieldT(ChildListT, ChildListT)
Set a ChildList collection field of a code object, including setting the parent.
(Inherited from CodeObject.)
Protected methodSetFieldT(T, T, Boolean)
Set a field of a code object, including setting the parent, and optional formatting.
(Inherited from CodeObject.)
Protected methodSetFormatFlag (Inherited from CodeObject.)
Protected methodSetLineCol(CodeObject)
Set the line and column numbers to those in the specified CodeObject.
(Inherited from CodeObject.)
Protected methodSetLineCol(Token)
Set the line and column numbers to those in the specified token.
(Inherited from CodeObject.)
Public methodSetNewLines
Special method to set the newline count without setting the NewLinesSet flag.
(Inherited from CodeObject.)
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).
(Inherited from CodeObject.)
Public methodShouldHaveBraces
Determines if the body of the BlockStatement should be formatted with braces.
(Overrides BlockStatementShouldHaveBraces.)
Public methodToString
Render the type of the code object and its description as a string.
(Inherited from CodeObject.)
Public methodUndefineCompilerDirectiveSymbol
Undefine the specified compiler directive symbol.
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).
(Inherited from CodeObject.)
Public methodUpdateAllLineColInfo
Update the LineNumber and ColumnNumber properties of all child CodeObjects of the CodeUnit.
Protected methodUpdateLineCol (Overrides CodeObjectUpdateLineCol(CodeWriter, CodeObjectRenderFlags).)
Top
Fields
  NameDescription
Protected field_annotations
Any Annotations (Comments, DocComments, Attributes, or Messages) associated with the CodeObject (null if none).
(Inherited from CodeObject.)
Protected field_body
The body is always a Block, which in turn may contain zero or more other code objects, and it can also be null in special cases (such as for method signatures with no body, delegate declarations, or a While with the semi-colon on the same line).
(Inherited from BlockStatement.)
Protected field_code
Protected field_columnNumber
The starting column number associated with the CodeObject if parsed from or written to text form.
(Inherited from CodeObject.)
Protected field_compilerDirectiveSymbols
Compiler directive symbols defined in the current file.
Protected field_expression
The expression should evaluate to a NamespaceRef (whether pre-existing or created by this statement).
(Inherited from NamespaceDecl.)
Protected field_fileName
Protected field_formatFlags
Formatting flags - for line feeds, braces, etc.
(Inherited from CodeObject.)
Protected field_globalAlias
Generated 'extern alias global' statement.
Protected field_isNew
Protected field_isWorkflowCodeBesideFile
Protected field_lineNumber
The starting line number associated with the CodeObject if parsed from or written to text form.
(Inherited from CodeObject.)
Protected field_listedAnnotations
All 'listed' code annotations (Messages and special Comments) for this CodeUnit.
Protected field_name
Protected field_parent
The parent CodeObject.
(Inherited from CodeObject.)
Protected field_SLOC
Protected field_totalLines
Public fieldStatic memberDefaultEncoding
Determines the default source file encoding for files without a BOM prefix or a valid UTF8 sequence (defaults to Windows-1252). Use "UTF8" for UTF8. Use "ISO-8859-1" for Latin1 / extended ASCII.
Public fieldStatic memberListWorkflowFileErrors
Determines if messages in workflow code-beside files (".xoml.cs") are listed.
Public fieldStatic memberSaveChangesToSeparateFile
Determines if changes are saved to a separate ".Nova.cs" file instead of the original.
Top
Remarks
The format of a code unit is (in order): - Zero or more "extern alias" directives - Zero or more "using" directives (or "using aliasname = ...") - Zero or more global attributes - Zero or more namespace member declarations (child namespaces and/or type declarations) Of course, comments and preprocessor directives may be mixed in. The term "code unit" is used because the code might not be mapped to a file, and because it's shorter and more generic than the term "compilation unit" (which is specifically associated with compilation). Note that multiple CodeUnits can exist that map to the same physical file, in the case where the same file is a member of more than one project in the same solution. This is necessary, because each CodeUnit might have different compiler directives defined, resulting in a different parse tree. If saved to the file, each CodeUnit should produce the exact same save text, so no problems will result even though they write to the same file.
See Also