C# (CSharp) Microsoft.Cci.MutableCodeModel Namespace

Nested Namespaces

Microsoft.Cci.MutableCodeModel.Contracts

Classes

Name Description
AnonymousDelegateRemover A rewriter for CodeModel method bodies, which changes any anynomous delegate expressions found in the body into delegates over methods of either the containing type of the method, or of a nested type of that type.
AnonymousDelegateRemover.GenericParameterRewriter
AnonymousDelegateRemover.PopFinder
AssertStatement A statement that asserts that a condition must always be true when execution reaches it. For example the assert statement of Spec#.
AssumeStatement A statement that asserts that a condition will always be true when execution reaches it. For example the assume statement of Spec# or a call to System.Diagnostics.Assert in C#.
BlockStatement
BoundField
BreakStatement
CapturedParameterAndLocalFinder A traverser that records all of the parameters and locals that are captured by anoymous delegates and also records the anonymous delegates that do the capturing. Delegates that only capture the "this" argument will have an entry in anonymousDelegatesThatCaptureThis but no entry in anonymousDelegatesThatCaptureLocalsOrParameters.
CatchClause
ClosureFinder
CodeCopier
CodeCopier.CreateMutableType The best way to dispatch a visit method in code copier is to implement an ICodeVisitor and call the dispatch method of IExpression or IStatement dynamically. This class implements the ICodeVisitor interface for the code copier. After a node is visited, the result is stored in resultExpression or resultStatement.
CodeDeepCopier
CodeDeepCopier.CodeDispatcher
CodeShallowCopier
CodeShallowCopier.CodeDispatcher
ConditionalStatement
ContinueStatement
CopyMemoryStatement Represents the cpblk IL instruction, which copies a block of memory from one address to another. The behavior of this instruction is undefined if the source block overlaps the target block.
CopyTypeFromIteratorToClosure Copy a type reference used by an iterator method to a type reference used by the iterator closure. That is, replace occurences of the generic method parameters with corresponding generic type parameters.
DebuggerBreakStatement
DoUntilStatement
EmptyStatement
ExpressionStatement
FillMemoryStatement Represents the initblk IL instruction, which fills a block of memory with repeated copies of a given fill value.
ForEachStatement
ForStatement
GotoStatement
GotoSwitchCaseStatement
IteratorClosureGenerator Create closure class, including all its members for an iterator method and rewrite the body of the iterator method. Specifically, we: 1) creates a closure class that implements: IEnumerator, generic and nongeneric versions, IEnumerable, generic and nongeneric versions, and IDisposable. The generic versions of IEnumerator and IEnumerator is instantiated by a type T that is used to instantiate the return type of the iterator method. The members of the closure class include: 1.1) fields corresponding to every parameter and local variables. 1.2) fields that manages the state machine: __current and __state, and a currentThreadId field. 1.3) a constructor that takes one int argument. 1.4) methods that are required by the interfaces of the closure class: MoveNext, Reset, GetEnumerator, Current getter, and DisposeMethod. 2) creates the new body of the iterator method: which returns a local variable that holds a new object of the closure class, with the fields of the closure class that correspond to the parameters (including the self parameter if applicable) initialized. 3) transforms the body, which should now not contain any annonymous delegates, into the body of the MoveNext method of the closure class. This includes: 3.1) every local/parameter reference -> this.field reference 3.2) every yield return or yield break -> assignment to current and return true or false, respectively. 3.3) a switch statement for the state machine, with state values corresponds to each yield return/yield break. 3.4) try statement for foreach if the iterator method body uses one. 4) If the iterator method has a type parameter, so will the closure class. Make sure in the closure class only the right type parameter is referenced.
IteratorClosureGenerator.LocalCollector
IteratorClosureInformation Information needed for and during the creation of the closure class for an iterator method. Such information includes: 1) the closure class, 2) its members, and 3) references to the generic instances of the class and its members, as used by methods in the closure class.
LabeledStatement
LocalDeclarationStatement An object that represents the declaration of a local variable, with optional initializer.
LockStatement
MethodBodyMappingMutator Use this as a base class when you try to mutate the method body of method M1 in class C1 to be used as method body of method M2 in class C2. supporting the substitution of parameters as well as type parameters.
MethodBodyNormalizer A class providing functionality to rewrite high level constructs such as anonymous delegates and yield statements into helper classes and methods, thus making it easier to generate IL from the CodeModel.
NormalizationChecker A traverser that checks for the presense of yield statements and anonymous delegates.
PushStatement Pushes a value onto an implicit operand stack.
ResourceUseStatement
RethrowStatement
ReturnStatement
RewriteAsMoveNext A rewriter that takes a copy of the body of an iterator method and turns it into the body of a MoveNext method by replacing parameters and locals with iterator state fields and replacing occurrences of the generic method parameters of the iterator with generic type parameter of the iterator state class.
ScopesWithCapturedLocalsFinder A traverser that records all of the scopes that declare locals that have been captured by anonymous delegates. This runs as a second pass, after all of the captured locals have been found.
SourceMethodBody A metadata (IL) representation along with a source level representation of the body of a method or of a property/event accessor.
Statement An executable statement.
SwitchCase
SwitchStatement
ThrowStatement
TryCatchFinallyStatement Represents a try block with any number of catch clauses, any number of filter clauses and, optionally, a finally or fault block.
WhileDoStatement
YieldBreakStatement
YieldReturnStatement
YieldReturnYieldBreakReplacer