Skip to content

Commit

Permalink
Add constructor with null to create an empty stack_frame
Browse files Browse the repository at this point in the history
  • Loading branch information
gammasoft71 committed Oct 10, 2024
1 parent b342ccb commit 305c659
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/xtd.core/include/xtd/diagnostics/stack_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ namespace xtd {
/// @param method_name The method name.
/// @param offset The offset from the code for the method that is being executed.
stack_frame(const xtd::string& file_name, xtd::size line_number, const xtd::string& method_name, xtd::size column_number, xtd::size offset);
/// @brief Initializes a new empty instance of the xtd::diagnostics::stack_frame.
/// @param frame nullptr.
stack_frame(xtd::null_ptr frame); // Not explicit by design.
/// @cond
stack_frame(const stack_frame&) = default;
stack_frame(stack_frame&&) = default;
Expand Down
5 changes: 4 additions & 1 deletion src/xtd.core/src/xtd/diagnostics/stack_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ stack_frame::stack_frame(const string& file_name, xtd::size line_number, xtd::si
stack_frame::stack_frame(const string& file_name, xtd::size line_number, const string& method_name, xtd::size column_number, xtd::size offset) : data_{new_ptr<data>(file_name, line_number, method_name, column_number, offset)} {
}

stack_frame::stack_frame(xtd::null_ptr frame) : stack_frame{string::empty_string, 0, string::empty_string, 0, OFFSET_UNKNOWN} {
}

stack_frame stack_frame::empty() noexcept {
return {string::empty_string, 0, string::empty_string, 0, OFFSET_UNKNOWN};
return null;
}

bool stack_frame::equals(const stack_frame& sf) const noexcept {
Expand Down

0 comments on commit 305c659

Please sign in to comment.