Browse Source

Add refanytype and refanyval to type analysis.

pull/150/head
Daniel Grunwald 14 years ago
parent
commit
d8fc41e7a9
  1. 2
      ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs
  2. 10
      ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs

2
ICSharpCode.Decompiler/Ast/Transforms/PatternStatementTransform.cs

@ -416,7 +416,7 @@ namespace ICSharpCode.Decompiler.Ast.Transforms @@ -416,7 +416,7 @@ namespace ICSharpCode.Decompiler.Ast.Transforms
if (declarationPoint != foreachStatement) {
// oops, the enumerator variable can't be moved into the foreach loop
// Undo our AST changes:
((BlockStatement)foreachStatement.Parent).Statements.InsertBefore(foreachStatement, node);
((BlockStatement)foreachStatement.Parent).Statements.InsertBefore(foreachStatement, node.Detach());
foreachStatement.ReplaceWith(tryCatch);
return null;
}

10
ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs

@ -458,6 +458,16 @@ namespace ICSharpCode.Decompiler.ILAst @@ -458,6 +458,16 @@ namespace ICSharpCode.Decompiler.ILAst
InferTypeForExpression(expr.Arguments[0], (TypeReference)expr.Operand);
}
return typeSystem.TypedReference;
case ILCode.Refanytype:
if (forceInferChildren) {
InferTypeForExpression(expr.Arguments[0], typeSystem.TypedReference);
}
return new TypeReference("System", "RuntimeTypeHandle", module, module, true);
case ILCode.Refanyval:
if (forceInferChildren) {
InferTypeForExpression(expr.Arguments[0], typeSystem.TypedReference);
}
return new ByReferenceType((TypeReference)expr.Operand);
#endregion
#region Arithmetic instructions
case ILCode.Not: // bitwise complement

Loading…
Cancel
Save