private TransformContractsVisitor TransformContracts(ModuleDefinition module, MethodDefinition method, ContractsRuntime contractsRuntime)
        {
            var       body      = method.Body;
            Decompile decompile = new Decompile(module, method);
            var       decomp    = decompile.Go();

            TransformContractsVisitor vTransform = new TransformContractsVisitor(module, method, decompile.Instructions, contractsRuntime);

            vTransform.Visit(decomp);

            foreach (var replacement in vTransform.ContractRequiresInfo)
            {
                // Only insert re-written contracts if level >= 2
                Expr rewritten = this.options.Level >= 2 ? replacement.RewrittenExpr : null;
                this.RewriteIL(body, decompile.Instructions, replacement.OriginalExpr, rewritten);
            }

            return(vTransform);
        }
Example #2
0
		private TransformContractsVisitor TransformContracts (ModuleDefinition module, MethodDefinition method, ContractsRuntime contractsRuntime)
		{
			var body = method.Body;
			Decompile decompile = new Decompile (module, method);
			var decomp = decompile.Go ();

			TransformContractsVisitor vTransform = new TransformContractsVisitor (module, method, decompile.Instructions, contractsRuntime);
			vTransform.Visit (decomp);

			foreach (var replacement in vTransform.ContractRequiresInfo) {
				// Only insert re-written contracts if level >= 2
				Expr rewritten = this.options.Level >= 2 ? replacement.RewrittenExpr : null;
				this.RewriteIL (body, decompile.Instructions, replacement.OriginalExpr, rewritten);
			}

			return vTransform;
		}