-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using AspectInjector.Core.Fluent; | ||
using Mono.Cecil; | ||
|
||
namespace AspectInjector.Core.Extensions | ||
{ | ||
public static class ClonningExtensions | ||
{ | ||
public static GenericParameter Clone(this GenericParameter gparam, IGenericParameterProvider target, ExtendedTypeSystem ts) | ||
{ | ||
var ngp = new GenericParameter(gparam.Name, target) | ||
{ | ||
HasDefaultConstructorConstraint = gparam.HasDefaultConstructorConstraint, | ||
HasReferenceTypeConstraint = gparam.HasReferenceTypeConstraint, | ||
HasNotNullableValueTypeConstraint = gparam.HasNotNullableValueTypeConstraint, | ||
IsNonVariant = gparam.IsNonVariant, | ||
IsContravariant = gparam.IsContravariant, | ||
IsCovariant = gparam.IsCovariant, | ||
//Namespace = gparam.Namespace, | ||
IsValueType = gparam.IsValueType | ||
}; | ||
|
||
foreach (var gc in gparam.Constraints) | ||
ngp.Constraints.Add(ts.Import(gc)); | ||
|
||
foreach (var subgp in gparam.GenericParameters) | ||
ngp.GenericParameters.Add(subgp.Clone(target,ts)); | ||
|
||
return ngp; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters