Skip to content

Commit

Permalink
Fixed virtual methods scanning.
Browse files Browse the repository at this point in the history
Added back some system plugs.
  • Loading branch information
jp2masa committed Feb 3, 2017
1 parent 8bcc922 commit 50214ab
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion Cosmos.sln
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ Global
{78AC2B12-8185-4033-80F0-DA5BF874BE5E}.Release|Any CPU.ActiveCfg = Debug|x86
{78AC2B12-8185-4033-80F0-DA5BF874BE5E}.Release|Any CPU.Build.0 = Debug|x86
{0B20C26F-CA92-4D88-8211-EC7B0A261337}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B20C26F-CA92-4D88-8211-EC7B0A261337}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0B20C26F-CA92-4D88-8211-EC7B0A261337}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B20C26F-CA92-4D88-8211-EC7B0A261337}.Release|Any CPU.Build.0 = Release|Any CPU
{F8889473-5866-4913-86AC-8072A1A2558C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down
6 changes: 5 additions & 1 deletion source/Cosmos.IL2CPU/ILScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,11 @@ protected void ScanMethod(MethodBase aMethod, bool aIsPlug, string sourceItem)
var xType = (Type) mItemsList[i];
if (xType.GetTypeInfo().IsSubclassOf(xVirtMethod.DeclaringType) || (xVirtMethod.DeclaringType.GetTypeInfo().IsInterface && xVirtMethod.DeclaringType.GetTypeInfo().IsAssignableFrom(xType)))
{
var xNewMethod = xType.GetTypeInfo().GetMethod(aMethod.Name, xParamTypes, null);
//var xNewMethod = xType.GetTypeInfo().GetMethod(aMethod.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance, null, xParamTypes, null);
var xNewMethod = xType.GetTypeInfo().GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
.Where(method => method.Name == aMethod.Name
&& method.GetParameters().Select(param => param.ParameterType).SequenceEqual(xParamTypes))
.SingleOrDefault();
if (xNewMethod != null)
{
// We need to check IsVirtual, a non virtual could
Expand Down
3 changes: 1 addition & 2 deletions source/Cosmos.System.Plugs/System/ByteImpl.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Cosmos.Common;
using Cosmos.Common;
using Cosmos.IL2CPU.Plugs;

namespace Cosmos.System.Plugs.System
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Cosmos.IL2CPU.Plugs;
using Cosmos.Common;
using Cosmos.IL2CPU.Plugs;

namespace Cosmos.System.Plugs.System
{
Expand All @@ -7,7 +8,7 @@ public static class SByteImpl
{
public static string ToString(ref sbyte aThis)
{
return ((int)(aThis)).ToString();
return StringHelper.GetNumberString(aThis);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ public static int GetHashCodeOfPtr(IntPtr ptr)
throw new NotImplementedException("ValueType.GetHashCodeOfPtr()");
}

public static string ToString(ValueType aThis)
{
return "<ValueType.ToString not yet implemented!>";
}

//public static string ToString(ValueType aThis)
//{
// return "<ValueType.ToString not yet implemented!>";
//}
}

}

0 comments on commit 50214ab

Please sign in to comment.