Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposed Stack and IsReachable properties on emitter. #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Sigil/Emit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,29 @@ private set

private readonly RollingVerifier CurrentVerifiers;

/// <summary>
/// The list of potential types on the current stack.
/// </summary>
public Type[][] Stack
{
get
{
return CurrentVerifiers.GetCurrentStack().Item2.Select(sl => sl.Select(si => si.Type).ToArray()).ToArray();
}
}

/// <summary>
/// If false, the current location is not reachable. This is useful information, for instance, when
/// emitting an expression statement where the result is to be discarded, but the emitted node is a throw.
/// </summary>
public bool IsReachable
{
get
{
return !MustMark;
}
}

private bool MustMark;

private readonly LinqList<int> ElidableCasts;
Expand Down
2 changes: 1 addition & 1 deletion Sigil/Impl/RollingVerifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public virtual VerificationResult ConditionalBranch(params Label[] toLabels)
return VerificationResult.Successful();
}

private SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>> GetCurrentStack()
internal SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>> GetCurrentStack()
{
SigilTuple<bool, LinqStack<LinqList<TypeOnStack>>> ret = null;
for(var i = 0; i < CurrentlyInScope.Count; i++)
Expand Down