Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
split method_with_block.rb into individual files that can be filechec…
…ked (#420)
- Loading branch information
Showing
6 changed files
with
112 additions
and
1,148 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
test/testdata/compiler/block-optimizations/block_param_call.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
# typed: true | ||
# compiled: true | ||
# run_filecheck: INITIAL | ||
# run_filecheck: OPT | ||
|
||
def baz(&blk) | ||
blk.call("baz") | ||
end | ||
|
||
# INITIAL-LABEL: "func_Object#baz" | ||
# INITIAL: call i64 @sorbet_getMethodBlockAsProc | ||
# INITIAL: call i64 @sorbet_callBlock | ||
# INITIAL{LITERAL}: } | ||
|
||
# OPT-LABEL: "func_Object#baz" | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT: call i64 @rb_yield_values_kw | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT{LITERAL}: } | ||
|
||
baz do |s| | ||
p s | ||
end |
32 changes: 32 additions & 0 deletions
32
test/testdata/compiler/block-optimizations/pass_block_param_explicit.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
# typed: true | ||
# compiled: true | ||
# run_filecheck: INITIAL | ||
# run_filecheck: OPT | ||
|
||
def foo | ||
yield | ||
end | ||
|
||
def bar(&blk) | ||
foo(&blk) | ||
end | ||
|
||
# INITIAL-LABEL: "func_Object#bar" | ||
# INITIAL: call i64 @sorbet_getMethodBlockAsProc | ||
# INITIAL: @sorbet_getPassedBlockHandler | ||
# INITIAL: call i64 @sorbet_callFuncWithCache | ||
# INITIAL{LITERAL}: } | ||
|
||
# OPT-LABEL: "func_Object#bar" | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT: @sorbet_getPassedBlockHandler | ||
# OPT: call i64 @sorbet_callFuncWithCache | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT{LITERAL}: } | ||
|
||
bar do | ||
puts "bar" | ||
end |
27 changes: 27 additions & 0 deletions
27
test/testdata/compiler/block-optimizations/yield_block_param.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
# typed: true | ||
# compiled: true | ||
# run_filecheck: INITIAL | ||
# run_filecheck: OPT | ||
|
||
def boo(&blk) | ||
yield | ||
end | ||
|
||
# INITIAL-LABEL: "func_Object#boo" | ||
# INITIAL: call i64 @sorbet_getMethodBlockAsProc | ||
# INITIAL: call i64 @sorbet_callBlock | ||
# INITIAL{LITERAL}: } | ||
|
||
# OPT-LABEL: "func_Object#boo" | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT: call i64 @rb_yield_values_kw | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT{LITERAL}: } | ||
|
||
boo do | ||
puts "boohey" | ||
end | ||
|
27 changes: 27 additions & 0 deletions
27
test/testdata/compiler/block-optimizations/yield_noparams.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
# typed: true | ||
# compiled: true | ||
# run_filecheck: INITIAL | ||
# run_filecheck: OPT | ||
|
||
def foo | ||
yield | ||
end | ||
|
||
# INITIAL-LABEL: "func_Object#foo" | ||
# INITIAL: call i64 @sorbet_getMethodBlockAsProc | ||
# INITIAL: call i64 @sorbet_callBlock | ||
# INITIAL{LITERAL}: } | ||
|
||
# OPT-LABEL: "func_Object#foo" | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT: call i64 @rb_yield_values_kw | ||
# OPT-NOT: call i64 @sorbet_getMethodBlockAsProc | ||
# OPT-NOT: call i64 @rb_block_proc | ||
# OPT{LITERAL}: } | ||
|
||
foo do | ||
puts "heey" | ||
end | ||
|
Oops, something went wrong.