c5ff48648a
Previously, a return statement inside a scoped Block would always result in the return expression being assigned to a temporary variable instead of replacing the function-call-expression directly. This was done because there might be variables inside the Block; these would have fallen out of scope when the expression is migrated to the call site, resulting in an invalid expression. We aren't actually examining the return expression so we don't know if it uses variables from an inner scope at all. (Inspecting the return expression for variable usage is certainly possible! But it's a fair amount of code and complexity for a small payoff.) However, we can very easily get most of the benefit here without paying for the complexity. In this CL we now look for variable declarations inside of scoped Blocks. If the code doesn't add any vardecls into scoped Blocks, there's no risk of scope problems, and we don't need to use a temp-var to store our return expressions. If any vardecls are added, we go back to using a temp-var as before. Change-Id: I4c81400dad2f33db06a1c18eb671ba2140232006 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/346499 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com> |
||
---|---|---|
.. | ||
toolchain | ||
__init__.py | ||
bench.gni | ||
BUILD.gn | ||
BUILDCONFIG.gn | ||
call.py | ||
checkdir.py | ||
checkpath.py | ||
codesign_ios.py | ||
compile_ib_files.py | ||
compile_processors.py | ||
compile_sksl_tests.py | ||
copy_git_directory.py | ||
core.gni | ||
cp.py | ||
create_sksl_fp.py | ||
dehydrate_sksl.py | ||
effects_imagefilters.gni | ||
effects.gni | ||
find_headers.py | ||
find_msvc.py | ||
find_xcode_sysroot.py | ||
flutter_defines.gni | ||
fuchsia_defines.gni | ||
gen_plist_ios.py | ||
gm.gni | ||
gn_meta_sln.py | ||
gn_to_bp_utils.py | ||
gn_to_bp.py | ||
gn_to_cmake.py | ||
gpu.gni | ||
highest_version_dir.py | ||
ios.gni | ||
is_clang.py | ||
make_gm_gni.py | ||
opts.gni | ||
pdf.gni | ||
push_to_android.py | ||
rm.py | ||
run_sksllex.py | ||
samples.gni | ||
shared_sources.gni | ||
skia.gni | ||
sksl_tests.gni | ||
sksl.gni | ||
tests.gni | ||
utils.gni | ||
xps.gni |