本文整理汇总了C#中Microsoft.PSharp.StaticAnalysis.ControlFlowGraphNode.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# ControlFlowGraphNode.Equals方法的具体用法?C# ControlFlowGraphNode.Equals怎么用?C# ControlFlowGraphNode.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.PSharp.StaticAnalysis.ControlFlowGraphNode
的用法示例。
在下文中一共展示了ControlFlowGraphNode.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoesResetInLoop
/// <summary>
/// Returns true if the given expression resets when flowing from the
/// target in the given loop body control flow graph nodes. The given
/// control flow graph nodes must be equal.
/// </summary>
/// <param name="expr">Expression</param>
/// <param name="syntaxNode">SyntaxNode</param>
/// <param name="cfgNode">ControlFlowGraphNode</param>
/// <param name="targetSyntaxNode">Target syntaxNode</param>
/// <param name="targetCfgNode">Target controlFlowGraphNode</param>
/// <param name="model">SemanticModel</param>
/// <returns>Boolean value</returns>
internal static bool DoesResetInLoop(ExpressionSyntax expr, SyntaxNode syntaxNode,
ControlFlowGraphNode cfgNode, SyntaxNode targetSyntaxNode,
ControlFlowGraphNode targetCfgNode, SemanticModel model)
{
ISymbol reference = null;
if (!cfgNode.Equals(targetCfgNode) ||
!Utilities.TryGetSymbolFromExpression(out reference, expr, model))
{
return false;
}
return DataFlowAnalysis.DoesResetInLoop(reference, syntaxNode, cfgNode,
targetSyntaxNode, targetCfgNode);
}
示例2: DoesSymbolReset
/// <summary>
/// Returns true if the given symbol resets until it reaches the
/// target control flow graph node.
/// </summary>
/// <param name="symbol">Symbol</param>
/// <param name="syntaxNode">SyntaxNode</param>
/// <param name="cfgNode">ControlFlowGraphNode</param>
/// <param name="targetSyntaxNode">Target syntaxNode</param>
/// <param name="targetCfgNode">Target controlFlowGraphNode</param>
/// <param name="visited">Already visited cfgNodes</param>
/// <param name="track">Tracking</param>
/// <returns>Boolean value</returns>
internal bool DoesSymbolReset(ISymbol symbol, SyntaxNode syntaxNode, ControlFlowGraphNode cfgNode,
SyntaxNode targetSyntaxNode, ControlFlowGraphNode targetCfgNode, HashSet<ControlFlowGraphNode> visited,
bool track)
{
visited.Add(cfgNode);
bool result = false;
if (syntaxNode.Equals(targetSyntaxNode) && cfgNode.Equals(targetCfgNode) &&
!track)
{
return result;
}
foreach (var node in cfgNode.SyntaxNodes)
{
if (track && this.ResetMap.ContainsKey(cfgNode) &&
this.ResetMap[cfgNode].ContainsKey(node) &&
this.ResetMap[cfgNode][node].Contains(symbol))
{
result = true;
break;
}
if (!track && node.Equals(syntaxNode))
{
track = true;
}
}
if (!result)
{
foreach (var successor in cfgNode.ISuccessors.Where(v => !visited.Contains(v)))
{
if ((successor.Equals(targetCfgNode) ||
successor.IsPredecessorOf(targetCfgNode)) &&
this.DoesSymbolReset(symbol, successor.SyntaxNodes.First(),
successor, targetSyntaxNode, targetCfgNode, visited, true))
{
result = true;
break;
}
}
}
return result;
}