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


C# Method.GetFullUnmangledNameWithTypeParameters方法代码示例

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


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

示例1: IsAssumedConfinedMethod

    internal static bool IsAssumedConfinedMethod(Method m) {
      List<string> assumedPureCtorTypes = new List<string>(new string[] { "System.Object", "System.Collections" });
      // Some native method that we assume as pure..
      if (assumedPureMethods == null)
        RetriveAssumedPureMethods("assumedPure.txt");


      bool res = false;
      string methodName = m.Name.Name;
      string methodFullName = m.GetFullUnmangledNameWithTypeParameters();
      string methodDeclaringType = m.DeclaringType.FullName;

      // Declared pure method are assumed pure
      res = res || m.IsConfined || m.IsStateIndependent;

      // It should be readed from a contract
      // REMOVE!!!!!!!!!!!!!!!!
      res = res || (methodName.Equals("Equals"));
      res = res || (methodName.Equals("GetHashCode"));
      res = res || (methodName.Equals("ToString"));
      // Contracts are ignored
      res = res || (methodDeclaringType.StartsWith("Microsoft.Contracts"));
      res = res || methodFullName.EndsWith("get_SpecSharp::FrameGuard");

      // DELETE THIS. Just for  benchmarking standalone app
      if (PointsToAndEffectsAnnotations.assumeMorePures) {
        res = res || methodName.Contains("GetEnumerator");
        res = res || (methodName.StartsWith("Is"));
        res = res || (methodName.StartsWith("Get_"));
        res = res || (methodName.StartsWith("get_"));
        res = res || (methodName.StartsWith("GetString"));
        res = res || (methodName.StartsWith("IndexOf"));
        res = res || (m is InstanceInitializer);
        res = res || methodFullName.StartsWith("System.ThrowHelper");
        }

      // Some assumed pure methods.
      res = res || starWith(methodFullName, assumedPureMethods);
      // Some constructors assumed pure 
      res = res || (m is InstanceInitializer) && starWith(methodDeclaringType, assumedPureCtorTypes);

      // It should be readed from a contract
      res = res || (methodName.Equals("Parse") && m.DeclaringType.IsPrimitiveNumeric);

      // Properties
      //res = res || m.IsPropertyGetter;
      ////
      //res = res || (methodName.StartsWith("Is"));
      //res = res || (methodName.StartsWith("Get_"));
      //res = res || (methodName.StartsWith("IndexOf"));
      return res;
      }
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:52,代码来源:PointsToAndEffectsAnnotations.cs

