Method | Description | |
---|---|---|
AnonymousDelegateRemover ( IMetadataHost host, ISourceLocationProvider sourceLocationProvider ) : Microsoft.Cci.MutableCodeModel |
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.
|
|
RemoveAnonymousDelegates ( IMethodDefinition method, |
When given a method definition and a block of statements that represents the Block property of the body of the method this method returns a semantically equivalent SourceMethod with a body that no longer has any anonymous delegate expressions. The given block of statements is mutated in place. Any types that get defined in order to implement the body semantics are returned (null if no such types are defined).
|
|
Rewrite ( IAnonymousDelegate anonymousDelegate ) : IExpression |
Rewrites the given anonymous delegate expression.
|
|
Rewrite ( IAssignment assignment ) : IExpression |
Rewrites the given assignment expression.
|
|
Rewrite ( IThisReference thisReference ) : IExpression |
Rewrites the given this reference expression.
|
|
Rewrite ( ILocalDeclarationStatement localDeclarationStatement ) : IStatement |
Rewrites the children of the given local declaration statement.
|
|
Rewrite ( IGenericMethodParameterReference genericMethodParameterReference ) : ITypeReference |
Rewrites the given generic method parameter reference.
|
|
RewriteChildren ( Microsoft.Cci.MutableCodeModel.AddressableExpression addressableExpression ) : void |
Rewrites the children of the given addressable expression.
|
|
RewriteChildren ( Microsoft.Cci.MutableCodeModel.BlockExpression blockExpression ) : void |
Rewrites the children of the given block expression.
|
|
RewriteChildren ( |
Rewrites the children of the given statement block.
|
|
RewriteChildren ( Microsoft.Cci.MutableCodeModel.BoundExpression boundExpression ) : void |
Rewrites the children of the given bound expression.
|
|
RewriteChildren ( |
Rewrites the children of the given catch clause.
|
|
RewriteChildren ( |
Rewrites the children of the given foreach statement.
|
|
RewriteChildren ( GenericMethodInstanceReference genericMethodInstanceReference ) : void |
Rewrites the children of the given generic method instance reference.
|
|
RewriteChildren ( Microsoft.Cci.MutableCodeModel.TargetExpression targetExpression ) : void |
Rewrites the children of the given target expression.
|
Method | Description | |
---|---|---|
AllocateClosureFor ( object scope, List |
Saves the current closure fields. Allocates a new closure and updates the fields. Then calls the given delegate and restores the earlier state.
|
|
CreateClosureClass ( ) : void |
Creates a new nested type definition with a default constructor and no other members and adds it to this.closureClasses. If this.method is generic, then the closure class is generic as well, with the same number of type parameters (constrained in the same way) as the generic method. Initializes this.currentClosure, this.currentClosureInstance and this.currentClosureSelfInstance.
|
|
CreateClosureField ( object capturedDefinition, ITypeReference fieldType, ITypeReference typeToUseInThisMethod, string name ) : void |
Creates a field in the current closure class with the given type and name. If the current closure class is generic, the returned value is a reference to the corresponding field in the InstanceType of the current closure class.
|
|
CreateClosureMethod ( Microsoft.Cci.MutableCodeModel.AnonymousDelegate anonymousDelegate ) : IMethodReference |
Returns a reference to the closure method. If the method is generic, the reference is to an instantiation, using the generic parameters of the current class as arguments.
|
|
CreateStaticCacheField ( ITypeReference fieldType ) : IFieldReference |
Creates and returns a static field of the given type and adds it to the helper members of the containing type of this.method.
|
|
GenerateTopLevelClosure ( ) : void |
If any parameters have been captured, or if "this" has been captured along with some locals, generate a closure class for the root block and populate it with fields to hold the captured parameter values and the "this" argument (if captured).
|
|
GetClosureObjectInstanceContaining ( IFieldReference closureField ) : IExpression |
Returns an expression that results in a closure object instance that contains the given field. If the expression will be evaluated in the body of this.method, the result is a bound expression that references the local that contains the object. Otherwise it is the "this" argument of the anonymous delegate method, possibly with a number of field accesses to chase down the outer closure chain.
|
|
GetOffsetOfFirstStatementAfterBaseOrThisConstructorCall ( List |
||
GetReferenceToDefaultConstructor ( ITypeReference containingType ) : IMethodReference |
Returns a reference to the default constructor method of the given type.
|
|
InsertStatementsToAllocateAndInitializeTopLevelClosure ( |
Inserts statements into block that will create an instance of the top level closure and initialize it with captured parameter values and the "this" value (if captured).
|
|
MakeDelegateMethodGeneric ( MethodDefinition delegateMethod ) : void |
Copies the generic parameters from this.method to the given delegate method and fixes up the delegate method signature to refer to its own type parameters, rather than those of this.method.
|
public AnonymousDelegateRemover ( IMetadataHost host, ISourceLocationProvider sourceLocationProvider ) : Microsoft.Cci.MutableCodeModel | ||
host | IMetadataHost | An object representing the application that is hosting the converter. It is used to obtain access to some global /// objects and services such as the shared name table and the table for interning references. |
sourceLocationProvider | ISourceLocationProvider | An object that can map the ILocation objects found in a block of statements to IPrimarySourceLocation objects. May be null. |
return | Microsoft.Cci.MutableCodeModel |
public RemoveAnonymousDelegates ( IMethodDefinition method, |
||
method | IMethodDefinition | The method containing the block that is to be rewritten. |
body | The block to be rewritten. /// The entire tree rooted at the block must be mutable and the nodes must not be shared with anything else. | |
return | ICollection |
public Rewrite ( IAnonymousDelegate anonymousDelegate ) : IExpression | ||
anonymousDelegate | IAnonymousDelegate | |
return | IExpression |
public Rewrite ( IAssignment assignment ) : IExpression | ||
assignment | IAssignment | |
return | IExpression |
public Rewrite ( IThisReference thisReference ) : IExpression | ||
thisReference | IThisReference | |
return | IExpression |
public Rewrite ( ILocalDeclarationStatement localDeclarationStatement ) : IStatement | ||
localDeclarationStatement | ILocalDeclarationStatement | |
return | IStatement |
public Rewrite ( IGenericMethodParameterReference genericMethodParameterReference ) : ITypeReference | ||
genericMethodParameterReference | IGenericMethodParameterReference | |
return | ITypeReference |
public RewriteChildren ( Microsoft.Cci.MutableCodeModel.AddressableExpression addressableExpression ) : void | ||
addressableExpression | Microsoft.Cci.MutableCodeModel.AddressableExpression | |
return | void |
public RewriteChildren ( Microsoft.Cci.MutableCodeModel.BlockExpression blockExpression ) : void | ||
blockExpression | Microsoft.Cci.MutableCodeModel.BlockExpression | |
return | void |
public RewriteChildren ( |
||
block | ||
return | void |
public RewriteChildren ( Microsoft.Cci.MutableCodeModel.BoundExpression boundExpression ) : void | ||
boundExpression | Microsoft.Cci.MutableCodeModel.BoundExpression | |
return | void |
public RewriteChildren ( |
||
catchClause | ||
return | void |
public RewriteChildren ( |
||
forEachStatement | ||
return | void |
public RewriteChildren ( GenericMethodInstanceReference genericMethodInstanceReference ) : void | ||
genericMethodInstanceReference | GenericMethodInstanceReference | |
return | void |
public RewriteChildren ( Microsoft.Cci.MutableCodeModel.TargetExpression targetExpression ) : void | ||
targetExpression | Microsoft.Cci.MutableCodeModel.TargetExpression | |
return | void |