Before this change, the DEAD_CODE analysis only alerted on statements that follow:
- a return
- an unlabeled break
- an unlabeled continue
My change adds the following to that list:
| # This script is as dead simple as it can be. It emulates the behavior of the | |
| # `.test` files at https://github.com/flutter/tests/blob/main/registry/ | |
| # but assumes that all of the mentioned repos are already cloned, and in the | |
| # current directory. (For example, see in `analyze_assorted_layout_widgets`, | |
| # the first step is `pushd flutter-assorted_layout_widgets` which is relative | |
| # to the current directory.) Limiting the git work to `git fetch` and | |
| # `git checkout` should keep the overhead low.: | |
| # | |
| # The hashes are hard-coded here, so you'll have to hand-update them with the | |
| # registry mentioned above. If you have `flutter/tests` cloned, you can |
| enum X { a, b } | |
| const bool foo = X.a == X.b; // <-- won't compile | |
| void main() { | |
| print(foo); | |
| } |
| import 'dart:math' as math; | |
| // Poorly named wrapper for math.Random | |
| class Random { | |
| math.Random inner; | |
| Random(this.inner); | |
| } | |
| void main() { |
| void main() { | |
| var a = new AImpl(); | |
| var b = new B(a); | |
| print("CALLING W/O NAMED ARG"); | |
| b.a(); | |
| print("CALLING W/ NAMED ARG"); | |
| b.a(followLinks: false); | |
| } | |
| abstract class A { |
| import 'dart:async'; | |
| import 'dart:collection'; | |
| void main() async { | |
| print('Function arguments that cannot be null'); | |
| // dart:async | |
| //tryy('runZoned(null)', () => runZoned(null)); | |
| //tryy('scheduleMicrotask(null)', () => scheduleMicrotask(null)); | |
| await trya('Future.doWhile(null)', () => Future.doWhile(null)); | |
| await trya('Future.forEach(_, null)', () => Future.forEach([1], null)); |
| # Ring the bell if any background window rang a bell | |
| set -g bell-action any | |
| # Default termtype. If the rcfile sets $TERM, that overrides this value. | |
| set -g default-terminal screen-256color | |
| # Keep your finger on ctrl, or don't | |
| bind-key ^D detach-client | |
| # Create splits and vertical splits |
Before this change, the DEAD_CODE analysis only alerted on statements that follow:
My change adds the following to that list:
Examining imports, and now the shown names on imports, is an expensive operation, as it potentially requires examining all of the elements in a library to discover if an import, or a shown name on an import, is used. So I wanted to test whether the new UNUSED_SHOWN_NAME warning significantly increases analysis time.
It obviously should increase analysis time by some amount, as it is doing extra work that wasn't being done before, but I wanted to measure this increase
Some very popular Markdown implementations include support for a table syntax (pandoc, PHP Markdown Extra, and GitHub-Flavored Markdown, to
| # Through vertical-arrows (first 10 ifs) | |
| %self total self wait child calls name | |
| 7.60 1.284 1.284 0.000 0.000 25396 String#split | |
| 5.60 0.946 0.946 0.000 0.000 117606 Array#flatten | |
| 4.08 0.690 0.690 0.000 0.000 487582 Regexp#match | |
| 4.03 1.053 0.680 0.000 0.372 393708 SCSSLint::ControlCommentProcessor#retrieve_comment_text | |
| 3.53 0.597 0.597 0.000 0.000 522139 Kernel#is_a? | |
| 3.42 0.860 0.578 0.000 0.282 396943 Enumerable#any? | |
| 3.21 0.542 0.542 0.000 0.000 492675 Kernel#class |