6.5.4.2. Nodes (Entities)¶
In the following we describe the possible types of nodes contained in C# RFGs.
Assembly¶
Assembly (inherits from:
File_System_Entity)
Subtypes
none
Containing Views
Assembly, Assembly References, Include
Description
A node of type
Assembly represents the contents of a .NET
assembly.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.From_Bytecode |
Toggle |
- |
Element.Has_Internal_Visibility |
Toggle |
- |
Element.Has_Private_Protected_Visibility |
Toggle |
- |
Element.Has_Private_Visibility |
Toggle |
- |
Element.Has_Protected_Internal_Visibility |
Toggle |
- |
Element.Has_Protected_Visibility |
Toggle |
- |
Element.Has_Public_Visibility |
Toggle |
- |
Element.Is_Artificial |
Toggle |
- |
Element.Is_Inherited |
Toggle |
- |
Element.Is_Referenced_Assembly |
Toggle |
- |
Linkage.Is_Ambiguous_Name |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
- |
Linkage.Name |
String |
File_System_Entity |
Source.Column |
Integer |
File_System_Entity |
Source.File |
String |
File_System_Entity |
Source.Line |
Integer |
File_System_Entity |
Source.Name |
String |
File_System_Entity |
Source.Path |
String |
File_System_Entity |
Source.Physical_Column |
Integer |
File_System_Entity |
Source.Physical_File |
String |
File_System_Entity |
Source.Physical_Line |
Integer |
File_System_Entity |
Source.Physical_Path |
String |
File_System_Entity |
Source.Physical_Region_Length |
Integer |
File_System_Entity |
Source.Physical_Region_Start |
Integer |
File_System_Entity |
Source.Region_Length |
Integer |
File_System_Entity |
Source.Region_Start |
Integer |
File_System_Entity |
Elements are contained in an assembly by
Enclosing edges
just like members are enclosed in types.
Assembly is not
a subtype of
Source_Entity; it can be tagged with the
following attributes:
Linkage.Name: Contains a unique identifier for the assembly, containing its file path.Source.Name: Contains the value of the attribute Assembly_Title of the assembly.Source.File: Contains the file name of the corresponding assembly.Source.Path: Contains the directory path of the corresponding assembly.
Element.Is_Referenced_Assembly: Is set to true if the assembly is a referenced assembly (otherwise it is a source assembly).
Class¶
Class (inherits from:
Type)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
The
Class node type represents nongeneric C#
classes, in particular reference classes and value classes like
structs), delegates (not enums, they are represented by
Type). The term Class subsumes in particular all
user-defined types, with the exception of interfaces, and is not equivalent to the types
defined by the class key word in C#.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Anonymous |
Toggle |
- |
Element.Is_Delegate |
Toggle |
- |
Element.Is_Extension |
Toggle |
- |
Element.Is_Final |
Toggle |
- |
Element.Is_New |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Struct |
Toggle |
- |
Element.Is_Template_Instance |
Toggle |
- |
Element.Is_Unsafe |
Toggle |
- |
Element.Is_Abstract |
Toggle |
Type |
Element.Is_Enum |
Toggle |
Type |
Element.Is_File_Local |
Toggle |
Type |
Element.Is_Reference_Type |
Toggle |
Type |
Element.Is_Static |
Toggle |
Type |
Element.Is_Template_Parameter |
Toggle |
Type |
Element.Is_Value_Type |
Toggle |
Type |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
The .NET common type system distinguishes between value types (e.g. enums and
structs) and reference types (e.g. actual (reference) classes and
delegates). Value types have the attribute
Element.Is_Value_Type set, reference types have the attribute
Element.Is_Reference_Type set. Nested classes
are contained within their outer class by using edges of type
Enclosing.
Similarly to methods and fields, the attribute
Element.Is_Unsafe indicates that the type is tagged with the
unsafe modifier (the code text of the type is then considered an unsafe
context).
Class kinds.¶
The different subtypes of
Class nodes are represented by the
following attributes:
Element.Is_Delegate: the entity is a delegate (a type offering roughly the functionality of a type-safe function pointer, see C# specification 4.0, 4.2.7),
Element.Is_Struct: the entity is a value class (struct),
If none of these attributes is set, the entity is an actual reference class (
class).
Note
Code Example
public class AClass
{
protected struct ANestedStruct
{
}
protected internal enum ANestedEnum
{
Value1,
Value2
}
internal delegate void ADelegate();
}
Example: Classes, structs, delegates, and enums.¶
Note
Code Example
public delegate void EventHandler ();
public class AClass {
public event EventHandler Change;
public void doSomething ()
{
Change ();
}
}
// Class which handles the event
public class HandlerClass
{
public HandlerClass (AClass param) {
param.Change += new EventHandler ( somethingChanges );
}
private void somethingChanges () { }
}
// Class to test it all
public class GameTest
{
public static void Main () {
AClass ac = new AClass();
HandlerClass hc = new HandlerClass (ac);
}
}
An event and a delegate.¶
Class_Template¶
Class_Template (inherits from:
Template)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
A
Class_Template models an uninstantiated (open)
generic class. It is connected to its instances (which are
Class nodes) via
Instance_Of edges.
Note
We use the term Template also for generic entities in C# to stay consistent with the language models of the other supported languages.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Abstract |
Toggle |
- |
Element.Is_Delegate |
Toggle |
- |
Element.Is_Extension |
Toggle |
- |
Element.Is_File_Local |
Toggle |
- |
Element.Is_Final |
Toggle |
- |
Element.Is_New |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Reference_Type |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Element.Is_Struct |
Toggle |
- |
Element.Is_Value_Type |
Toggle |
- |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Nodes of type
Class_Template can have the same
attributes set as nodes of type
Class with the exception of
the
Element.Is_Template_Instance attribute
and the
Element.Is_Anonymous attribute.
Note
Code Example
public class AGenericClass<T, U>
{ }
public struct AGenericStruct<V>
{ }
public class AClass
{
AGenericStruct<int> Member;
}
Example: Generic class.¶
Constant¶
Constant (inherits from:
Object)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
The
Constant node type represents enum constants.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Directory¶
Directory (inherits from:
File_System_Entity)
Subtypes
none
Containing Views
Include
Description
In addition to the language representation, the Axivion Suite captures the containment of declarations/definitions in modules, files, and directories.
A
Directory represents a directory in the file system. A
Directory node can contain
File
nodes and
Directory nodes.
Note
You can configure the topmost directory that will be used for a system, see
Architecture-Dependencies.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Name |
String |
File_System_Entity |
Source.Column |
Integer |
File_System_Entity |
Source.File |
String |
File_System_Entity |
Source.Line |
Integer |
File_System_Entity |
Source.Name |
String |
File_System_Entity |
Source.Path |
String |
File_System_Entity |
Source.Physical_Column |
Integer |
File_System_Entity |
Source.Physical_File |
String |
File_System_Entity |
Source.Physical_Line |
Integer |
File_System_Entity |
Source.Physical_Path |
String |
File_System_Entity |
Source.Physical_Region_Length |
Integer |
File_System_Entity |
Source.Physical_Region_Start |
Integer |
File_System_Entity |
Source.Region_Length |
Integer |
File_System_Entity |
Source.Region_Start |
Integer |
File_System_Entity |
File¶
File (inherits from:
File_System_Entity)
Subtypes
none
Containing Views
Include
Description
A
File node represents a source file. It contains all
declarations and definitions by incoming
Enclosing edges.
A
File node itself may be contained in a
Directory node. The path is expressed by the hierarchy of
Directory nodes.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Name |
String |
File_System_Entity |
Source.Column |
Integer |
File_System_Entity |
Source.File |
String |
File_System_Entity |
Source.Line |
Integer |
File_System_Entity |
Source.Name |
String |
File_System_Entity |
Source.Path |
String |
File_System_Entity |
Source.Physical_Column |
Integer |
File_System_Entity |
Source.Physical_File |
String |
File_System_Entity |
Source.Physical_Line |
Integer |
File_System_Entity |
Source.Physical_Path |
String |
File_System_Entity |
Source.Physical_Region_Length |
Integer |
File_System_Entity |
Source.Physical_Region_Start |
Integer |
File_System_Entity |
Source.Region_Length |
Integer |
File_System_Entity |
Source.Region_Start |
Integer |
File_System_Entity |
The Source.Name of a
File node is the name of
the file in the file system (with extension).
File_System_Entity¶
File_System_Entity
Subtypes
Assembly,
Directory,
File
Containing Views
Include
Description
The
File_System_Entity node type is the base
type of all nodes representing entities of the file system, like directories and files.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Linkage.Name |
String |
- |
Source.Column |
Integer |
- |
Source.File |
String |
- |
Source.Line |
Integer |
- |
Source.Name |
String |
- |
Source.Path |
String |
- |
Source.Physical_Column |
Integer |
- |
Source.Physical_File |
String |
- |
Source.Physical_Line |
Integer |
- |
Source.Physical_Path |
String |
- |
Source.Physical_Region_Length |
Integer |
- |
Source.Physical_Region_Start |
Integer |
- |
Source.Region_Length |
Integer |
- |
Source.Region_Start |
Integer |
- |
Interface¶
Interface (inherits from:
Type)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
An
Interface models a non-generic C# interface
type.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Interface |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Template_Instance |
Toggle |
- |
Element.Is_Abstract |
Toggle |
Type |
Element.Is_Enum |
Toggle |
Type |
Element.Is_File_Local |
Toggle |
Type |
Element.Is_Reference_Type |
Toggle |
Type |
Element.Is_Static |
Toggle |
Type |
Element.Is_Template_Parameter |
Toggle |
Type |
Element.Is_Value_Type |
Toggle |
Type |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Since interfaces are reference types, the attribute
Element.Is_Reference_Type is always set for them.
Note
Code Example
public interface IForward
{
void Next ();
}
public interface IBackward
{
void Prev ();
}
public class Navigator: IForward, IBackward
{
public void Next ()
{ }
public void Prev ()
{ }
}
Example: Interfaces.¶
Interface_Template¶
Interface_Template (inherits from:
Template)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
A
Interface_Template models an uninstantiated (open)
generic interface. It is connected to its instances (which are
Interface nodes) via
Instance_Of edges.
Note
We use the term Template also for generic entities in C# to stay consistent with the language models of the other supported languages.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Abstract |
Toggle |
- |
Element.Is_File_Local |
Toggle |
- |
Element.Is_Interface |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Reference_Type |
Toggle |
- |
Element.Is_Template_Instance |
Toggle |
- |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Note
Code Example
public interface IProvider<T>
{ }
public class AClass<U> : IProvider<int>
{ }
Example: Generic interface.¶
Member¶
Member (inherits from:
Source_Entity)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
The
Member node type is used for fields and special
syntactic member constructs like properties.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Abstract |
Toggle |
- |
Element.Is_Const |
Toggle |
- |
Element.Is_Event |
Toggle |
- |
Element.Is_Final |
Toggle |
- |
Element.Is_Indexer |
Toggle |
- |
Element.Is_New |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Property |
Toggle |
- |
Element.Is_Readonly |
Toggle |
- |
Element.Is_Ref |
Toggle |
- |
Element.Is_Required |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Element.Is_Unsafe |
Toggle |
- |
Element.Is_Volatile |
Toggle |
- |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Modelling of special members¶
For members being properties, indexers, and events, the attributes
Element.Is_Property,
Element.Is_Indexer, and
Element.Is_Event
are set, respectively. These entities have accessor methods enclosed in them.
Modifiers.¶
Fields, properties and events can be static; then they are tagged with the attribute
Element.Is_Static.
The attribute
Element.Is_New indicates that the entity is
tagged with the new modifier (i.e., in the source code it is specified that the
entity hides an entity of the same name in a base class of its declaring type, see also
C# specification 4.0, 10.3.4 and C# specification 4.0, 3.7.1.2). The attribute
Element.Is_Unsafe indicates that a property is tagged
with the unsafe modifier (the code text of the property is then considered an
unsafe context). The attributes
Element.Is_Const,
Element.Is_Volatile and
Element.Is_ReadOnly indicate that a field is const,
volatile, or readonly, respectively (see e.g. C# specification 4.0,
10.5.3).
Note
For an automatic property like int AProperty { get; set; }, an artificial
backing field is created (here of type int) which holds the actual value of
the property. The backing field has the attribute
Element.Is_Artificial set and is not enclosed within the
Property node of the property.
Note
Code Example
using System;
class ParentClass
{
public int AnInstanceProperty { set; get; }
}
class AClass : ParentClass {
public new int AnInstanceProperty { set; get; }
public static event Func<int, int> AStaticEvent
{
add { }
remove { }
}
}
Properties, indexers, and events.¶
Method¶
Method (inherits from:
Routine)
Subtypes
none
Containing Views
Assembly, Call, Code Facts
Description
The
Method node type is used for modelling all kinds of
nongeneric methods: ordinary methods, constructors and destructors, operators, accessors
of properties, indexers, and events. Additionally, instances of generic methods are also
represented as methods.
A special kind of routines in C# programs are anonymous functions, which represent “an
’in-line’ method-definition” (C# specification 4.0, 7.15). There are two different kinds
of anonymous functions, lambda expressions and anonymous method expressions. Both are
represented by
Method in the RFG, with the attribute
Source.Name set to ?.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Abstract |
Toggle |
- |
Element.Is_Adder |
Toggle |
- |
Element.Is_Constructor |
Toggle |
- |
Element.Is_Destructor |
Toggle |
- |
Element.Is_Final |
Toggle |
- |
Element.Is_Getter |
Toggle |
- |
Element.Is_Initonly |
Toggle |
- |
Element.Is_New |
Toggle |
- |
Element.Is_PInvoke |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Remover |
Toggle |
- |
Element.Is_Setter |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Element.Is_Template_Instance |
Toggle |
- |
Element.Is_Unsafe |
Toggle |
- |
Element.Is_Virtual_Method |
Toggle |
- |
Element.Is_Anonymous |
Toggle |
Routine |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Method kinds¶
The different kinds of methods are indicated by the following attributes:
Element.Is_Constructor: the method is an instance constructor or static constructor,
Element.Is_Destructor: the method is a destructor,
Element.Is_Setter/
Element.Is_Getter: the method is a setter respectively getter of a property or indexer, and
Element.Is_Adder/
Element.Is_Remover: the method is an adder respectively a remover of an event.
Additionally, the following attributes can be set for methods:
Element.Is_Abstract: indicates that the method is abstract (in particular, no method body is present),
Element.Is_Final: the method is sealed,
Element.Is_New: the method is tagged with thenewmodifier in the source code (this indicates that method hides a method of the same name in a base class of its declaring type, see also C# specification 4.0, 10.3.4),
Element.Is_Static: the method is static,
Element.Is_PInvoke: the method is tagged with theDllImportattribute (i.e., refers to an unmanaged method within another library),
Element.Is_Template_Instance: indicates that the method is an instance of a generic type.
Element.Is_Unsafe: indicates that the method is tagged with theunsafemodifier (the code of the method is then considered an unsafe context).
Element.Is_Virtual_Method: the method is virtual.
Element.Is_Initonly: the method is a property init-only setter. This attribute is set in addition to the
Element.Is_Setterattribute.
Note
Some routines and methods are generated by the C# compiler and do not appear directly
in source code. This includes special operators and default constructors. In the RFG
the corresponding nodes have the attribute
Element.Is_Artificial set.
Note
Code Example
public class AClass
{
public delegate void Foo();
protected string AProperty { get { return ""; } set {} }
private int this[int i1, int i2]
{
get { return 1; }
}
public event Foo AnEvent { add {} remove {}}
}
Accessors of properties, indexers, and events.¶
Note
Code Example
public class AClass
{
delegate int ADelegate(int parameter);
public int Member1;
public int Member2;
public void AMethod()
{
ADelegate f1 = x => { Member1 = x; return x; };
ADelegate f2 = delegate (int x) { Member2 = x; return x; };
}
}
Anonymous functions.¶
Note
Code Example
public unsafe class AClass
{
public AClass()
{}
~AClass()
{}
public void AnInstanceMethod() {}
public static void AStaticMethod() {}
public static unsafe void AnUnsafeStaticMethod() {}
}
Different kinds of methods.¶
Method_Template¶
Method_Template (inherits from:
Routine_Template)
Subtypes
none
Containing Views
Assembly, Call, Code Facts
Description
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Abstract |
Toggle |
- |
Element.Is_Anonymous |
Toggle |
- |
Element.Is_New |
Toggle |
- |
Element.Is_Partial |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Element.Is_Virtual_Method |
Toggle |
- |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Nodes of type
Method_Template can have the same
attributes set as the
Method with the exception of the
Element.Is_Template_Instance attribute.
Note
Code Example
public class AClass
{
public T AMethod<T>(T t)
{
return t;
}
public void Foo()
{
int x = AMethod<int>(1);
}
}
Example: Generic method.¶
Namespace¶
Namespace (inherits from:
Source_Entity)
Subtypes
none
Containing Views
Assembly, Code Facts
Description
A node of type
Namespace groups together elements of a C#
namespace; it is a subtype of
Source_Entity. Elements are
contained in a namespaces by
Enclosing edges just like
members are enclosed in types.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Apart from attributes inherited from
Source_Entity,
Namespace does not have any additional attributes.
Routine¶
Routine (inherits from:
Source_Entity)
Subtypes
Method
Containing Views
Assembly, Call, Code Facts
Description
An artificial routine represents the entry point of
a project (generated by rule:tool:Architecture-Dependencies).
Apart of that, there appear no other nodes of type
Routine in C# RFGs (only nodes of its subtype
Method).
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Anonymous |
Toggle |
- |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Source_Entity¶
Source_Entity
Subtypes
Member,
Namespace,
Object,
Routine,
Template,
Type
Containing Views
none (only subtypes of
Source_Entity are contained in views)
Description
The
Source_Entity node type is the base type of all
source-related entities like types, routines, fields, and namespaces.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.From_Bytecode |
Toggle |
- |
Element.Has_Internal_Visibility |
Toggle |
- |
Element.Has_Private_Protected_Visibility |
Toggle |
- |
Element.Has_Private_Visibility |
Toggle |
- |
Element.Has_Protected_Internal_Visibility |
Toggle |
- |
Element.Has_Protected_Visibility |
Toggle |
- |
Element.Has_Public_Visibility |
Toggle |
- |
Element.Is_Artificial |
Toggle |
- |
Element.Is_Inherited |
Toggle |
- |
Linkage.Is_Ambiguous_Name |
Toggle |
- |
Linkage.Is_Definition |
Toggle |
- |
Linkage.Name |
String |
- |
Source.Column |
Integer |
- |
Source.Declaration_Start |
Integer |
- |
Source.File |
String |
- |
Source.Line |
Integer |
- |
Source.Name |
String |
- |
Source.Path |
String |
- |
Source.Physical_Column |
Integer |
- |
Source.Physical_File |
String |
- |
Source.Physical_Line |
Integer |
- |
Source.Physical_Path |
String |
- |
Source.Physical_Region_Length |
Integer |
- |
Source.Physical_Region_Start |
Integer |
- |
Source.Region_Length |
Integer |
- |
Source.Region_Start |
Integer |
- |
Source.Signature_Start |
Integer |
- |
Nodes of type
Source_Entity (or one of its subtypes) might
be tagged with attributes describing their visibility, their source position, and
information about the compilation process.
One of the most important attributes of source entities is Source.Name,
which contains the name of the entity. Two nodes can in general have the same source
name (e.g. a constructor of a type A has A as its source name, so does
the type itself). The attribute
Element.Is_Artificial is set for entities that are generated by the
compiler and do not have an exact corresponding entity in the source code.
Visibility¶
Visibility is expressed by the attributes
Element.Has_Internal_Visibility,
Element.Has_Private_Visibility,
Element.Has_Protected_Visibility,
Element.Has_Private_Protected_Visibility,
Element.Has_Protected_Internal_Visibility, and
Element.Has_Public_Visibility.
Source location¶
The location of an entity in a source file (if there is one) is specified by
Source.Column and Source.Line. The source file can
be located by the attributes Source.Path and Source.File.
If the source file makes use of #line directives, the attributes with the
Physical_ prefix provide the physical/untranslated location, and the unprefixed
attributes provide the mapped location information, otherwise both attribute groups
refer to the same location.
If the entity has a signature, the attributes Source.Declaration_Start
and Source.Signature_Start provide the first (physical) line number
of the declaration and signature, respectively. The declaration start includes
attribute lists, if present. The signature starts from the first modifier keyword.
If the entity spans a larger region in the code, the attributes Source.Region_Start
and Source.Region_Length provide its starting line and total number of lines.
Compilation process¶
The attribute Linkage.Is_Definition is set if the node represents a
definition of e.g. a method. For distinguishing nodes from each other, the attribute
Linkage.Name contains a unique identifier of the node.
Note
For facilitating analyses that investigate architectural problems, nodes for
inherited entities might be copied: E.g., if a type A contains a method
f(), and a class B inherits from A without overriding it,
then a call b.f() with b having static type B causes a copy
of f() to be inserted as a child of the node representing B. These
copies are marked by the attributes
Element.Is_Artificial and
Element.Is_Inherited.
Type¶
Type (inherits from:
Source_Entity)
Subtypes
Class,
Interface
Containing Views
Assembly, Code Facts
Description
The
Type node type is the base type of non-generic types. It
represents in particular enums and generic parameters, and has the subtypes
Class and
Interface.
Attributes
Attribute name |
Attribute type |
Inherited from |
|---|---|---|
Element.Is_Abstract |
Toggle |
- |
Element.Is_Enum |
Toggle |
- |
Element.Is_File_Local |
Toggle |
- |
Element.Is_Reference_Type |
Toggle |
- |
Element.Is_Static |
Toggle |
- |
Element.Is_Template_Parameter |
Toggle |
- |
Element.Is_Value_Type |
Toggle |
- |
Element.From_Bytecode |
Toggle |
Source_Entity |
Element.Has_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Private_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Internal_Visibility |
Toggle |
Source_Entity |
Element.Has_Protected_Visibility |
Toggle |
Source_Entity |
Element.Has_Public_Visibility |
Toggle |
Source_Entity |
Element.Is_Artificial |
Toggle |
Source_Entity |
Element.Is_Inherited |
Toggle |
Source_Entity |
Linkage.Is_Ambiguous_Name |
Toggle |
Source_Entity |
Linkage.Is_Definition |
Toggle |
Source_Entity |
Linkage.Name |
String |
Source_Entity |
Source.Column |
Integer |
Source_Entity |
Source.Declaration_Start |
Integer |
Source_Entity |
Source.File |
String |
Source_Entity |
Source.Line |
Integer |
Source_Entity |
Source.Name |
String |
Source_Entity |
Source.Path |
String |
Source_Entity |
Source.Physical_Column |
Integer |
Source_Entity |
Source.Physical_File |
String |
Source_Entity |
Source.Physical_Line |
Integer |
Source_Entity |
Source.Physical_Path |
String |
Source_Entity |
Source.Physical_Region_Length |
Integer |
Source_Entity |
Source.Physical_Region_Start |
Integer |
Source_Entity |
Source.Region_Length |
Integer |
Source_Entity |
Source.Region_Start |
Integer |
Source_Entity |
Source.Signature_Start |
Integer |
Source_Entity |
Abstract types are tagged with the
Element.Is_Abstract
attribute. If the type is a generic instance, the attribute
Element.Is_Template_Instance is set.
Type kinds¶
A type in C# and .NET can either be
a value type: then it is tagged with the
Element.Is_Value_Typeattribute, ora reference type, then it is tagged with the
Element.Is_Reference_Type.
Enums are represented by nodes of type
Type, tagged by the
Element.Is_Enum attribute. This representation is done to
harmonize the representation with the C/C++ language model (technically, enums in C# are
value classes). A special kind of types are generic parameters; they are tagged with
the attribute
Element.Is_Template_Parameter.