Skip to content

Commit

Permalink
stacked-contexts: Add peek() method
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* util/rust-stacked-contexts.h: Add new method to see what context we are currently in.
  • Loading branch information
CohenArthur committed Dec 2, 2024
1 parent afbd873 commit 22f66de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gcc/rust/util/rust-stacked-contexts.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ template <typename T> class StackedContexts
return last;
}

const T& peek() {
rust_assert (!stack.empty());

return stack.back();
}

/**
* Are we currently inside of a special context?
*/
Expand Down

0 comments on commit 22f66de

Please sign in to comment.