diff options
author | Jb Evain <jb@evain.net> | 2015-04-25 14:52:23 +0300 |
---|---|---|
committer | Jb Evain <jb@evain.net> | 2015-04-25 14:52:23 +0300 |
commit | 73bd4f2fc18d332ee13f895bcc6f5c792f253527 (patch) | |
tree | e8aaf4b1d58b7a97a48ff81f5bb7d9ed0e6227af /rocks | |
parent | 1472815cc068c4264a75a8667da784783a989c0e (diff) | |
parent | 7159774d52f0f28d5bd4731bba1ee65e44167dfc (diff) |
Merge branch 'master' into lowermemuse
Conflicts:
Mono.Cecil.PE/Image.cs
Mono.Cecil/DefaultAssemblyResolver.cs
Mono.Cecil/ModuleDefinition.cs
Test/Mono.Cecil.Tests/Addin.cs
Test/Mono.Cecil.Tests/ImageReadTests.cs
Test/Mono.Cecil.Tests/ImportCecilTests.cs
Test/Mono.Cecil.Tests/ImportReflectionTests.cs
Diffstat (limited to 'rocks')
19 files changed, 80 insertions, 420 deletions
diff --git a/rocks/.gitignore b/rocks/.gitignore deleted file mode 100644 index 3629e37..0000000 --- a/rocks/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -bin -obj -*.suo -*.user -*.pidb -*.userprefs -*.xml diff --git a/rocks/Mono.Cecil.Rocks.csproj b/rocks/Mono.Cecil.Rocks.csproj index 6d34f0b..1fda5b0 100644 --- a/rocks/Mono.Cecil.Rocks.csproj +++ b/rocks/Mono.Cecil.Rocks.csproj @@ -1,107 +1,14 @@ <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\Mono.Cecil.settings" /> <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">net_4_0_Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{FBC6DD59-D09D-499C-B03C-99C1C78FF2AC}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Mono.Cecil.Rocks</RootNamespace> <AssemblyName>Mono.Cecil.Rocks</AssemblyName> - <FileAlignment>512</FileAlignment> - <SignAssembly>true</SignAssembly> - <AssemblyOriginatorKeyFile>..\mono.snk</AssemblyOriginatorKeyFile> + <DefineConstants>$(DefineConstants);INSIDE_ROCKS</DefineConstants> </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>..\bin\net_3_5_Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;INSIDE_ROCKS;NET_3_5</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>..\bin\net_3_5_Release\</OutputPath> - <DefineConstants>TRACE;INSIDE_ROCKS;NET_3_5</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>..\bin\net_4_0_Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;INSIDE_ROCKS;NET_3_5;NET_4_0</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>..\bin\net_4_0_Release\</OutputPath> - <DefineConstants>TRACE;INSIDE_ROCKS;NET_3_5;NET_4_0</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'silverlight_Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>..\bin\silverlight_Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;NET_3_5;NET_4_0;SILVERLIGHT</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'silverlight_Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>..\bin\silverlight_Release\</OutputPath> - <DefineConstants>TRACE;NET_3_5;NET_4_0;SILVERLIGHT</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'winphone_Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>..\bin\winphone_Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;NET_3_5;NET_4_0;SILVERLIGHT;CF</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'winphone_Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>..\bin\winphone_Release\</OutputPath> - <DefineConstants>TRACE;NET_3_5;NET_4_0;SILVERLIGHT;CF</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkProfile>WindowsPhone</TargetFrameworkProfile> - <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <ItemGroup> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - </ItemGroup> <ItemGroup> + <Compile Include="..\ProjectInfo.cs" /> <Compile Include="Mono.Cecil.Rocks\AssemblyInfo.cs" /> <Compile Include="Mono.Cecil.Rocks\MethodDefinitionRocks.cs" /> <Compile Include="Mono.Cecil.Rocks\SecurityDeclarationRocks.cs" /> @@ -119,11 +26,4 @@ </ProjectReference> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> </Project>
\ No newline at end of file diff --git a/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs b/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs index 90543bb..489ddee 100644 --- a/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs +++ b/rocks/Mono.Cecil.Rocks/AssemblyInfo.cs @@ -1,41 +1,16 @@ // -// AssemblyInfo.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; using System.Reflection; -using System.Runtime.InteropServices; [assembly: AssemblyTitle ("Mono.Cecil.Rocks")] -[assembly: AssemblyProduct ("Mono.Cecil")] -[assembly: AssemblyCopyright ("Copyright © 2008 - 2011 Jb Evain")] [assembly: CLSCompliant (false)] -[assembly: ComVisible (false)] - -[assembly: AssemblyVersion ("0.9.5.0")] -[assembly: AssemblyFileVersion ("0.9.5.0")] diff --git a/rocks/Mono.Cecil.Rocks/Functional.cs b/rocks/Mono.Cecil.Rocks/Functional.cs index 0e61b47..bff52e4 100644 --- a/rocks/Mono.Cecil.Rocks/Functional.cs +++ b/rocks/Mono.Cecil.Rocks/Functional.cs @@ -1,29 +1,11 @@ // -// Functional.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; diff --git a/rocks/Mono.Cecil.Rocks/ILParser.cs b/rocks/Mono.Cecil.Rocks/ILParser.cs index 4a5be3b..a6b9383 100644 --- a/rocks/Mono.Cecil.Rocks/ILParser.cs +++ b/rocks/Mono.Cecil.Rocks/ILParser.cs @@ -1,29 +1,11 @@ // -// ILParser.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; diff --git a/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs b/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs index f141f60..2ff43c3 100644 --- a/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs +++ b/rocks/Mono.Cecil.Rocks/MethodBodyRocks.cs @@ -1,29 +1,11 @@ // -// MethodBodyRocks.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; diff --git a/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs b/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs index c2f758d..3ef20a1 100644 --- a/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs +++ b/rocks/Mono.Cecil.Rocks/MethodDefinitionRocks.cs @@ -1,29 +1,11 @@ // -// MethodDefinitionRocks.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; @@ -41,6 +23,8 @@ namespace Mono.Cecil.Rocks { throw new ArgumentNullException ("self"); if (!self.IsVirtual) return self; + if (self.IsNewSlot) + return self; var base_type = ResolveBaseType (self.DeclaringType); while (base_type != null) { diff --git a/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs b/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs index 5aaf73c..756d31f0 100644 --- a/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs +++ b/rocks/Mono.Cecil.Rocks/ModuleDefinitionRocks.cs @@ -1,29 +1,11 @@ // -// ModuleDefinitionRocks.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; diff --git a/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs b/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs index b84696f..e901081 100644 --- a/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs +++ b/rocks/Mono.Cecil.Rocks/SecurityDeclarationRocks.cs @@ -1,29 +1,11 @@ // -// SecurityDeclarationRocks.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // #if !SILVERLIGHT && !CF diff --git a/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs b/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs index 74b7f08..baa88e0 100644 --- a/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs +++ b/rocks/Mono.Cecil.Rocks/TypeDefinitionRocks.cs @@ -1,29 +1,11 @@ // -// TypeDefinitionRocks.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; diff --git a/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs b/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs index 5748b17..c395236 100644 --- a/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs +++ b/rocks/Mono.Cecil.Rocks/TypeReferenceRocks.cs @@ -1,29 +1,11 @@ // -// TypeReferenceRocks.cs -// // Author: // Jb Evain (jbevain@gmail.com) // -// Copyright (c) 2008 - 2011 Jb Evain -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. +// Copyright (c) 2008 - 2015 Jb Evain +// Copyright (c) 2008 - 2011 Novell, Inc. // -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// Licensed under the MIT/X11 license. // using System; diff --git a/rocks/Test/.gitignore b/rocks/Test/.gitignore deleted file mode 100644 index 3629e37..0000000 --- a/rocks/Test/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -bin -obj -*.suo -*.user -*.pidb -*.userprefs -*.xml diff --git a/rocks/Test/Mono.Cecil.Rocks.Tests.csproj b/rocks/Test/Mono.Cecil.Rocks.Tests.csproj index 3e7b8de..4c85ca7 100644 --- a/rocks/Test/Mono.Cecil.Rocks.Tests.csproj +++ b/rocks/Test/Mono.Cecil.Rocks.Tests.csproj @@ -1,73 +1,11 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="..\..\Mono.Cecil.Tests.settings" /> <PropertyGroup> - <Configuration Condition=" '$(Configuration)' == '' ">net_4_0_Debug</Configuration> - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProductVersion>9.0.30729</ProductVersion> - <SchemaVersion>2.0</SchemaVersion> <ProjectGuid>{C6CFD7E1-B855-44DC-B4CE-9CD72984AF52}</ProjectGuid> - <OutputType>Library</OutputType> - <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>Mono.Cecil.Rocks.Tests</RootNamespace> <AssemblyName>Mono.Cecil.Rocks.Tests</AssemblyName> - <FileAlignment>512</FileAlignment> </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\net_3_5_Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;NET_3_5</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_3_5_Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\net_3_5_Release\</OutputPath> - <DefineConstants>TRACE;NET_3_5</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Debug|AnyCPU' "> - <DebugSymbols>true</DebugSymbols> - <DebugType>full</DebugType> - <Optimize>false</Optimize> - <OutputPath>bin\net_4_0_Debug\</OutputPath> - <DefineConstants>DEBUG;TRACE;NET_3_5;NET_4_0</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'net_4_0_Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> - <Optimize>true</Optimize> - <OutputPath>bin\net_4_0_Release\</OutputPath> - <DefineConstants>TRACE;NET_3_5;NET_4_0</DefineConstants> - <ErrorReport>prompt</ErrorReport> - <WarningLevel>4</WarningLevel> - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> - </PropertyGroup> - <ItemGroup> - <Reference Include="nunit.core, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\Test\libs\nunit-2.5.10\nunit.core.dll</HintPath> - </Reference> - <Reference Include="nunit.core.interfaces, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\Test\libs\nunit-2.5.10\nunit.core.interfaces.dll</HintPath> - </Reference> - <Reference Include="nunit.framework, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\Test\libs\nunit-2.5.10\nunit.framework.dll</HintPath> - </Reference> - <Reference Include="System" /> - <Reference Include="System.Core"> - <RequiredTargetFramework>3.5</RequiredTargetFramework> - </Reference> - </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\Mono.Cecil.csproj"> <Project>{D68133BD-1E63-496E-9EDE-4FBDBF77B486}</Project> @@ -83,7 +21,6 @@ </ProjectReference> </ItemGroup> <ItemGroup> - <Compile Include="Mono.Cecil.Tests\Addin.cs" /> <Compile Include="Mono.Cecil.Tests\MethodDefinitionRocksTests.cs" /> <Compile Include="Mono.Cecil.Tests\ModuleDefinitionRocksTests.cs" /> <Compile Include="Mono.Cecil.Tests\SecurityDeclarationRocksTests.cs" /> @@ -96,11 +33,4 @@ <Content Include="Resources\assemblies\decsec-xml.dll" /> </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. - Other similar extension points exist, see Microsoft.Common.targets. - <Target Name="BeforeBuild"> - </Target> - <Target Name="AfterBuild"> - </Target> - --> </Project>
\ No newline at end of file diff --git a/rocks/Test/Mono.Cecil.Tests/Addin.cs b/rocks/Test/Mono.Cecil.Tests/Addin.cs deleted file mode 100644 index 5a9f85f..0000000 --- a/rocks/Test/Mono.Cecil.Tests/Addin.cs +++ /dev/null @@ -1,8 +0,0 @@ -using NUnit.Core.Extensibility; - -namespace Mono.Cecil.Tests { - - [NUnitAddin] - public class CecilRocksAddin : CecilTestAddin { - } -} diff --git a/rocks/Test/Mono.Cecil.Tests/MethodDefinitionRocksTests.cs b/rocks/Test/Mono.Cecil.Tests/MethodDefinitionRocksTests.cs index 2cfe014..4c6e3fb 100644 --- a/rocks/Test/Mono.Cecil.Tests/MethodDefinitionRocksTests.cs +++ b/rocks/Test/Mono.Cecil.Tests/MethodDefinitionRocksTests.cs @@ -11,18 +11,27 @@ namespace Mono.Cecil.Tests { abstract class Foo { public abstract void DoFoo (); + public abstract void DoBar (); } class Bar : Foo { public override void DoFoo () { } + + public override void DoBar () + { + } } class Baz : Bar { public override void DoFoo () { } + + public virtual new void DoBar () + { + } } [Test] @@ -38,6 +47,10 @@ namespace Mono.Cecil.Tests { Assert.AreEqual ("Foo", @base.DeclaringType.Name); Assert.AreEqual (@base, @base.GetBaseMethod ()); + + var new_dobar = baz.GetMethod ("DoBar"); + @base = new_dobar.GetBaseMethod(); + Assert.AreEqual("Baz", @base.DeclaringType.Name); } [Test] diff --git a/rocks/Test/Mono.Cecil.Tests/ModuleDefinitionRocksTests.cs b/rocks/Test/Mono.Cecil.Tests/ModuleDefinitionRocksTests.cs index f172b40..d0f5d01 100644 --- a/rocks/Test/Mono.Cecil.Tests/ModuleDefinitionRocksTests.cs +++ b/rocks/Test/Mono.Cecil.Tests/ModuleDefinitionRocksTests.cs @@ -9,10 +9,11 @@ namespace Mono.Cecil.Tests { [TestFixture] public class ModuleDefinitionRocksTests : BaseTestFixture { - [TestCSharp ("Types.cs")] - public void GetAllTypesTest (ModuleDefinition module) + [Test] + public void GetAllTypesTest () { - var sequence = new [] { + TestCSharp ("Types.cs", module => { + var sequence = new [] { module.GetType ("<Module>"), module.GetType ("Foo"), module.GetType ("Foo/Bar"), @@ -21,7 +22,8 @@ namespace Mono.Cecil.Tests { module.GetType ("Pan"), }; - Assert.IsTrue (sequence.SequenceEqual (module.GetAllTypes ())); + Assert.IsTrue (sequence.SequenceEqual (module.GetAllTypes ())); + }); } } } diff --git a/rocks/Test/Mono.Cecil.Tests/SecurityDeclarationRocksTests.cs b/rocks/Test/Mono.Cecil.Tests/SecurityDeclarationRocksTests.cs index e7efba1..6598df7 100644 --- a/rocks/Test/Mono.Cecil.Tests/SecurityDeclarationRocksTests.cs +++ b/rocks/Test/Mono.Cecil.Tests/SecurityDeclarationRocksTests.cs @@ -9,50 +9,54 @@ namespace Mono.Cecil.Tests { [TestFixture] public class SecurityDeclarationRocksTests : BaseTestFixture { - [TestModule ("decsec-xml.dll")] - public void ToPermissionSetFromPermissionSetAttribute (ModuleDefinition module) + [Test] + public void ToPermissionSetFromPermissionSetAttribute () { - var type = module.GetType ("SubLibrary"); + TestModule ("decsec-xml.dll", module => { + var type = module.GetType ("SubLibrary"); - Assert.IsTrue (type.HasSecurityDeclarations); - Assert.AreEqual (1, type.SecurityDeclarations.Count); + Assert.IsTrue (type.HasSecurityDeclarations); + Assert.AreEqual (1, type.SecurityDeclarations.Count); - var declaration = type.SecurityDeclarations [0]; + var declaration = type.SecurityDeclarations [0]; - var permission_set = declaration.ToPermissionSet (); + var permission_set = declaration.ToPermissionSet (); - Assert.IsNotNull (permission_set); + Assert.IsNotNull (permission_set); - string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe" + string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe" + "t\"\r\nversion=\"1\">\r\n<IPermission class=\"{0}\"\r\nversion=\"1\"\r\nFla" + "gs=\"UnmanagedCode\"/>\r\n</PermissionSet>\r\n"; - permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName); + permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName); - Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ())); + Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ())); + }); } - [TestModule ("decsec-att.dll")] - public void ToPermissionSetFromSecurityAttribute (ModuleDefinition module) + [Test] + public void ToPermissionSetFromSecurityAttribute () { - var type = module.GetType ("SubLibrary"); + TestModule ("decsec-att.dll", module => { + var type = module.GetType ("SubLibrary"); - Assert.IsTrue (type.HasSecurityDeclarations); - Assert.AreEqual (1, type.SecurityDeclarations.Count); + Assert.IsTrue (type.HasSecurityDeclarations); + Assert.AreEqual (1, type.SecurityDeclarations.Count); - var declaration = type.SecurityDeclarations [0]; + var declaration = type.SecurityDeclarations [0]; - var permission_set = declaration.ToPermissionSet (); + var permission_set = declaration.ToPermissionSet (); - Assert.IsNotNull (permission_set); + Assert.IsNotNull (permission_set); - string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe" + string permission_set_value = "<PermissionSet class=\"System.Security.PermissionSe" + "t\"\r\nversion=\"1\">\r\n<IPermission class=\"{0}\"\r\nversion=\"1\"\r\nFla" + "gs=\"UnmanagedCode\"/>\r\n</PermissionSet>\r\n"; - permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName); + permission_set_value = string.Format (permission_set_value, typeof (SecurityPermission).AssemblyQualifiedName); - Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ())); + Assert.AreEqual (Normalize (permission_set_value), Normalize (permission_set.ToXml ().ToString ())); + }); } static string Normalize (string s) diff --git a/rocks/Test/Mono.Cecil.Tests/TypeReferenceRocksTests.cs b/rocks/Test/Mono.Cecil.Tests/TypeReferenceRocksTests.cs index 9f51cb6..7f51f79 100644 --- a/rocks/Test/Mono.Cecil.Tests/TypeReferenceRocksTests.cs +++ b/rocks/Test/Mono.Cecil.Tests/TypeReferenceRocksTests.cs @@ -118,7 +118,7 @@ namespace Mono.Cecil.Tests { static TypeReference GetTypeReference (Type type) { - return ModuleDefinition.ReadModule (typeof (TypeReferenceRocksTests).Module.FullyQualifiedName).Import (type); + return ModuleDefinition.ReadModule (typeof (TypeReferenceRocksTests).Module.FullyQualifiedName).ImportReference (type); } } }
\ No newline at end of file diff --git a/rocks/Test/Resources/cs/Types.cs b/rocks/Test/Resources/cs/Types.cs index ba04655..ba04655 100755..100644 --- a/rocks/Test/Resources/cs/Types.cs +++ b/rocks/Test/Resources/cs/Types.cs |