diff --git a/source/Cosmos.sln b/source/Cosmos.sln index 639e0abe9..7e60e1f04 100644 --- a/source/Cosmos.sln +++ b/source/Cosmos.sln @@ -543,6 +543,7 @@ Global {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Debug|Any CPU.Build.0 = Debug|Any CPU {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Debug|x86.ActiveCfg = Debug|Any CPU + {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Debug|x86.Build.0 = Debug|Any CPU {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Release|Any CPU.ActiveCfg = Release|Any CPU {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Release|Any CPU.Build.0 = Release|Any CPU {AE684C98-F100-47AE-9C8C-E71BF8C9F8AA}.Release|x86.ActiveCfg = Release|Any CPU @@ -552,6 +553,7 @@ Global {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Debug|Any CPU.Build.0 = Debug|Any CPU {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Debug|x86.ActiveCfg = Debug|Any CPU + {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Debug|x86.Build.0 = Debug|Any CPU {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Release|Any CPU.ActiveCfg = Release|Any CPU {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Release|Any CPU.Build.0 = Release|Any CPU {54795C40-B3E8-4DBB-A3DE-FACBADD20ADB}.Release|x86.ActiveCfg = Release|Any CPU @@ -561,6 +563,7 @@ Global {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Debug|x86.ActiveCfg = Debug|Any CPU + {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Debug|x86.Build.0 = Debug|Any CPU {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Release|Any CPU.ActiveCfg = Release|Any CPU {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Release|Any CPU.Build.0 = Release|Any CPU {FD4B2006-B518-4884-B196-C2EF2B83FD6F}.Release|x86.ActiveCfg = Release|Any CPU @@ -570,6 +573,7 @@ Global {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Debug|Any CPU.Build.0 = Debug|Any CPU {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Debug|x86.ActiveCfg = Debug|Any CPU + {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Debug|x86.Build.0 = Debug|Any CPU {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Release|Any CPU.ActiveCfg = Release|Any CPU {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Release|Any CPU.Build.0 = Release|Any CPU {0D162A82-CBC1-4A39-916D-E1079B212DDE}.Release|x86.ActiveCfg = Release|Any CPU @@ -579,6 +583,7 @@ Global {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Debug|Any CPU.Build.0 = Debug|Any CPU {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Debug|x86.ActiveCfg = Debug|Any CPU + {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Debug|x86.Build.0 = Debug|Any CPU {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Release|Any CPU.ActiveCfg = Release|Any CPU {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Release|Any CPU.Build.0 = Release|Any CPU {47B9E5D3-A800-4402-AD6A-315FAF4E82F4}.Release|x86.ActiveCfg = Release|Any CPU @@ -588,6 +593,7 @@ Global {B47ED632-1ACE-4516-9576-81E38BA092F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B47ED632-1ACE-4516-9576-81E38BA092F1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B47ED632-1ACE-4516-9576-81E38BA092F1}.Debug|x86.ActiveCfg = Debug|Any CPU + {B47ED632-1ACE-4516-9576-81E38BA092F1}.Debug|x86.Build.0 = Debug|Any CPU {B47ED632-1ACE-4516-9576-81E38BA092F1}.Release|Any CPU.ActiveCfg = Release|Any CPU {B47ED632-1ACE-4516-9576-81E38BA092F1}.Release|Any CPU.Build.0 = Release|Any CPU {B47ED632-1ACE-4516-9576-81E38BA092F1}.Release|x86.ActiveCfg = Release|Any CPU @@ -597,6 +603,7 @@ Global {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Debug|Any CPU.Build.0 = Debug|Any CPU {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Debug|x86.ActiveCfg = Debug|Any CPU + {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Debug|x86.Build.0 = Debug|Any CPU {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Release|Any CPU.ActiveCfg = Release|Any CPU {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Release|Any CPU.Build.0 = Release|Any CPU {7A24BC15-49A3-43AF-AF2B-3681D9A06C62}.Release|x86.ActiveCfg = Release|Any CPU @@ -606,6 +613,7 @@ Global {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Debug|Any CPU.Build.0 = Debug|Any CPU {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Debug|x86.ActiveCfg = Debug|Any CPU + {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Debug|x86.Build.0 = Debug|Any CPU {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Release|Any CPU.ActiveCfg = Release|Any CPU {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Release|Any CPU.Build.0 = Release|Any CPU {8612AC0F-6C80-4F14-AFFA-7A96AFF18A6D}.Release|x86.ActiveCfg = Release|Any CPU diff --git a/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/Dump.cs b/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/Dump.cs index 2cae3fec8..fab4ec81f 100644 --- a/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/Dump.cs +++ b/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/Dump.cs @@ -89,7 +89,13 @@ namespace EcmaCil #endif //output.WriteAttributeString("FullName", method.Name); output.WriteAttributeString("IsStatic", method.IsStatic.ToString()); + output.WriteAttributeString("IsVirtual", method.IsVirtual.ToString()); + output.WriteAttributeString("StartsNewVirtualTree", method.StartsNewVirtualTree.ToString()); #if DEBUG + if (method.Overrides!=null) + { + output.WriteAttributeString("Overrides", (string)method.Overrides.Data[DataIds.DebugMetaId]); + } if (method.ReturnType != null) { output.WriteAttributeString("ReturnType", (string)method.ReturnType.Data[DataIds.DebugMetaId]); diff --git a/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/MethodMeta.cs b/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/MethodMeta.cs index 2a3361251..3cbdd7c9e 100644 --- a/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/MethodMeta.cs +++ b/source2/Users/Matthijs ter Woord/Testing/IRs/EcmaCil/MethodMeta.cs @@ -30,8 +30,14 @@ namespace EcmaCil set; } + public bool IsVirtual + { + get; + set; + } + /// - /// Specifies whether the method is a base method. in c# it's defined by: "public virtual void", or "public new virtual void.." + /// Specifies whether the method is a base method. in c# it's defined by: "virtual void", or "new virtual void.." /// public bool StartsNewVirtualTree { diff --git a/source2/Users/Matthijs ter Woord/Testing/ReflectionToEcmaCil/Reader.Scanning.cs b/source2/Users/Matthijs ter Woord/Testing/ReflectionToEcmaCil/Reader.Scanning.cs index 484f3d745..1a29687f0 100644 --- a/source2/Users/Matthijs ter Woord/Testing/ReflectionToEcmaCil/Reader.Scanning.cs +++ b/source2/Users/Matthijs ter Woord/Testing/ReflectionToEcmaCil/Reader.Scanning.cs @@ -38,6 +38,8 @@ namespace ReflectionToEcmaCil #if DEBUG aMethodMeta.Data[EcmaCil.DataIds.DebugMetaId] = aMethod.Method.GetFullName(); #endif + aMethodMeta.IsVirtual = aMethod.Method.IsVirtual; + aMethodMeta.StartsNewVirtualTree = aMethodMeta.IsVirtual && ((aMethod.Method.Attributes & MethodAttributes.NewSlot) == MethodAttributes.NewSlot); var xParamOffset = 0; if (!aMethod.Method.IsStatic) { @@ -89,94 +91,6 @@ namespace ReflectionToEcmaCil } aMethodMeta.IsStatic = aMethod.Method.IsStatic; ScanMethodBody(aMethod, aMethodMeta); - #region temporary disabled - - //#region Virtuals scan - //if (aMethod.Method.IsVirtual) - //{ - // // For virtuals we need to climb up the type tree - // // and find the top base method. We then add that top - // // node to the mVirtuals list. We don't need to add the - // // types becuase adding DeclaringType will already cause - // // all ancestor types to be added. - - // var xVirtMethod = aMethod.Method; - // TypeReference xVirtType = aMethod.Method.DeclaringType; - - // xVirtMethod = xVirtMethod.GetOriginalBaseMethod(); - // #region old code - // // MethodReference xNewVirtMethod = null; - // // while (true) - // // { - // // var xNewVirtType = xVirtType.Resolve(); - // // if (xNewVirtType.HasGenericParameters) - // // { - // // throw new Exception("Generics not fully supported yet!"); - // // } - // // if (xNewVirtType == null) - // // { - // // xVirtType = null; - // // } - // // else - // // { - // //#warning // todo: verify if next code works ok with generics - // // var xTempNewVirtMethod = xNewVirtType. .m.Methods..GetMethod(aMethod.Method.Name, aMethod.Method.Parameters); - // // if (xTempNewVirtMethod !=null) - // // { - // // if (xTempNewVirtMethod.IsVirtual) - // // { - // // xNewVirtMethod = xTempNewVirtMethod; - // // } - // // } - // // else - // // { - // // xNewVirtMethod = null; - // // } - // // } - // // if (xNewVirtMethod == null) - // // { - // // if (mVirtuals.ContainsKey(aMethod)) - // // { - // // xVirtMethod = null; - // // } - // // break; - // // } - // // xVirtMethod = xNewVirtMethod.Resolve(); - // // xVirtType = xNewVirtType.BaseType; - // // if (xVirtType == null) - // // { - // // break; - // // } - // // } - // #endregion old code - // if (xVirtMethod != null) - // { - // EnqueueMethod(xVirtMethod, aMethod, "Virtual Base"); - - // foreach (var xType in mTypes) - // { - // if (xType.Key.Type.IsSubclassOf(xVirtMethod.DeclaringType)) - // { - // //xType.Key.Type.res - // //var xNewMethod = xType.Key.Type.Methods.GetMethod(aMethod.Method.Name, aMethod.Method.Parameters); - // //if (xNewMethod != null) - // //{ - // // // We need to check IsVirtual, a non virtual could - // // // "replace" a virtual above it? - // // // MtW: correct - // // if (xNewMethod.IsVirtual) - // // { - // // EnqueueMethod(xNewMethod, aMethod, "Virtual Downscan"); - // // } - // //} - // throw new NotImplementedException(); - // } - // } - // } - - //} - //#endregion - #endregion } protected virtual void ScanMethodBody(QueuedMethod aMethod, EcmaCil.MethodMeta aMethodMeta)