当前位置: 首页>>代码示例>>C#>>正文


C# Compiler.Method类代码示例

本文整理汇总了C#中System.Compiler.Method的典型用法代码示例。如果您正苦于以下问题:C# Method类的具体用法?C# Method怎么用?C# Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Method类属于System.Compiler命名空间,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: contractRename

        static string contractRename(Method meth, ArrayList a, ArrayList b)
        {
            MethodContract mc = meth.Contract;

            File.AppendAllText("g:\\test3.txt", meth.HelpText + "\r\n");
            return "";
        }
开发者ID:Jescy,项目名称:Matching_spec_Specification,代码行数:7,代码来源:OutputContractVisitor.cs

示例2: CurrentState

 private CurrentState(TypeNode type, Dictionary<string, object> typeSuppressed, Method method)
 {
     this.Type = type;
     this.typeSuppressed = typeSuppressed;
     this.Method = method;
     this.methodSuppressed = null;
 }
开发者ID:Yatajga,项目名称:CodeContracts,代码行数:7,代码来源:Rewriter.cs

示例3: CollectOldExpressions

 public CollectOldExpressions(Module module, Method method, ContractNodes contractNodes, Dictionary<TypeNode, Local> closureLocals, 
     int localCounterStart, Class initialClosureClass)
     : this(module, method, contractNodes, closureLocals, localCounterStart)
 {
     this.topLevelClosureClass = initialClosureClass;
     this.currentClosureClass = initialClosureClass;
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:7,代码来源:CollectOldExpressions.cs

示例4: check

 static public void check(TypeSystem t, Method m){
   ModifiesChecker mChecker=new ModifiesChecker(t);
   ControlFlowGraph cfg=ControlFlowGraph.For(m);
   mChecker.Run(cfg,
     null // TBD
     );
 } 
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:7,代码来源:ModifyAnalysis.cs

示例5: CreateTryFinallyBlock

        internal static Block CreateTryFinallyBlock(Method method, Block tryBody, Block finallyBody)
        {
          Contract.Requires(method != null);
          Contract.Requires(tryBody != null);
          Contract.Requires(finallyBody != null);

            if (method.ExceptionHandlers == null) method.ExceptionHandlers = new ExceptionHandlerList();

            Block result = new Block(new StatementList());
            Block afterFinally = new Block(new StatementList());

            tryBody.Statements.Add(new Branch(null, afterFinally, false, true, true));
            finallyBody.Statements.Add(new EndFinally());

            result.Statements.Add(tryBody);
            result.Statements.Add(finallyBody);
            result.Statements.Add(afterFinally);

            ExceptionHandler fb = new ExceptionHandler();
            fb.TryStartBlock = tryBody;
            fb.BlockAfterTryEnd = finallyBody;
            fb.HandlerStartBlock = finallyBody;
            fb.BlockAfterHandlerEnd = afterFinally;
            fb.HandlerType = NodeType.Finally;
            method.ExceptionHandlers.Add(fb);

            return result;
        }
开发者ID:nbulp,项目名称:CodeContracts,代码行数:28,代码来源:RewriteUtils.cs

示例6: CurrentState

 public CurrentState(AssemblyNode assembly) {
   this.Assembly = assembly;
   this.Type = null;
   this.Method = null;
   this.assemblySuppressed = null;
   this.typeSuppressed = null;
   this.methodSuppressed = null;
 }
开发者ID:nbulp,项目名称:CodeContracts,代码行数:8,代码来源:Checker.cs

示例7: VisitMethod

 public override Method VisitMethod(Method method)
 {
     if (method == null) return null;
     this.VisitAttributeList(method.Attributes);
     this.VisitAttributeList(method.ReturnAttributes);
     // don't visit further into the method.
     return method;
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:8,代码来源:FilterForRuntime.cs

示例8: CheckMethodSpecAdmissibility

 public void CheckMethodSpecAdmissibility(Expression exp, Method method, bool reportWFonly, bool dontReport) {
   DeclaringMethod = method;
   ReportWFErrorOnly = reportWFonly; // true for Pure methods: we only want to enforce well-foundedness on them
   DontReportError = dontReport;     
   StateStack = new System.Collections.Stack();
   ResetCurrentState();
   this.VisitExpression(exp);
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:8,代码来源:AdmissibilityChecker.cs

示例9: DuplicatorForContractsAndClosures

        public DuplicatorForContractsAndClosures(Module module, Method sourceMethod, Method targetMethod,
            ContractNodes contractNodes, bool mapParameters)
            : base(module, targetMethod.DeclaringType)
        {
            this.sourceMethod = sourceMethod;
            this.targetMethod = targetMethod;

            this.RemoveNameForLocals = true;

            Duplicator dup = this;

            if (mapParameters)
            {
                if (sourceMethod.ThisParameter != null)
                {
                    if (targetMethod.ThisParameter != null)
                    {
                        dup.DuplicateFor[sourceMethod.ThisParameter.UniqueKey] = targetMethod.ThisParameter;
                    }
                    else
                    {
                        // target is a static wrapper. But duplicator cannot handle This -> Parameter conversion
                        // so we handle it explicitly here in this visitor.
                        replaceThisWithParameter = targetMethod.Parameters[0];
                    }
                }

                if (sourceMethod.Parameters != null && targetMethod.Parameters != null
                    && sourceMethod.Parameters.Count == targetMethod.Parameters.Count)
                {
                    for (int i = 0, n = sourceMethod.Parameters.Count; i < n; i++)
                    {
                        dup.DuplicateFor[sourceMethod.Parameters[i].UniqueKey] = targetMethod.Parameters[i];
                    }
                }
            }

            var originalType = HelperMethods.IsContractTypeForSomeOtherType(sourceMethod.DeclaringType, contractNodes);
            if (originalType != null)
            {
                var contractType = this.contractClass = sourceMethod.DeclaringType;
                while (contractType.Template != null)
                {
                    contractType = contractType.Template;
                }
                    
                while (originalType.Template != null)
                {
                    originalType = originalType.Template;
                }

                // forward ContractType<A,B> -> originalType<A',B'>
                this.contractClassToForward = contractType;
                this.targetTypeToForwardTo = originalType;

                //dup.DuplicateFor[contractType.UniqueKey] = originalType;
            }
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:58,代码来源:DuplicatorForContractsAndClosures.cs

示例10: VisitMethod

        public override Method VisitMethod(Method method)
        {
            if (method == null) return null;

            ZMethod result = (ZMethod)base.VisitMethod(method);

            result.ResetLocals();
            return result;
        }
开发者ID:ZingModelChecker,项目名称:Zing,代码行数:9,代码来源:ZDuplicator.cs

示例11: CurrentState

 public CurrentState(TypeNode type, CurrentState oldState)
 {
     this.Type = type;
     this.Method = null;
     this.typeSuppressed = null;
     this.methodSuppressed = null;
     this.Assembly = oldState.Assembly;
     this.assemblySuppressed = oldState.assemblySuppressed;
 }
开发者ID:Yatajga,项目名称:CodeContracts,代码行数:9,代码来源:PostExtractorChecker.cs

示例12: CleanupEnsures

 /// <summary>
 /// Visits the ensures clauses to clean up Old expressions
 /// </summary>
 /// <param name="m"></param>
 public void CleanupEnsures(Method m)
 {
     if (m.Contract != null)
     {
         this.VisitEnsuresList(m.Contract.Ensures);
         this.VisitEnsuresList(m.Contract.AsyncEnsures);
         this.VisitEnsuresList(m.Contract.ModelEnsures);
     }
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:13,代码来源:ClousotExtractor.cs

示例13: Contains

        /// <summary>
        /// actualReturn type is null if Task is not generic, otherwise ,the Task result type.
        /// </summary>
        public static bool Contains(Node node, ContractNodes contractNodes, Method currentMethod,
            TypeNode actualReturnType)
        {
            var v = new AsyncReturnValueQuery(contractNodes, currentMethod, actualReturnType);

            v.Visit(node);

            return v.foundReturnValueTaskResult;
        }
开发者ID:a780201,项目名称:CodeContracts,代码行数:12,代码来源:AsyncReturnValueQuery.cs

示例14: RewriteContractCall

        // Requires:
        //  statement.Expression is MethodCall
        //  statement.Expression.Callee is MemberBinding
        //  statement.Expression.Callee.BoundMember is Method
        //  statement.Expression.Callee.BoundMember == "Requires" or "Ensures"
        //
        //  inline  <==> replacementMethod == null
        //  replacementMethod != null
        //           ==> replacementMethod.ReturnType == methodToReplace.ReturnType
        //               && replacementMethod.Parameters.Count == 1
        //               && methodToReplace.Parameters.Count == 1
        //               && replacementMethod.Parameters[0].Type == methodToReplace.Parameters[0].Type
        //
        private static Statement RewriteContractCall(
            ExpressionStatement statement,
            Method /*!*/ methodToReplace,
            Method /*?*/ replacementMethod,
            Literal /*?*/ sourceTextToUseAsSecondArg)
        {
            Contract.Requires(statement != null);

            MethodCall call = statement.Expression as MethodCall;

            if (call == null || call.Callee == null)
            {
                return statement;
            }

            MemberBinding mb = call.Callee as MemberBinding;
            if (mb == null)
            {
                return statement;
            }

            Method m = mb.BoundMember as Method;
            if (m == null)
            {
                return statement;
            }

            if (m != methodToReplace)
            {
                return statement;
            }

            mb.BoundMember = replacementMethod;

            if (call.Operands.Count == 3)
            {
                // then the invariant was found in a reference assembly
                // it already has all of its arguments
                return statement;
            }

            if (call.Operands.Count == 1)
            {
                call.Operands.Add(Literal.Null);
            }

            Literal extraArg = sourceTextToUseAsSecondArg;
            if (extraArg == null)
            {
                extraArg = Literal.Null;
                //extraArg = new Literal("No other information available", SystemTypes.String);
            }

            call.Operands.Add(extraArg);

            return statement;
        }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:70,代码来源:RewriteInvariant.cs

示例15: VisitMethod

        public override Method VisitMethod(Method method)
        {
            Method re = base.VisitMethod(method);

            System.Compiler.TypeNode sigTmp = re.ReturnType;
            if(sigTmp.TypeCode!=TypeCode.Empty)
                signatureType = sigTmp;

            return re;
        }
开发者ID:Jescy,项目名称:Matching_spec_Specification,代码行数:10,代码来源:MyVisitor.cs


注:本文中的System.Compiler.Method类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。