Skip to content

fix: Emit reference for rescued bindings. #83

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

Merged
merged 2 commits into from
Aug 22, 2022
Merged
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
1 change: 1 addition & 0 deletions scip_indexer/SCIPIndexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ static bool isTemporary(const core::GlobalState &gs, const core::LocalVariable &
auto n = var._name;
return n == Names::blockPreCallTemp() || n == Names::blockTemp() || n == Names::blockPassTemp() ||
n == Names::blkArg() || n == Names::blockCall() || n == Names::blockBreakAssign() || n == Names::forTemp() ||
n == Names::keepForCfgTemp() ||
// Insert checks because sometimes temporaries are initialized with a 0 unique value. 😬
n == Names::finalReturn() || n == NameRef::noName() || n == Names::blockCall() || n == Names::selfLocal() ||
n == Names::unconditional();
Expand Down
18 changes: 18 additions & 0 deletions test/scip/testdata/rescue.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# typed: true

class MyError < StandardError
end

def handle(e)
puts e.inspect.to_s
end

def f
begin
raise 'This exception will be rescued!'
rescue MyError => e1
handle(e1)
rescue StandardError => e2
handle(e2)
end
end
34 changes: 34 additions & 0 deletions test/scip/testdata/rescue.snapshot.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# typed: true

class MyError < StandardError
# ^^^^^^^ definition [..] MyError#
# ^^^^^^^^^^^^^ definition [..] StandardError#
end

def handle(e)
#^^^^^^^^^^^^^ definition [..] Object#handle().
# ^ definition local 1~#780127187
puts e.inspect.to_s
# ^ reference local 1~#780127187
end

def f
#^^^^^ definition [..] Object#f().
begin
raise 'This exception will be rescued!'
rescue MyError => e1
# ^^^^^^^ reference local 1~#3809224601
# ^^^^^^^ reference [..] MyError#
# ^^ definition local 1~#3809224601
handle(e1)
# ^^^^^^ reference [..] Object#handle().
# ^^ reference local 1~#3809224601
rescue StandardError => e2
# ^^^^^^^^^^^^^ reference local 2~#3809224601
# ^^^^^^^^^^^^^ reference [..] StandardError#
# ^^ definition local 2~#3809224601
handle(e2)
# ^^^^^^ reference [..] Object#handle().
# ^^ reference local 2~#3809224601
end
end