Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/xamarin/NRefactory.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2013-08-08 10:00:05 +0400
committerMike Krüger <mkrueger@xamarin.com>2013-08-08 10:00:05 +0400
commit9c899f84101a20542e4880f24b74cfc46fff49e8 (patch)
tree0532c2f6c4a8fbbd57c4ca57027b83c31d20cf1f /ICSharpCode.NRefactory.IKVM
parent7bc08528fc3eb722c6d9637ad4e1da740cb0a171 (diff)
Fixed failing IKVM loader tests
Diffstat (limited to 'ICSharpCode.NRefactory.IKVM')
-rw-r--r--ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj1
-rw-r--r--ICSharpCode.NRefactory.IKVM/IkvmLoader.cs28
2 files changed, 14 insertions, 15 deletions
diff --git a/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj b/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj
index 9bbeef3b..2d802175 100644
--- a/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj
+++ b/ICSharpCode.NRefactory.IKVM/ICSharpCode.NRefactory.IKVM.csproj
@@ -32,6 +32,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
+ <Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\ICSharpCode.NRefactory\Properties\GlobalAssemblyInfo.cs">
diff --git a/ICSharpCode.NRefactory.IKVM/IkvmLoader.cs b/ICSharpCode.NRefactory.IKVM/IkvmLoader.cs
index 5c24651f..067e4ee4 100644
--- a/ICSharpCode.NRefactory.IKVM/IkvmLoader.cs
+++ b/ICSharpCode.NRefactory.IKVM/IkvmLoader.cs
@@ -39,6 +39,7 @@ using ICSharpCode.NRefactory.TypeSystem.Implementation;
using ICSharpCode.NRefactory.Utils;
using IKVM.Reflection;
using System.IO;
+using System.Linq;
namespace ICSharpCode.NRefactory.TypeSystem
{
@@ -247,26 +248,24 @@ namespace ICSharpCode.NRefactory.TypeSystem
typeIndex++;
return interningProvider.Intern (
new ByReferenceTypeReference (
- CreateTypeReference (
- type.GetElementType (),
- typeAttributes, ref typeIndex)));
+ CreateTypeReference (type.GetElementType (),typeAttributes, ref typeIndex))
+ );
}
if (type.IsPointer) {
typeIndex++;
return interningProvider.Intern (
new PointerTypeReference (
- CreateTypeReference (
- type.GetElementType (),
- typeAttributes, ref typeIndex)));
+ CreateTypeReference (type.GetElementType (), typeAttributes, ref typeIndex))
+ );
}
if (type.IsArray) {
typeIndex++;
return interningProvider.Intern (
new ArrayTypeReference (
- CreateTypeReference (
- type.GetElementType (),
- typeAttributes, ref typeIndex),
- type.GetArrayRank ()));
+ CreateTypeReference (type.GetElementType (), typeAttributes, ref typeIndex),
+ type.GetArrayRank ()
+ )
+ );
}
if (type.IsConstructedGenericType) {
ITypeReference baseType = CreateTypeReference (type.GetGenericTypeDefinition (), typeAttributes, ref typeIndex);
@@ -355,7 +354,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
IConstantValue CreateSimpleConstantValue(ITypeReference type, object value)
{
if (ReferenceEquals (value, Missing.Value))
- return null;
+ return CreateSimpleConstantValue(type, null);
return interningProvider.Intern(new SimpleConstantValue(type, interningProvider.InternValue(value)));
}
#endregion
@@ -406,7 +405,7 @@ namespace ICSharpCode.NRefactory.TypeSystem
return true;
if ((methodDefinition.ReturnParameter.Attributes & ParameterAttributes.HasFieldMarshal) != 0)
return true;
- return methodDefinition.CustomAttributes.Any ();
+ return methodDefinition.CustomAttributes.Any () || methodDefinition.ReturnParameter.CustomAttributes.Any ();
}
static bool HasAnyAttributes(ConstructorInfo methodDefinition)
@@ -531,8 +530,8 @@ namespace ICSharpCode.NRefactory.TypeSystem
if (methodDefinition.ReturnParameter.__TryGetFieldMarshal (out marshalInfo)) {
returnTypeAttributes.Add(ConvertMarshalInfo(marshalInfo));
}
-// TODO: Not needed in ikvm - maybe a work around for a cecil bug ?
-// AddCustomAttributes(methodDefinition.ReturnType.CustomAttributes, returnTypeAttributes);
+
+ AddCustomAttributes(methodDefinition.ReturnParameter.CustomAttributes, returnTypeAttributes);
}
void AddAttributes(ConstructorInfo methodDefinition, IList<IUnresolvedAttribute> attributes, IList<IUnresolvedAttribute> returnTypeAttributes)
@@ -1067,7 +1066,6 @@ namespace ICSharpCode.NRefactory.TypeSystem
}
m.ReturnType = ReadTypeReference(method.ReturnType, typeAttributes: method.ReturnParameter.CustomAttributes);
-
if (HasAnyAttributes(method))
AddAttributes(method, m.Attributes, m.ReturnTypeAttributes);
TranslateModifiers(method, m);