public CilMethodBody(MethodDefinition method) { Method = method; MaxStack = 8; Instructions = new CilInstructionCollection(this); ExceptionHandlers = new List <ExceptionHandler>(); ComputeMaxStackOnBuild = true; _thisParameter = new LazyValue <ParameterSignature>(() => method.DeclaringType != null ? new ParameterSignature(method.DeclaringType.ToTypeSignature()) : null); }
public CilMethodBody(MethodDefinition method) { Method = method; MaxStack = 8; Instructions = new CilInstructionCollection(this); ExceptionHandlers = new List <ExceptionHandler>(); ComputeMaxStackOnBuild = true; _thisParameter = new LazyValue <ParameterSignature>(() => { if (method.DeclaringType == null) { return(null); } var typeSig = method.DeclaringType.ToTypeSignature(); if (method.DeclaringType.IsValueType) { typeSig = new ByReferenceTypeSignature(typeSig); } return(new ParameterSignature(typeSig)); }); }