private bool IsAsyncFirstAssignmentStatement(Statement statement, out TypeDefinition asyncStateMachineType) { asyncStateMachineType = null; if (statement as ExpressionStatement != null) { V_0 = statement as ExpressionStatement; if (V_0.get_Expression() as BinaryExpression != null) { V_1 = V_0.get_Expression() as BinaryExpression; if (V_1.get_Right() as ThisReferenceExpression != null && V_1.get_Left() as FieldReferenceExpression != null) { V_2 = (V_1.get_Left() as FieldReferenceExpression).get_Field().get_DeclaringType(); if (V_2 == null) { return(false); } V_3 = V_2.Resolve(); if (V_3 == null || (object)V_3.get_DeclaringType() != (object)this.methodContext.get_Method().get_DeclaringType() || !V_3.IsAsyncStateMachine()) { return(false); } asyncStateMachineType = V_3; return(true); } } } return(false); }
private void SetParameterMappings() { V_0 = 1; while (V_0 < this.statements.get_Count()) { if (this.statements.get_Item(V_0).get_CodeNodeType() == 5) { V_1 = this.statements.get_Item(V_0) as ExpressionStatement; if (V_1.get_Expression().get_CodeNodeType() == 24 && (V_1.get_Expression() as BinaryExpression).get_IsAssignmentExpression()) { V_2 = V_1.get_Expression() as BinaryExpression; if (V_2.get_Left().get_CodeNodeType() == 30) { V_3 = (V_2.get_Left() as FieldReferenceExpression).get_Field(); if ((object)V_3.get_DeclaringType().Resolve() == (object)this.yieldDeclaringType) { this.parameterMappings.set_Item(V_3.Resolve(), V_2.get_Right()); } } } } V_0 = V_0 + 1; } return; }
public static ICollection <ImplementedMember> GetImplementedProperties(this PropertyReference self) { V_0 = new List <ImplementedMember>(); V_1 = self.Resolve(); if (V_1 == null) { return(V_0); } if (V_1.get_GetMethod() != null) { V_2 = V_1.get_GetMethod().GetImplementedMethods().GetEnumerator(); try { while (V_2.MoveNext()) { V_3 = V_2.get_Current(); V_4 = PropertyDefinitionExtensions.GetMethodDeclaringProperty(V_3.get_Member() as MethodReference); if (V_4 == null) { continue; } V_0.Add(new ImplementedMember(V_3.get_DeclaringType(), V_4)); } } finally { if (V_2 != null) { V_2.Dispose(); } } return(V_0); } if (V_1.get_SetMethod() == null) { return(V_0); } V_2 = V_1.get_SetMethod().GetImplementedMethods().GetEnumerator(); try { while (V_2.MoveNext()) { V_5 = V_2.get_Current(); V_6 = PropertyDefinitionExtensions.GetMethodDeclaringProperty(V_5.get_Member() as MethodReference); if (V_6 == null) { continue; } V_0.Add(new ImplementedMember(V_5.get_DeclaringType(), V_6)); } } finally { if (V_2 != null) { V_2.Dispose(); } } return(V_0); }
private bool TryGetStateField(BlockStatement theCatch) { V_0 = theCatch.get_Statements().GetEnumerator(); try { while (V_0.MoveNext()) { V_1 = V_0.get_Current(); if (!V_1.IsAssignmentStatement()) { continue; } V_2 = (V_1 as ExpressionStatement).get_Expression() as BinaryExpression; if (V_2.get_Left().get_CodeNodeType() != 30 || V_2.get_Right().get_CodeNodeType() != 22) { continue; } V_3 = (V_2.get_Left() as FieldReferenceExpression).get_Field().Resolve(); if (V_3 == null || V_3.get_DeclaringType() == null) { V_4 = false; goto Label1; } else { if ((object)V_3.get_DeclaringType().Resolve() == (object)this.stateMachineTypeDef) { this.asyncData.set_StateField(V_3); V_4 = true; goto Label1; } else { V_4 = false; goto Label1; } } } goto Label0; } finally { if (V_0 != null) { V_0.Dispose(); } } Label1: return(V_4); Label0: return(false); }
public BlockStatement Process(DecompilationContext context, BlockStatement body) { V_0 = context.get_MethodContext().get_Method(); if (String.op_Equality(V_0.get_Name(), "Finalize") && V_0.get_IsVirtual() && body.get_Statements().get_Count() == 1 && body.get_Statements().get_Item(0) as TryStatement != null) { V_1 = body.get_Statements().get_Item(0) as TryStatement; if (V_1.get_Finally() != null && V_1.get_Finally().get_Body().get_Statements().get_Count() == 1 && V_1.get_Finally().get_Body().get_Statements().get_Item(0) as ExpressionStatement != null) { V_2 = V_1.get_Finally().get_Body().get_Statements().get_Item(0) as ExpressionStatement; if (V_2.get_Expression() as MethodInvocationExpression != null) { V_3 = (V_2.get_Expression() as MethodInvocationExpression).get_MethodExpression().get_MethodDefinition(); if (V_3 != null && String.op_Equality(V_3.get_Name(), "Finalize") && String.op_Equality(V_3.get_DeclaringType().get_FullName(), V_0.get_DeclaringType().get_BaseType().get_FullName())) { context.get_MethodContext().set_IsDestructor(true); stackVariable71 = context.get_MethodContext(); stackVariable72 = new BlockStatement(); stackVariable72.set_Statements(V_1.get_Try().get_Statements()); stackVariable71.set_DestructorStatements(stackVariable72); } } } } return(body); }
private DecompiledType GetDecompiledType(IMemberDefinition member, ILanguage language) { V_0 = Utilities.GetDeclaringTypeOrSelf(member); V_1 = new DecompiledType(V_0); V_2 = new Queue <IMemberDefinition>(); V_2.Enqueue(member); Label0: while (V_2.get_Count() > 0) { V_3 = V_2.Dequeue(); if (V_3 as TypeDefinition != null && (object)V_3 == (object)member) { V_4 = Utilities.GetTypeMembers(V_3 as TypeDefinition, language, true, null, null, null, V_1.get_TypeContext().GetFieldToPropertyMap(language).get_Keys()).GetEnumerator(); try { while (V_4.MoveNext()) { V_5 = V_4.get_Current(); V_2.Enqueue(V_5); } } finally { ((IDisposable)V_4).Dispose(); } } if (V_3 as MethodDefinition != null) { this.DecompileMember(V_3 as MethodDefinition, language, V_1); } if (V_3 as EventDefinition != null) { V_6 = V_3 as EventDefinition; if ((new AutoImplementedEventMatcher(V_6, language)).IsAutoImplemented()) { dummyVar0 = V_1.get_TypeContext().get_AutoImplementedEvents().Add(V_6); } if (V_6.get_AddMethod() != null) { this.DecompileMember(V_6.get_AddMethod(), language, V_1); } if (V_6.get_RemoveMethod() != null) { this.DecompileMember(V_6.get_RemoveMethod(), language, V_1); } if (V_6.get_InvokeMethod() != null) { this.DecompileMember(V_6.get_InvokeMethod(), language, V_1); } } if (V_3 as PropertyDefinition != null) { V_7 = V_3 as PropertyDefinition; stackVariable52 = new PropertyDecompiler(V_7, language, this.renameInvalidMembers, this.cacheService, V_1.get_TypeContext()); stackVariable52.add_ExceptionThrown(new EventHandler <Exception>(this.OnExceptionThrown)); stackVariable52.Decompile(out V_8, out V_9, out V_10); stackVariable52.remove_ExceptionThrown(new EventHandler <Exception>(this.OnExceptionThrown)); if (V_10) { dummyVar1 = V_1.get_TypeContext().get_AutoImplementedProperties().Add(V_7); } if (V_8 != null) { this.AddDecompiledMemberToDecompiledType(V_8, V_1); } if (V_9 != null) { this.AddDecompiledMemberToDecompiledType(V_9, V_1); } V_11 = stackVariable52.get_ExceptionsWhileDecompiling().GetEnumerator(); try { while (V_11.MoveNext()) { V_12 = V_11.get_Current(); this.get_ExceptionsWhileDecompiling().Add(V_12); } } finally { if (V_11 != null) { V_11.Dispose(); } } } if (V_3 as FieldDefinition == null) { continue; } V_13 = V_3 as FieldDefinition; V_14 = V_3.get_DeclaringType().get_Methods().GetEnumerator(); try { while (V_14.MoveNext()) { V_15 = V_14.get_Current(); if (!V_15.get_IsConstructor() || V_13.get_IsStatic() != V_15.get_IsStatic()) { continue; } this.DecompileConstructorChain(V_15, language, V_1); goto Label0; } } finally { V_14.Dispose(); } } V_1.get_TypeContext().set_ExplicitlyImplementedMembers(this.GetExplicitlyImplementedInterfaceMethods(V_0, language)); this.AddGeneratedFilterMethodsToDecompiledType(V_1, V_1.get_TypeContext(), language); return(V_1); }