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


C# Nodes.AddRange方法代码示例

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


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

示例1: bindCallerWithCalleePTG

    /// <summary>
    /// Bind the caller with the callee and simplify the resulting pointsToGraph
    /// by removing the load nodes that has been resolved (captured objects)
    /// </summary>
    /// <param name="callerPTG"></param>
    /// <param name="calleePTG"></param>
    /// <param name="vr"></param>
    /// <returns></returns>
    private void bindCallerWithCalleePTG(PTGraph callerPTG, PTGraph calleePTG,  Variable vr)
    {



      // Compute Edges
      Edges Inew = new Edges();
      foreach (Edge ie in calleePTG.I)
      {
        foreach (IPTAnalysisNode nu1 in RelatedExtended(ie.Src))
        {
          foreach (IPTAnalysisNode nu2 in RelatedExtended(ie.Dst))
          {
            Inew.AddIEdge(nu1, ie.Field, nu2);
          }
        }
      }
      // Compute Edges
      Edges Onew = new Edges();
      foreach (Edge oe in calleePTG.O)
      {
        foreach (IPTAnalysisNode nu1 in RelatedExtended(oe.Src))
        {
          if (!nu1.IsNull)
            Onew.AddOEdge(nu1, oe.Field, oe.Dst);
        }
      }


      // Compute Escape
      Nodes eNew = new Nodes();
      foreach (IPTAnalysisNode n in calleePTG.E)
      {
        eNew.AddRange(RelatedExtended(n));
      }

      callerPTG.I.AddEdges(Inew);
      callerPTG.O.AddEdges(Onew);
      callerPTG.E.AddRange(eNew);

      /// Assign vr = related(retValue) 


      Nodes argNodes = Nodes.Empty;
      if (callerThisRef != null)
      {
        // argNodes.Add(callerPTG.GetAddress(callerThisRef));
        argNodes.AddRange(callerPTG.GetLocations(callerThisRef));
      }
      if (calleePTG.Method.Parameters != null)
      {
        for (int i = 0; i < calleePTG.Method.Parameters.Count; i++)
        {
          Parameter p = calleePTG.Method.Parameters[i];
          PNode pn = calleePTG.ParameterMap[p];
          if (!pn.IsByValue)
          {
            if (arguments[i] is Variable)
            {
              Variable vArg = (Variable)arguments[i];
              bindRefOrOutParameter(callerPTG, calleePTG, arguments[i] as Variable, p);
            }
          }
          if (arguments[i] is Variable)
          {
            Variable vArg = (Variable)arguments[i];
            // PTAnalysisNode addrArg = callerPTG.GetAddress(vArg);
            // argNodes.Add(addrArg);
            argNodes.AddRange(callerPTG.GetLocations(vArg));
          }

        }
      }


      if (vr != null)
      {
        if (!vr.Type.IsPrimitive && calleePTG.RetValue != null)
        {
          callerPTG.AddVariable(vr, callerPTG.MethodLabel);

          Nodes relatedValues2 = Nodes.Empty;
          // PTAnalysisNode addrRetValue = calleePTG.GetAddress(calleePTG.RetValue);
          // foreach (PTAnalysisNode n2 in calleePTG.Values(addrRetValue))
          foreach (IPTAnalysisNode n2 in calleePTG.Values(calleePTG.GetLocations(calleePTG.RetValue)))
          {
            relatedValues2.AddRange(RelatedExtended(n2));
          }
          callerPTG.Assign(vr, relatedValues2, calleePTG.MethodLabel);

        }
        else
//.........这里部分代码省略.........
开发者ID:hesam,项目名称:SketchSharp,代码行数:101,代码来源:PointsToAnalysis.cs


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