You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
7
external/cecil/rocks/.gitignore
vendored
7
external/cecil/rocks/.gitignore
vendored
@@ -1,7 +0,0 @@
|
||||
bin
|
||||
obj
|
||||
*.suo
|
||||
*.user
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*.xml
|
||||
118
external/cecil/rocks/Mono.Cecil.Rocks.csproj
vendored
118
external/cecil/rocks/Mono.Cecil.Rocks.csproj
vendored
@@ -1,116 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<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>
|
||||
</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>
|
||||
<DefineConstants>$(DefineConstants);INSIDE_ROCKS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Mono.Cecil.Rocks\AssemblyInfo.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\MethodDefinitionRocks.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\SecurityDeclarationRocks.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\MethodBodyRocks.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\ILParser.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\TypeReferenceRocks.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\Functional.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\ModuleDefinitionRocks.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\TypeDefinitionRocks.cs" />
|
||||
<Compile Include="..\ProjectInfo.cs" />
|
||||
<Compile Include="Mono.Cecil.Rocks\*.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Mono.Cecil.csproj">
|
||||
@@ -118,12 +16,6 @@
|
||||
<Name>Mono.Cecil</Name>
|
||||
</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>
|
||||
-->
|
||||
<Import Project="..\Mono.Cecil.props" />
|
||||
<Import Project="$(MSBuildCSharpTargets)" />
|
||||
</Project>
|
||||
@@ -1,41 +1,16 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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")]
|
||||
|
||||
264
external/cecil/rocks/Mono.Cecil.Rocks/DocCommentId.cs
vendored
Normal file
264
external/cecil/rocks/Mono.Cecil.Rocks/DocCommentId.cs
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Cecil.Rocks {
|
||||
|
||||
public class DocCommentId
|
||||
{
|
||||
StringBuilder id;
|
||||
|
||||
DocCommentId ()
|
||||
{
|
||||
id = new StringBuilder ();
|
||||
}
|
||||
|
||||
void WriteField (FieldDefinition field)
|
||||
{
|
||||
WriteDefinition ('F', field);
|
||||
}
|
||||
|
||||
void WriteEvent (EventDefinition @event)
|
||||
{
|
||||
WriteDefinition ('E', @event);
|
||||
}
|
||||
|
||||
void WriteType (TypeDefinition type)
|
||||
{
|
||||
id.Append ('T').Append (':');
|
||||
WriteTypeFullName (type);
|
||||
}
|
||||
|
||||
void WriteMethod (MethodDefinition method)
|
||||
{
|
||||
WriteDefinition ('M', method);
|
||||
|
||||
if (method.HasGenericParameters) {
|
||||
id.Append ('`').Append ('`');
|
||||
id.Append (method.GenericParameters.Count);
|
||||
}
|
||||
|
||||
if (method.HasParameters)
|
||||
WriteParameters (method.Parameters);
|
||||
|
||||
if (IsConversionOperator (method))
|
||||
WriteReturnType (method);
|
||||
}
|
||||
|
||||
static bool IsConversionOperator (MethodDefinition self)
|
||||
{
|
||||
if (self == null)
|
||||
throw new ArgumentNullException ("self");
|
||||
|
||||
return self.IsSpecialName
|
||||
&& (self.Name == "op_Explicit" || self.Name == "op_Implicit");
|
||||
}
|
||||
|
||||
void WriteReturnType (MethodDefinition method)
|
||||
{
|
||||
id.Append ('~');
|
||||
WriteTypeSignature (method.ReturnType);
|
||||
}
|
||||
|
||||
void WriteProperty (PropertyDefinition property)
|
||||
{
|
||||
WriteDefinition ('P', property);
|
||||
|
||||
if (property.HasParameters)
|
||||
WriteParameters (property.Parameters);
|
||||
}
|
||||
|
||||
void WriteParameters (IList<ParameterDefinition> parameters)
|
||||
{
|
||||
id.Append ('(');
|
||||
WriteList (parameters, p => WriteTypeSignature (p.ParameterType));
|
||||
id.Append (')');
|
||||
}
|
||||
|
||||
void WriteTypeSignature (TypeReference type)
|
||||
{
|
||||
switch (type.MetadataType)
|
||||
{
|
||||
case MetadataType.Array:
|
||||
WriteArrayTypeSignature ((ArrayType) type);
|
||||
break;
|
||||
case MetadataType.ByReference:
|
||||
WriteTypeSignature (((ByReferenceType) type).ElementType);
|
||||
id.Append ('@');
|
||||
break;
|
||||
case MetadataType.FunctionPointer:
|
||||
WriteFunctionPointerTypeSignature ((FunctionPointerType) type);
|
||||
break;
|
||||
case MetadataType.GenericInstance:
|
||||
WriteGenericInstanceTypeSignature ((GenericInstanceType) type);
|
||||
break;
|
||||
case MetadataType.Var:
|
||||
id.Append ('`');
|
||||
id.Append (((GenericParameter) type).Position);
|
||||
break;
|
||||
case MetadataType.MVar:
|
||||
id.Append ('`').Append ('`');
|
||||
id.Append (((GenericParameter) type).Position);
|
||||
break;
|
||||
case MetadataType.OptionalModifier:
|
||||
WriteModiferTypeSignature ((RequiredModifierType) type, '!');
|
||||
break;
|
||||
case MetadataType.RequiredModifier:
|
||||
WriteModiferTypeSignature ((RequiredModifierType) type, '|');
|
||||
break;
|
||||
case MetadataType.Pointer:
|
||||
WriteTypeSignature (((PointerType) type).ElementType);
|
||||
id.Append ('*');
|
||||
break;
|
||||
default:
|
||||
WriteTypeFullName (type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void WriteGenericInstanceTypeSignature (GenericInstanceType type)
|
||||
{
|
||||
if (type.ElementType.IsTypeSpecification ())
|
||||
throw new NotSupportedException ();
|
||||
|
||||
WriteTypeFullName (type.ElementType, stripGenericArity: true);
|
||||
id.Append ('{');
|
||||
WriteList (type.GenericArguments, WriteTypeSignature);
|
||||
id.Append ('}');
|
||||
}
|
||||
|
||||
void WriteList<T> (IList<T> list, Action<T> action)
|
||||
{
|
||||
for (int i = 0; i < list.Count; i++) {
|
||||
if (i > 0)
|
||||
id.Append (',');
|
||||
|
||||
action (list [i]);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteModiferTypeSignature (IModifierType type, char id)
|
||||
{
|
||||
WriteTypeSignature (type.ElementType);
|
||||
this.id.Append (id);
|
||||
WriteTypeSignature (type.ModifierType);
|
||||
}
|
||||
|
||||
void WriteFunctionPointerTypeSignature (FunctionPointerType type)
|
||||
{
|
||||
id.Append ("=FUNC:");
|
||||
WriteTypeSignature (type.ReturnType);
|
||||
|
||||
if (type.HasParameters)
|
||||
WriteParameters (type.Parameters);
|
||||
}
|
||||
|
||||
void WriteArrayTypeSignature (ArrayType type)
|
||||
{
|
||||
WriteTypeSignature (type.ElementType);
|
||||
|
||||
if (type.IsVector) {
|
||||
id.Append ("[]");
|
||||
return;
|
||||
}
|
||||
|
||||
id.Append ("[");
|
||||
|
||||
WriteList (type.Dimensions, dimension => {
|
||||
if (dimension.LowerBound.HasValue)
|
||||
id.Append (dimension.LowerBound.Value);
|
||||
|
||||
id.Append (':');
|
||||
|
||||
if (dimension.UpperBound.HasValue)
|
||||
id.Append (dimension.UpperBound.Value - (dimension.LowerBound.GetValueOrDefault () + 1));
|
||||
});
|
||||
|
||||
id.Append ("]");
|
||||
}
|
||||
|
||||
void WriteDefinition (char id, IMemberDefinition member)
|
||||
{
|
||||
this.id.Append (id)
|
||||
.Append (':');
|
||||
|
||||
WriteTypeFullName (member.DeclaringType);
|
||||
this.id.Append ('.');
|
||||
WriteItemName (member.Name);
|
||||
}
|
||||
|
||||
void WriteTypeFullName (TypeReference type, bool stripGenericArity = false)
|
||||
{
|
||||
if (type.DeclaringType != null) {
|
||||
WriteTypeFullName (type.DeclaringType);
|
||||
id.Append ('.');
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty (type.Namespace)) {
|
||||
id.Append (type.Namespace);
|
||||
id.Append ('.');
|
||||
}
|
||||
|
||||
var name = type.Name;
|
||||
|
||||
if (stripGenericArity) {
|
||||
var index = name.LastIndexOf ('`');
|
||||
if (index > 0)
|
||||
name = name.Substring (0, index);
|
||||
}
|
||||
|
||||
id.Append (name);
|
||||
}
|
||||
|
||||
void WriteItemName (string name)
|
||||
{
|
||||
id.Append (name.Replace ('.', '#'));
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return id.ToString ();
|
||||
}
|
||||
|
||||
public static string GetDocCommentId (IMemberDefinition member)
|
||||
{
|
||||
if (member == null)
|
||||
throw new ArgumentNullException ("member");
|
||||
|
||||
var documentId = new DocCommentId ();
|
||||
|
||||
switch (member.MetadataToken.TokenType)
|
||||
{
|
||||
case TokenType.Field:
|
||||
documentId.WriteField ((FieldDefinition) member);
|
||||
break;
|
||||
case TokenType.Method:
|
||||
documentId.WriteMethod ((MethodDefinition) member);
|
||||
break;
|
||||
case TokenType.TypeDef:
|
||||
documentId.WriteType ((TypeDefinition) member);
|
||||
break;
|
||||
case TokenType.Event:
|
||||
documentId.WriteEvent ((EventDefinition) member);
|
||||
break;
|
||||
case TokenType.Property:
|
||||
documentId.WriteProperty ((PropertyDefinition) member);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException (member.FullName);
|
||||
}
|
||||
|
||||
return documentId.ToString ();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// Functional.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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;
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// ILParser.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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;
|
||||
@@ -79,8 +61,6 @@ namespace Mono.Cecil.Rocks {
|
||||
var context = CreateContext (method, visitor);
|
||||
var code = context.Code;
|
||||
|
||||
code.MoveTo (method.RVA);
|
||||
|
||||
var flags = code.ReadByte ();
|
||||
|
||||
switch (flags & 0x3) {
|
||||
@@ -89,7 +69,7 @@ namespace Mono.Cecil.Rocks {
|
||||
ParseCode (code_size, context);
|
||||
break;
|
||||
case 0x3: // fat
|
||||
code.position--;
|
||||
code.Advance (-1);
|
||||
ParseFatMethod (context);
|
||||
break;
|
||||
default:
|
||||
@@ -99,7 +79,8 @@ namespace Mono.Cecil.Rocks {
|
||||
|
||||
static ParseContext CreateContext (MethodDefinition method, IILVisitor visitor)
|
||||
{
|
||||
var code = method.Module.Read (method, (_, reader) => new CodeReader (reader.image.MetadataSection, reader));
|
||||
var code = method.Module.Read (method, (_, reader) => reader.code);
|
||||
code.MoveTo (method);
|
||||
|
||||
return new ParseContext {
|
||||
Code = code,
|
||||
@@ -128,10 +109,10 @@ namespace Mono.Cecil.Rocks {
|
||||
var metadata = context.Metadata;
|
||||
var visitor = context.Visitor;
|
||||
|
||||
var start = code.position;
|
||||
var start = code.Position;
|
||||
var end = start + code_size;
|
||||
|
||||
while (code.position < end) {
|
||||
while (code.Position < end) {
|
||||
var il_opcode = code.ReadByte ();
|
||||
var opcode = il_opcode != 0xfe
|
||||
? OpCodes.OneByteOpCode [il_opcode]
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// MethodBodyRocks.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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;
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// MethodDefinitionRocks.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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) {
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// ModuleDefinitionRocks.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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;
|
||||
|
||||
@@ -1,32 +1,12 @@
|
||||
//
|
||||
// SecurityDeclarationRocks.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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:
|
||||
// Licensed under the MIT/X11 license.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#if !SILVERLIGHT && !CF
|
||||
|
||||
using System;
|
||||
using System.Security;
|
||||
@@ -170,5 +150,3 @@ namespace Mono.Cecil.Rocks {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// TypeDefinitionRocks.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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;
|
||||
|
||||
@@ -1,29 +1,11 @@
|
||||
//
|
||||
// TypeReferenceRocks.cs
|
||||
//
|
||||
// Author:
|
||||
// Jb Evain (jbevain@gmail.com)
|
||||
//
|
||||
// Copyright (c) 2008 - 2011 Jb Evain
|
||||
// Copyright (c) 2008 - 2015 Jb Evain
|
||||
// Copyright (c) 2008 - 2011 Novell, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// 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;
|
||||
|
||||
7
external/cecil/rocks/Test/.gitignore
vendored
7
external/cecil/rocks/Test/.gitignore
vendored
@@ -1,7 +0,0 @@
|
||||
bin
|
||||
obj
|
||||
*.suo
|
||||
*.user
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*.xml
|
||||
@@ -1,73 +1,10 @@
|
||||
<?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">
|
||||
<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">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Test\libs\nunit-2.6.2\nunit.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.core.interfaces">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Test\libs\nunit-2.6.2\nunit.core.interfaces.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Test\libs\nunit-2.6.2\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,24 +20,11 @@
|
||||
</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" />
|
||||
<Compile Include="Mono.Cecil.Tests\TypeDefinitionRocksTests.cs" />
|
||||
<Compile Include="Mono.Cecil.Tests\TypeReferenceRocksTests.cs" />
|
||||
<Content Include="Resources\cs\Types.cs" />
|
||||
<Compile Include="Mono.Cecil.Tests\*.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\assemblies\decsec-att.dll" />
|
||||
<Content Include="Resources\assemblies\decsec-xml.dll" />
|
||||
<None Include="Resources\**\*" />
|
||||
</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>
|
||||
-->
|
||||
<Import Project="..\..\Mono.Cecil.Tests.props" />
|
||||
<Import Project="$(MSBuildCSharpTargets)" />
|
||||
</Project>
|
||||
@@ -1,8 +0,0 @@
|
||||
using NUnit.Core.Extensibility;
|
||||
|
||||
namespace Mono.Cecil.Tests {
|
||||
|
||||
[NUnitAddin]
|
||||
public class CecilRocksAddin : CecilTestAddin {
|
||||
}
|
||||
}
|
||||
264
external/cecil/rocks/Test/Mono.Cecil.Tests/DocCommentIdTests.cs
vendored
Normal file
264
external/cecil/rocks/Test/Mono.Cecil.Tests/DocCommentIdTests.cs
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using Mono.Cecil.Rocks;
|
||||
|
||||
namespace N
|
||||
{
|
||||
/// <summary>
|
||||
/// ID string generated is "T:N.X".
|
||||
/// </summary>
|
||||
public class X
|
||||
{
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.#ctor".
|
||||
/// </summary>
|
||||
public X() { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.#ctor(System.Int32)".
|
||||
/// </summary>
|
||||
/// <param name="i">Describe parameter.</param>
|
||||
public X(int i) { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "F:N.X.q".
|
||||
/// </summary>
|
||||
public string q;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "F:N.X.PI".
|
||||
/// </summary>
|
||||
public const double PI = 3.14;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.f".
|
||||
/// </summary>
|
||||
public int f() { return 1; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.bb(System.String,System.Int32@)".
|
||||
/// </summary>
|
||||
public int bb(string s, ref int y) { return 1; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.gg(System.Int16[],System.Int32[0:,0:])".
|
||||
/// </summary>
|
||||
public int gg(short[] array1, int[,] array) { return 0; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.op_Addition(N.X,N.X)".
|
||||
/// </summary>
|
||||
public static X operator +(X x, X xx) { return x; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "P:N.X.prop".
|
||||
/// </summary>
|
||||
public int prop { get { return 1; } set { } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "E:N.X.d".
|
||||
/// </summary>
|
||||
#pragma warning disable 67
|
||||
public event D d;
|
||||
#pragma warning restore 67
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "P:N.X.Item(System.String)".
|
||||
/// </summary>
|
||||
public int this[string s] { get { return 1; } }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "T:N.X.Nested".
|
||||
/// </summary>
|
||||
public class Nested { }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "T:N.X.D".
|
||||
/// </summary>
|
||||
public delegate void D(int i);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ID string generated is "M:N.X.op_Explicit(N.X)~System.Int32".
|
||||
/// </summary>
|
||||
public static explicit operator int(X x) { return 1; }
|
||||
|
||||
public static void Linq (IEnumerable<string> enumerable, Func<string> selector)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace Mono.Cecil.Tests {
|
||||
|
||||
[TestFixture]
|
||||
public class DocCommentIdTests {
|
||||
|
||||
[Test]
|
||||
public void TypeDef ()
|
||||
{
|
||||
AssertDocumentID ("T:N.X", GetTestType ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParameterlessCtor ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var ctor = type.GetConstructors ().Single (m => m.Parameters.Count == 0);
|
||||
|
||||
AssertDocumentID ("M:N.X.#ctor", ctor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CtorWithParameters ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var ctor = type.GetConstructors ().Single (m => m.Parameters.Count == 1);
|
||||
|
||||
AssertDocumentID ("M:N.X.#ctor(System.Int32)", ctor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Field ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var field = type.Fields.Single (m => m.Name == "q");
|
||||
|
||||
AssertDocumentID ("F:N.X.q", field);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConstField ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var field = type.Fields.Single (m => m.Name == "PI");
|
||||
|
||||
AssertDocumentID ("F:N.X.PI", field);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ParameterlessMethod ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var method = type.Methods.Single (m => m.Name == "f");
|
||||
|
||||
AssertDocumentID ("M:N.X.f", method);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MethodWithByRefParameters ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var method = type.Methods.Single (m => m.Name == "bb");
|
||||
|
||||
AssertDocumentID ("M:N.X.bb(System.String,System.Int32@)", method);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MethodWithArrayParameters ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var method = type.Methods.Single (m => m.Name == "gg");
|
||||
|
||||
AssertDocumentID ("M:N.X.gg(System.Int16[],System.Int32[0:,0:])", method);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OpAddition ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var op = type.Methods.Single (m => m.Name == "op_Addition");
|
||||
|
||||
AssertDocumentID ("M:N.X.op_Addition(N.X,N.X)", op);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OpExplicit ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var op = type.Methods.Single (m => m.Name == "op_Explicit");
|
||||
|
||||
AssertDocumentID ("M:N.X.op_Explicit(N.X)~System.Int32", op);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Property ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var property = type.Properties.Single (p => p.Name == "prop");
|
||||
|
||||
AssertDocumentID ("P:N.X.prop", property);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Indexer ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var indexer = type.Properties.Single (p => p.Name == "Item");
|
||||
|
||||
AssertDocumentID ("P:N.X.Item(System.String)", indexer);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Event ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var @event = type.Events.Single (e => e.Name == "d");
|
||||
|
||||
AssertDocumentID ("E:N.X.d", @event);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Delegate ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var @delegate = type.NestedTypes.Single (t => t.Name == "D");
|
||||
|
||||
AssertDocumentID ("T:N.X.D", @delegate);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NestedType ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var nestedType = type.NestedTypes.Single (t => t.Name == "Nested");
|
||||
|
||||
AssertDocumentID ("T:N.X.Nested", nestedType);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Linq ()
|
||||
{
|
||||
var type = GetTestType ();
|
||||
var method = type.GetMethod ("Linq");
|
||||
|
||||
AssertDocumentID ("M:N.X.Linq(System.Collections.Generic.IEnumerable{System.String},System.Func{System.String})", method);
|
||||
}
|
||||
|
||||
TypeDefinition GetTestType ()
|
||||
{
|
||||
return typeof (N.X).ToDefinition ();
|
||||
}
|
||||
|
||||
static void AssertDocumentID (string docId, IMemberDefinition member)
|
||||
{
|
||||
Assert.AreEqual (docId, DocCommentId.GetDocCommentId (member));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]
|
||||
|
||||
@@ -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 ()));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user