Working on tree optimizer
This commit is contained in:
@@ -181,9 +181,20 @@ namespace StgSharp.RegularAnalysis.Abstraction
|
||||
_state = 0;
|
||||
}
|
||||
|
||||
public void SkipNode()
|
||||
/// <summary>
|
||||
/// Skips the node and its subtree if the current node is the given node. Otherwise, do
|
||||
/// nothing.
|
||||
/// </summary>
|
||||
/// <param name="node">
|
||||
/// The node to skip.
|
||||
/// </param>
|
||||
public void SkipNode(
|
||||
TNode node
|
||||
)
|
||||
{
|
||||
if (_stack.TryPop(out Record? r)) {
|
||||
if (_stack.TryPeek(out Record? r) && ReferenceEquals(r.Node, node))
|
||||
{
|
||||
_ = _stack.Pop();
|
||||
_recycle.Push(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +176,7 @@ namespace StgSharp.RegularAnalysis.Abstraction
|
||||
|
||||
#region depth
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void DecreaseDepth(
|
||||
)
|
||||
{
|
||||
@@ -185,6 +186,7 @@ namespace StgSharp.RegularAnalysis.Abstraction
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void IncreaseDepth(
|
||||
int mark
|
||||
)
|
||||
|
||||
@@ -66,14 +66,6 @@ namespace StgSharp.RegularAnalysis.Abstraction
|
||||
TNode nextToken
|
||||
);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static virtual bool IsNullOrEmpty(
|
||||
TNode node
|
||||
)
|
||||
{
|
||||
return node is null || node.Equals(TNode.Empty);
|
||||
}
|
||||
|
||||
void PrependNode(
|
||||
TNode previousNode
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user