Browse Source

Merge branch 'master' of git://github.com/icsharpcode/ILSpy into Iconbar

pull/219/head
Eusebiu Marcu 15 years ago
parent
commit
025f024dcf
  1. 2
      ICSharpCode.Decompiler/Ast/AstBuilder.cs
  2. 2
      ICSharpCode.Decompiler/Ast/NameVariables.cs
  3. 2
      ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs
  4. 2
      ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs
  5. 40
      ILSpy/Languages/CSharpLanguage.cs

2
ICSharpCode.Decompiler/Ast/AstBuilder.cs

@ -1159,7 +1159,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -1159,7 +1159,7 @@ namespace ICSharpCode.Decompiler.Ast
MethodImplAttributes implAttributes = methodDefinition.ImplAttributes & ~MethodImplAttributes.CodeTypeMask;
#region DllImportAttribute
if (methodDefinition.HasPInvokeInfo) {
if (methodDefinition.HasPInvokeInfo && methodDefinition.PInvokeInfo != null) {
PInvokeInfo info = methodDefinition.PInvokeInfo;
Ast.Attribute dllImport = CreateNonCustomAttribute(typeof(DllImportAttribute));
dllImport.Arguments.Add(new PrimitiveExpression(info.Module.Name));

2
ICSharpCode.Decompiler/Ast/NameVariables.cs

@ -284,6 +284,8 @@ namespace ICSharpCode.Decompiler.Ast @@ -284,6 +284,8 @@ namespace ICSharpCode.Decompiler.Ast
string GetNameByType(TypeReference type)
{
type = TypeAnalysis.UnpackModifiers(type);
GenericInstanceType git = type as GenericInstanceType;
if (git != null && git.ElementType.FullName == "System.Nullable`1" && git.GenericArguments.Count == 1) {
type = ((GenericInstanceType)type).GenericArguments[0];

2
ICSharpCode.Decompiler/Disassembler/ReflectionDisassembler.cs

@ -124,7 +124,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -124,7 +124,7 @@ namespace ICSharpCode.Decompiler.Disassembler
if ((method.Attributes & MethodAttributes.PInvokeImpl) == MethodAttributes.PInvokeImpl) {
output.Write("pinvokeimpl");
if (method.HasPInvokeInfo) {
if (method.HasPInvokeInfo && method.PInvokeInfo != null) {
PInvokeInfo info = method.PInvokeInfo;
output.Write("(\"" + NRefactory.CSharp.OutputVisitor.ConvertString(info.Module.Name) + "\"");

2
ICSharpCode.Decompiler/ILAst/TypeAnalysis.cs

@ -849,7 +849,7 @@ namespace ICSharpCode.Decompiler.ILAst @@ -849,7 +849,7 @@ namespace ICSharpCode.Decompiler.ILAst
return null;
}
static TypeReference UnpackModifiers(TypeReference type)
internal static TypeReference UnpackModifiers(TypeReference type)
{
while (type is OptionalModifierType || type is RequiredModifierType)
type = ((TypeSpecification)type).ElementType;

40
ILSpy/Languages/CSharpLanguage.cs

@ -235,6 +235,46 @@ namespace ICSharpCode.ILSpy @@ -235,6 +235,46 @@ namespace ICSharpCode.ILSpy
WriteProjectFile(new TextOutputWriter(output), files, assembly.AssemblyDefinition.MainModule);
} else {
base.DecompileAssembly(assembly, output, options);
output.WriteLine();
ModuleDefinition mainModule = assembly.AssemblyDefinition.MainModule;
if (mainModule.EntryPoint != null) {
output.Write("// Entry point: ");
output.WriteReference(mainModule.EntryPoint.DeclaringType.FullName + "." + mainModule.EntryPoint.Name, mainModule.EntryPoint);
output.WriteLine();
}
switch (mainModule.Architecture) {
case TargetArchitecture.I386:
if ((mainModule.Attributes & ModuleAttributes.Required32Bit) == ModuleAttributes.Required32Bit)
output.WriteLine("// Architecture: x86");
else
output.WriteLine("// Architecture: AnyCPU");
break;
case TargetArchitecture.AMD64:
output.WriteLine("// Architecture: x64");
break;
case TargetArchitecture.IA64:
output.WriteLine("// Architecture: Itanium-64");
break;
}
if ((mainModule.Attributes & ModuleAttributes.ILOnly) == 0) {
output.WriteLine("// This assembly contains unmanaged code.");
}
switch (mainModule.Runtime) {
case TargetRuntime.Net_1_0:
output.WriteLine("// Runtime: .NET 1.0");
break;
case TargetRuntime.Net_1_1:
output.WriteLine("// Runtime: .NET 1.1");
break;
case TargetRuntime.Net_2_0:
output.WriteLine("// Runtime: .NET 2.0");
break;
case TargetRuntime.Net_4_0:
output.WriteLine("// Runtime: .NET 4.0");
break;
}
output.WriteLine();
// don't automatically load additional assemblies when an assembly node is selected in the tree view
using (options.FullDecompilation ? null : LoadedAssembly.DisableAssemblyLoad()) {
AstBuilder codeDomBuilder = CreateAstBuilder(options, currentModule: assembly.AssemblyDefinition.MainModule);

Loading…
Cancel
Save