Working towards turning on all lints from package:pedantic. This change includes
the lints that needed cleanup and don't change any behavior.
Applied cleanup:
* Don't explicitly initialize variables to null.
* DO use curly braces for all flow control structures.
* Use `.isEmpty` instead of `.length == 0`.
* Use `.isNotEmpty` instead of `.length > 0` or `! .isEmpty`.
* Use `=` to separate a named parameter from its default value.
The remaining lints from package:pedantic will require cleanup that is less
automatic and will be addressed in later changes.
Change-Id: Ie4c3ba685f8a559209dd14ac037203ecd16252c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103086
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Previously 36% of overrides were annotated, including inconsistent
annotations within a single class.
- Add annotations on remaining overridden methods.
- Add linter section to `analysis_options.yaml` so that missing
annotations are visible while editing.
Change-Id: Ief1a6d5b8da6f4b630a6cfc72a6ed67db346c081
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103140
Reviewed-by: Vijay Menon <vsm@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
The new file pkg/dev_compiler/lib/src/analyzer/driver.dart handles
building the linked summary for a build unit, and then is capable of
doing analysis using LibraryAnalyzer.
The algorithm is very similar to analyzer_cli's build mode. The
biggest difference is that `dartdevc` has existing support for
discovering source files from the explicit source list (rather than
requiring every source to be listed on the command line). We don't want
to break that support, so there's a bit of logic to follow imports,
exports, and parts.
After the linked summary is produced, DDC gets the analysis results
(errors and resolved AST) for each library, and compiles it into a JS
module.
Change-Id: I7bf1ce1eca73fd036002e498de5924c488b534dc
Reviewed-on: https://dart-review.googlesource.com/c/82469
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Dart for-in loops allow `var x = [1]; for (var x in x) {}`, which is not
allowed in JS. If this pattern is detected, a temporary variable is
introduced so the for-in initializer expression is evaluated outside of
the JS for-of loop.
(This issue seems to be unique to for-in loops. For loops and other
kinds of variable declarations of the form `var x = ...` are not
allowed to use `x` in the initializer, even if `x` is declared in an
outer scope.)
Also fixes an out-of-date comment in the DDC+Analyzer backend.
Change-Id: I35b272a5a311f7b6f104cc82a99cc83a6ed5c247
Reviewed-on: https://dart-review.googlesource.com/c/79142
Commit-Queue: Alan Knight <alanknight@google.com>
Auto-Submit: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Alan Knight <alanknight@google.com>
Adds an option for specifying the output JS module name if that is
needed (only applies for some module formats).
Also removes repl-compile (it's set via API, not the command line).
Refactors dartdevk options to match dartdevc so we can migrate more
easily. Moves shared code into a shared location and removes copied
code.
Change-Id: I966343ecbbc962f5d0f14ea7e65d78660159f420
Reviewed-on: https://dart-review.googlesource.com/64823
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This uses optional new/const and `=` in named argument defaults.
All changes are automated, except for:
- utils/dartdevc/BUILD.gn: run DDC build scripts with --preview-dart-2
- pkg/dev_compiler/tool/patch_sdk.dart: add a TODO that Analyzer doesn't
supporting implicit const in libraries.dart
- pkg/dev_compiler/tool/input_sdk/libraries.dart: was not formatted due
to the aforementioned Analyzer bug
- tools/bots/test_matrix.json: run DDC sourcemap suite in Dart 2 mode
- pkg/pkg.status: skip pkg/dev_compiler if running in Dart 1 mode
Change-Id: I9b80ccba0c2cc7b66efc662a0b16562e3660aee3
Reviewed-on: https://dart-review.googlesource.com/60402
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This works around broken FunctionTypeImpl.== in Analyzer. Also
makes DDK's type naming heuristic more consistent with DDC.
Change-Id: I09527fad681c3fdc6c66654e572e9b03c57491bd
Reviewed-on: https://dart-review.googlesource.com/37120
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This ports a fairly large part of DDC's Analyzer-based code generator,
however most nodes are not supported yet.
The goal is to preserve all functionality of code that was ported,
except for deprecated features (e.g. mirrors, fuzzy arrows, libraryRoot).
Change-Id: I3b10d5773c7c10a740fa336720243b03c6b82529
Reviewed-on: https://dart-review.googlesource.com/10705
Reviewed-by: Vijay Menon <vsm@google.com>
Optimize dynamic call tracking using random sampling.
Apply source maps to improve dynamic call tracking accuracy.
Dynamic calls within the sdk are now attributed correctly.
Fix bug formatting modules where we were incorrectly flagging them as JS.
BUG=
R=jmesserly@google.com, vsm@google.com
Review-Url: https://codereview.chromium.org/2811343002 .
Bazel build rules now place the sdk summary in a different directory
than the summary root directory. Fix the ddc compiler running in the
browser to match.
BUG=
R=vsm@google.com
Review-Url: https://codereview.chromium.org/2753723002 .
This updates DDC options processing to support:
* --options /path/to/analysis/options/file.yaml
* --enable-strict-call-checks
* --supermixin
* --no-implicit-casts
* --no-implicit-dynamic
As well as general refactoring and cleanup of DDC options processing
R=vsm@google.com
Review-Url: https://codereview.chromium.org/2598593003 .