Skip to content

Commit

Permalink
Add Exception::CallStack.empty
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Sep 19, 2024
1 parent edfe1f4 commit 3cabc6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/compiler/crystal/semantic/call.cr
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class Crystal::Call
property? uses_with_scope = false

class RetryLookupWithLiterals < ::Exception
@@dummy_call_stack = Exception::CallStack.new

def initialize
self.callstack = @@dummy_call_stack
self.callstack = Exception::CallStack.empty
end
end

Expand Down
7 changes: 5 additions & 2 deletions src/exception/call_stack.cr
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ struct Exception::CallStack
@callstack : Array(Void*)
@backtrace : Array(String)?

def initialize
@callstack = CallStack.unwind
def initialize(@callstack : Array(Void*) = CallStack.unwind)
end

def self.empty
new([] of Void*)
end

def printable_backtrace : Array(String)
Expand Down

0 comments on commit 3cabc6b

Please sign in to comment.