示例2: ComputePointsToStateFor

    /// <summary>
    /// Compute the Dataflow analysis for the given method
    /// Returns true if the method is pure
    /// </summary>
    /// <param name="method"></param>
    /// <returns></returns>

    public bool ComputePointsToStateFor(Method method)
    {

      // Get or compute the CFG
      ControlFlowGraph cfg = pointsToStateAnalysys.GetCFG(method);

      //if (PointsToAnalysis.debug)
      //    CodePrinter.PrintMethod(method);

      PointsToState initialState = this.pointsToStateAnalysys.Factory.NewElement(method);


      // If we can compute de CFG and the method is not unsafe
      // We compute the dataflow analysis
      if (cfg != null && !PointsToAnalysis.IsUnsafe(method))
      {

        ComputeBeforeDataflow(method);
        this.Run(cfg, initialState);

        if (exitState == null)
        {
          if (PointsToAnalysis.debug)
              Console.WriteLine("Method {0} exitState NULL", method.GetFullUnmangledNameWithTypeParameters());
        }
        // FIX
        PointsToState PointsToStateAtExit = (PointsToState)exitState;
        ComputeAfterDataflow(method);

        return true;
      }
      else
      {
        exitState = null;
        return false;
      }
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:44,代码来源:PointsToAnalysis.cs

示例3: IsAnalyzable

    /// <summary>
    /// Determines whether the method is analyzable or not
    /// for interProc call.
    /// That is, if we can get the method body 
    /// (not abstract, not interface, under our desired analysis scope)
    /// </summary>
    /// <param name="m"></param>
    /// <returns></returns>
    public virtual bool IsAnalyzable(Method m)
    {
      String mName = m.GetFullUnmangledNameWithTypeParameters();
      //bool isAnalyzable = analyzableMethods.Contains(mName);
      bool isAnalyzable = true;
      if (fixPointForMethods)
        isAnalyzable = analyzableMethods.Contains(m);
      else
        isAnalyzable = IsInCurrenModule(m);

      // isAnalyzable = !fixPointForMethods || analyzableMethods.Contains(m);

      Method templateOrMethod = solveMethodTemplate(m);

      isAnalyzable = isAnalyzable
          && IsPossibleAnalyzableMethod(templateOrMethod);

      // Method templateOrMethod = m;

      bool isConstructorTemplateDeclaredPure = IsContructorTemplatePure(m);

      isAnalyzable = isAnalyzable
                  && isConstructorTemplateDeclaredPure
                  && (!templateOrMethod.IsAbstract)
                  && (templateOrMethod.Body != null
                  && templateOrMethod.Body.Statements != null
                  && templateOrMethod.Body.Statements.Count >= 0);

      return isAnalyzable;
    }
开发者ID:hesam,项目名称:SketchSharp,代码行数:38,代码来源:PointsToAnalysis.cs

示例4: ProcessResultsMethod

        /// <summary>
        /// Show detailed information about the results for the method.
        /// 
        /// </summary>
        /// <param name="m"></param>
        public void ProcessResultsMethod(Method m)
        {
            PointsToAndWriteEffects ptwe = GetPurityAnalysisWithDefault(m);
            PTGraph ptg = ptwe.PointsToGraph;
            bool isPure = GetPurityWithDefault(m);

            #region Display Results (if verbose)
            if (verbose && !ptwe.IsDefault)
            {
                Console.Out.WriteLine("***RESULT***");
                Console.Out.WriteLine("Method:{0}\nPure:{1} Abstract:{2}", m.GetFullUnmangledNameWithTypeParameters(),
                    isPure, m.IsAbstract);

                foreach (Parameter p in ptg.ParameterMap.Keys)
                {
                    String refOrOut = "(value)";
                    if (p.IsOut)
                        refOrOut = "(out)";
                    else
                        if (p.Type is Reference)
                            refOrOut = "(ref)";

                    Console.Out.WriteLine("Parameter: {0} {2} ({1})", p.Name, ptwe.IsReadOnly(p) ? "ReadOnly" : "RW", refOrOut);
                    
                }
            
                Set<VariableEffect> writeEffectsforVariables = ptwe.ComputeWriteEffects();
                foreach (VariableEffect vEffect in writeEffectsforVariables)
                {
                    Statement stat = vEffect.Label.Statement;
                    if (stat != null)
                        Console.Out.WriteLine("{3} In ({0},{1}) Statement:{2}", stat.SourceContext.StartLine,
                            stat.SourceContext.StartColumn, stat.SourceContext.SourceText, vEffect.ToString());
                }
                Console.Out.WriteLine();

                Set<VariableEffect> readEffects = ptwe.ComputeEffects(ptwe.ReadEffects);
                Console.Out.WriteLine("Reads:");
                foreach (VariableEffect readEffect in readEffects)
                {
                    Statement stat = readEffect.Label.Statement;
                    Console.Out.WriteLine("{3} In ({0},{1}) Statement:{2}", stat.SourceContext.StartLine,
                            stat.SourceContext.StartColumn, stat.SourceContext.SourceText, readEffect.ToString());

                }
                Console.Out.WriteLine();

                //if (!GetPurityMap(m))
                {
                    Console.Out.WriteLine(ptwe);
                }
                ptwe.PointsToGraph.GenerateDotGraph(Console.Out);

                Console.Out.WriteLine("****");
            }
            #endregion
            
            #region Information about Escape, Freshness and use of Globals
            // If it was analyzed
            if (!ptwe.IsDefault)
            {
                if (PointsToAndEffectsAnnotations.IsDeclaredFresh(m))
                {
                    bool isFreshReturn = ptwe.CheckFreshness(m);
                    if (!isFreshReturn)
                    {
                        string msg = string.Format("Method {0} is declared fresh but return cannot be proven to be fresh", ptwe.Method.Name);
                        typeSystem.HandleError(m.Name, Error.GenericWarning, msg);
                    }

                }
                if (!PointsToAndEffectsAnnotations.IsDeclaredWritingGlobals(m) && !(m is StaticInitializer)
                  && !(m.IsStatic && m.DeclaringMember is Property))
                {
                    bool isWritingGlobal = ptwe.CheckGlobalWriting(m);
                    if (isWritingGlobal)
                    {
                        string msg = string.Format("Cannot prove that Method {0} does not write global variables", ptwe.Method.Name);
                        typeSystem.HandleError(m.Name, Error.GenericWarning, msg);
                    }
                }
                if (!PointsToAndEffectsAnnotations.IsDeclaredReadingGlobals(m))
                {
                    bool isReadingGlobal = ptwe.CheckGlobalReading(m);
                    if (isReadingGlobal)
                    {
                        string msg = string.Format("Cannot prove that method {0} does not read global variables", ptwe.Method.Name);
                        typeSystem.HandleError(m.Name, Error.GenericWarning, msg);
                    }
                }


              
                foreach (Parameter p in ptg.ParameterMap.Keys)
                {
//.........这里部分代码省略.........
开发者ID:tapicer,项目名称:resource-contracts-.net,代码行数:101,代码来源:PurityAnalysis.cs


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