Mono.CSharp.MethodSpec.Mutate C# (CSharp) Method

Mutate() public method

public Mutate ( Mono.CSharp.TypeParameterMutator mutator ) : MethodSpec
mutator Mono.CSharp.TypeParameterMutator
return MethodSpec
        public MethodSpec Mutate(TypeParameterMutator mutator)
        {
            var targs = TypeArguments;
            if (targs != null)
                targs = mutator.Mutate (targs);

            var decl = DeclaringType;
            if (DeclaringType.IsGenericOrParentIsGeneric) {
                decl = mutator.Mutate (decl);
            }

            if (targs == TypeArguments && decl == DeclaringType)
                return this;

            var ms = (MethodSpec) MemberwiseClone ();
            if (decl != DeclaringType) {
                ms.inflatedMetaInfo = null;
                ms.declaringType = decl;
                ms.state |= StateFlags.PendingMetaInflate;
            }

            if (targs != null) {
                ms.targs = targs;
                ms.state |= StateFlags.PendingMakeMethod;
            }

            return ms;
        }

Usage Example

Example #1
0
		public void Emit (OpCode opcode, MethodSpec method)
		{
			if (IsAnonymousStoreyMutateRequired)
				method = method.Mutate (CurrentAnonymousMethod.Storey.Mutator);

			if (method.IsConstructor)
				ig.Emit (opcode, (ConstructorInfo) method.GetMetaInfo ());
			else
				ig.Emit (opcode, (MethodInfo) method.GetMetaInfo ());
		}
All Usage Examples Of Mono.CSharp.MethodSpec::Mutate