|
|
@ -484,7 +484,7 @@ namespace ICSharpCode.ILSpy.VB |
|
|
|
ITypeResolveContext CreateResolveContext(ModuleDefinition module) |
|
|
|
ITypeResolveContext CreateResolveContext(ModuleDefinition module) |
|
|
|
{ |
|
|
|
{ |
|
|
|
IProjectContent projectContent = new CecilTypeResolveContext(module); |
|
|
|
IProjectContent projectContent = new CecilTypeResolveContext(module); |
|
|
|
|
|
|
|
|
|
|
|
List<ITypeResolveContext> resolveContexts = new List<ITypeResolveContext>(); |
|
|
|
List<ITypeResolveContext> resolveContexts = new List<ITypeResolveContext>(); |
|
|
|
resolveContexts.Add(projectContent); |
|
|
|
resolveContexts.Add(projectContent); |
|
|
|
foreach (AssemblyNameReference r in module.AssemblyReferences) { |
|
|
|
foreach (AssemblyNameReference r in module.AssemblyReferences) { |
|
|
@ -499,24 +499,20 @@ namespace ICSharpCode.ILSpy.VB |
|
|
|
|
|
|
|
|
|
|
|
string TypeToString(ConvertTypeOptions options, TypeReference type, ICustomAttributeProvider typeAttributes = null) |
|
|
|
string TypeToString(ConvertTypeOptions options, TypeReference type, ICustomAttributeProvider typeAttributes = null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var envProvider = new ILSpyEnvironmentProvider(CreateResolveContext(type.Module)); |
|
|
|
var astType = AstBuilder |
|
|
|
var converter = new CSharpToVBConverterVisitor(envProvider); |
|
|
|
.ConvertType(type, typeAttributes, options) |
|
|
|
var astType = AstBuilder.ConvertType(type, typeAttributes, options); |
|
|
|
.AcceptVisitor(new CSharpToVBConverterVisitor(new ILSpyEnvironmentProvider(CreateResolveContext(type.Resolve().Module))), null); |
|
|
|
|
|
|
|
StringWriter w = new StringWriter(); |
|
|
|
StringWriter w = new StringWriter(); |
|
|
|
// TODO
|
|
|
|
|
|
|
|
// if (type.IsByReference) {
|
|
|
|
if (type.IsByReference) { |
|
|
|
// ParameterDefinition pd = typeAttributes as ParameterDefinition;
|
|
|
|
w.Write("ByRef "); |
|
|
|
// if (pd != null && (!pd.IsIn && pd.IsOut))
|
|
|
|
if (astType is NRefactory.CSharp.ComposedType && ((NRefactory.CSharp.ComposedType)astType).PointerRank > 0) |
|
|
|
// w.Write("out ");
|
|
|
|
((NRefactory.CSharp.ComposedType)astType).PointerRank--; |
|
|
|
// else
|
|
|
|
} |
|
|
|
// w.Write("ref ");
|
|
|
|
|
|
|
|
//
|
|
|
|
var vbAstType = astType.AcceptVisitor(converter, null); |
|
|
|
// if (astType is ComposedType && ((ComposedType)astType).PointerRank > 0)
|
|
|
|
|
|
|
|
// ((ComposedType)astType).PointerRank--;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
astType.AcceptVisitor(new OutputVisitor(w, new VBFormattingOptions()), null); |
|
|
|
vbAstType.AcceptVisitor(new OutputVisitor(w, new VBFormattingOptions()), null); |
|
|
|
return w.ToString(); |
|
|
|
return w.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|