C# Class Microsoft.Cci.ILToCodeModel.PatternReplacer

Inheritance: CodeTraverser
显示文件 Open project: visualmutator/visualmutator

Private Properties

Property Type Description
AddSizesAndArrayInitializers void
CollapseOpAssign IExpression
ComputeFlatIndex int
ConvertToUlong ulong
IsAssignmentToFieldOrProperty bool
IsSetter bool
ObjectInvariant void
PatternReplacer System.Collections.Generic
ReadValue object
ReplaceArrayInitializerPattern bool
ReplaceArrayInitializerPattern2 bool
ReplaceCompilerGeneratedLocalUsedForInitializersPattern bool
ReplaceConditionalExpressionPattern bool
ReplaceDupPopPattern bool
ReplacePlusAssignForStringPattern bool
ReplacePostBinopPattern bool
ReplacePropertyBinopPattern bool
ReplacePushDupPopPattern bool
ReplacePushDupPushPopPattern bool
ReplacePushPopPattern bool
ReplacePushPushDupPopPopPattern bool
ReplaceReturnViaGoto bool
ReplaceReturnViaGotoInVoidMethods bool
ReplaceSelfAssignment bool
ReplaceShortCircuitAnd bool
ReplaceShortCircuitAnd2 bool
ReplaceShortCircuitAnd3 bool
ReplaceShortCircuitAnd4 bool
ReplaceShortCircuitAnd5 bool
ReplaceShortCircuitAnd6 bool
ReplaceSingleUseCompilerGeneratedLocalPattern bool
ReplacedCompoundAssignmentViaTempPattern bool
TraverseChildren void

Private Methods

Method Description
AddSizesAndArrayInitializers ( Microsoft.Cci.MutableCodeModel.CreateArray createArray, IFieldDefinition initialValueField ) : void
CollapseOpAssign ( Microsoft.Cci.MutableCodeModel.Assignment assignment ) : IExpression
ComputeFlatIndex ( Microsoft.Cci.MutableCodeModel.ArrayIndexer arrayIndexer, Microsoft.Cci.MutableCodeModel.CreateArray createArray ) : int
ConvertToUlong ( IMetadataConstant c ) : ulong
IsAssignmentToFieldOrProperty ( ILocalDefinition local, IStatement statement ) : bool
IsSetter ( IMethodReference methodReference ) : bool
ObjectInvariant ( ) : void
PatternReplacer ( SourceMethodBody sourceMethodBody, BlockStatement block ) : System.Collections.Generic
ReadValue ( PrimitiveTypeCode primitiveTypeCode, BinaryReader reader ) : object
ReplaceArrayInitializerPattern ( BlockStatement b ) : bool
ReplaceArrayInitializerPattern2 ( BlockStatement b ) : bool
ReplaceCompilerGeneratedLocalUsedForInitializersPattern ( BlockStatement b ) : bool

The source expression "new C(){ f1 = e1, f2 = e2, ... }" (where the f's can be fields or properties) turns into "cgl = new C(); cgl.f1 = e1; cg1.f2 = e2; ...". ("cgl" means "compiler-generated local".) Turn it into a block expression whose Statements are the statements above (but where the first one becomes a local declaration statement), and with an Expression that is just the local, cgl', where cgl' is a freshly created local.

ReplaceConditionalExpressionPattern ( BlockStatement b ) : bool
ReplaceDupPopPattern ( BlockStatement b ) : bool
ReplacePlusAssignForStringPattern ( BlockStatement b ) : bool

For a string field, s, the source expression e.s += "" turns into a specific pattern. That pattern here looks like: i: push e i+1: push dup.s i+2: (!= dup (default_value string)) ? goto L2 : empty i+3: L1 i+4: pop i+5: push "" i+6: L2 i+7: pop.s = pop

ReplacePostBinopPattern ( BlockStatement b ) : bool
ReplacePropertyBinopPattern ( BlockStatement b ) : bool
ReplacePushDupPopPattern ( BlockStatement b ) : bool
ReplacePushDupPushPopPattern ( BlockStatement b ) : bool
ReplacePushPopPattern ( BlockStatement b, IMetadataHost host ) : bool
ReplacePushPushDupPopPopPattern ( BlockStatement b ) : bool
ReplaceReturnViaGoto ( BlockStatement b ) : bool
ReplaceReturnViaGotoInVoidMethods ( BlockStatement b ) : bool
ReplaceSelfAssignment ( BlockStatement b ) : bool
ReplaceShortCircuitAnd ( BlockStatement b ) : bool
ReplaceShortCircuitAnd2 ( BlockStatement b ) : bool
ReplaceShortCircuitAnd3 ( BlockStatement b ) : bool
ReplaceShortCircuitAnd4 ( BlockStatement b ) : bool
ReplaceShortCircuitAnd5 ( BlockStatement b ) : bool
ReplaceShortCircuitAnd6 ( BlockStatement b ) : bool
ReplaceSingleUseCompilerGeneratedLocalPattern ( BlockStatement b ) : bool
ReplacedCompoundAssignmentViaTempPattern ( BlockStatement b ) : bool
TraverseChildren ( IBlockStatement block ) : void