The whereType method silently does the wrong thing without methods,
so make it throw until we turn them on everywhere.
Change-Id: Id934c8bdb4f682dbc3560d78fbca580e37297e2d
Reviewed-on: https://dart-review.googlesource.com/45744
Reviewed-by: Nate Bosch <nbosch@google.com>
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.
Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
There are a few bug fixes here as well. Most notably, `.name.name`
instead of `.name` in DDK's analysis of virtual accessors. DDC/K's
handling of spread arguments in JS interop was also fairly broken
(it was generating a RestParameter instead of Spread). There's
also a lot of cleanup in js_ast as well, to make it a bit more
type safe.
Change-Id: Ia5333179e6dd0a62f20ce64a2b2b8bedf2ed7c49
Reviewed-on: https://dart-review.googlesource.com/44700
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
We use renamable variables for Dart libraries, this ensures we still
export it with the correct name.
Change-Id: I96dc161e33d265c0ffbd07f8d642629504dffe62
Reviewed-on: https://dart-review.googlesource.com/42892
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
This generates string.length instead of string[dartx.length]. Will
do same kernel side if this looks good.
Change-Id: I1fed3ca3febfa441ba36a0be34d06ab9e2e103c8
Reviewed-on: https://dart-review.googlesource.com/44280
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
* Ensure that chain paths have a trailing slash.
* Don't use ANSI escapes when terminal doesn't support them.
Both changes combined should change the logged output on build bots from running pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart from:
<ESC>[2K[ 00:00 | 0.0% | + 0 | - 0 ]: sourcemaps_ddk//breakpoint_on_class_all_in_one_line.unformatte setup<ESC>[1A
To:
[ 00:00 | 0.0% | + 0 | - 0 ]: sourcemaps_ddk/breakpoint_on_class_all_in_one_line.unformatte setup
Change-Id: I0f79e7cefb4e5bcba3002aa49f624cc0a2f7032c
Reviewed-on: https://dart-review.googlesource.com/43402
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
We were avoiding it in most cases, but a few slipped in.
Also refactors a few `uri.toString() == value` to test the scheme and
path, avoiding the expensive `Uri.toString()` call.
Change-Id: I7500a1fa9139b0cc0f2d5bd6d899f6563ec402b8
Reviewed-on: https://dart-review.googlesource.com/42463
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
For example, hover now works on `async` in `async.scheduleMicrotask`:
import 'dart:async' as async;
main() {
async.scheduleMicrotask(() { print('hi'); });
}
This does not change the import line or types, as neither of those
currently supports hover.
Change-Id: I4d9d61fb4e67ebda02cc6c1ce982b35b31d799bc
Reviewed-on: https://dart-review.googlesource.com/42086
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
Our SDK tests explicitly disable this. I'd like our external apps to
have this disabled as well - not sure it's coming up there.
Internally, we will need to enable in our bootstrap code. I'll turn
that on there for now - but perhaps we can make that a per-target thing.
Change-Id: I484e048126d8d75f31f404029b94efe1d822c49e
Reviewed-on: https://dart-review.googlesource.com/28381
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
We already do this in most cases when we have a constructor initializer
and the field initializer is side effect free (e.g. implicit null or a
literal). But `this.` fields were not recognized as being initialized
explicitly by the constructor.
This is already working in DDC+Kernel (because `this.` parameters are
desugared).
Change-Id: I2af1a71681451adf00c1807b2c41dad874a9465a
Reviewed-on: https://dart-review.googlesource.com/41961
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
This change improves DDC/DDK source maps:
- fix Analyzer backend step locations to pass all of the tests
Kernel was passing. Also improves breakpoints and code coverage.
- fix Analyzer backend to mark hover spans where possible, such as
fields, parameters, locals, `this`, properties, methods, etc.
- refactor DDC/DDK backends to emit source locations, rather than
pointers to Analyzer/Kernel tree nodes.
- unify/simplify source_map_printer between Analyzer/Kernel backends.
- source_map_printer understands JS expression nesting, marking the
innermost JS expression offset corresponding to a given Dart offset.
This preserves hover tooltips, even for expressions with implicit
coercions (e.g. `dart.test(x)`)
- source_map_printer understands that JS end-of-function markings need
to be before the closing brace.
- merge _visitAndMarkExpression and _visitExpression to simplify
Analyzer & Kernel backends.
- fix test expectations where the column location was too specific.
- adds a message to the stepping test runner to help future debugging.
- removes optional destructuring support from Analyzer backend. This
was unused/untested and added complexity. Instead we should decide
if/when to fully switch to destructuring, and then do so.
Change-Id: Ic47b4e21447fffc8fb1809b7bf8ffceeeb61b43e
Reviewed-on: https://dart-review.googlesource.com/42028
Reviewed-by: Vijay Menon <vsm@google.com>
1. Make bitLength work on very large values. This fixes problems with
BigInt.from on large values.
2. Restructure to allow Math.clz32 to be used once dart2js no longer
supporst IE11.
Change-Id: I255f030ff3b3630cdee63502d11a8b6630a4f008
Reviewed-on: https://dart-review.googlesource.com/41960
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
This gets DDC and DDK to handle the block body of functions/methods in a
similar way, eliminating it from the JS if it is not necessary, and fixes
a bug in DDC for cases where we do need to emit a nested block scope.
Change-Id: I37d3d69bfcf9b1204385cca7785601fb7d6edfc3
Reviewed-on: https://dart-review.googlesource.com/41565
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
(was reverted in https://dart-review.googlesource.com/c/sdk/+/40980
due to an analyzer bot breakage)
Original commit message:
Implement proper checking for callability of Function class.
There was some old (incorrect) logic for doing this, behind the flag
enableStrictCallChecks. This flag has been removed, since the new
behavior is now standard in Dart 2.0.
Fixes#31509
Change-Id: Ice5cf38bbc648badf7f2563ff930b69f9a799635
Reviewed-on: https://dart-review.googlesource.com/41120
Reviewed-by: Jonas Termansen <sortie@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Note: by default, it uses the dartdevc/dartdevk snapshot on your path.
Use the -d flag to run against current sources.
Change-Id: I3dbce41653258b9d965505dba66458d07124409f
Reviewed-on: https://dart-review.googlesource.com/40120
Reviewed-by: Jenny Messerly <jmesserly@google.com>
This was unintentionally regressed during a fix to field init order. It
does not typically show up in Dart code because undefined and null are
both handled, but it can break JS interop.
Change-Id: I771895826ee09bb6c5e2f9b016eb7673caf61cd1
Reviewed-on: https://dart-review.googlesource.com/40202
Reviewed-by: Vijay Menon <vsm@google.com>
Also fixes some issues with field initializers; stepping and hover
tooltips should work reasonably now.
Change-Id: I2d0e9e7e14a52ee8c020902f80f835a913f494f3
Reviewed-on: https://dart-review.googlesource.com/39860
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
Changes signature of Iterable.singleWhere.
Makes LinkedHashMap no longer be a HashMap.
Change-Id: Ibd7e56e1ac03cb9fb10d19d1328d452fcd06d89f
Reviewed-on: https://dart-review.googlesource.com/32541
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
All internal cast failures should be fixed now, so we don't need to
ignore this type any more.
Change-Id: I206d7865f5a3293e579f31e96e919b69b572200f
Reviewed-on: https://dart-review.googlesource.com/38980
Reviewed-by: Vijay Menon <vsm@google.com>
also fixes#31058, DDC failed to execute all field initializers
(already fixed this in DDK when porting code_generator).
also fixes assertion_initializer_test, it was not strong mode clean, so
it was not giving any meaningful results for runtime behavior.
Change-Id: I290b266ad77ed92851cc2d0617690c6c021182a3
Reviewed-on: https://dart-review.googlesource.com/37866
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
As far as I can tell, this case never gets hit because there is separate
support for ignoring cast failures on function types elsewhere.
Change-Id: I78bd8d0af10764477505545384f5103f294228bf
Reviewed-on: https://dart-review.googlesource.com/37648
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Whenever we install a getter or setter, we need to install a corresponding
one that calls `super`, because JS treats getters/setters as pairs for the
purposes of lookup. Normally we generate the paired super accessor, but for
mixins we cannot, because we don't know what the `super` will be at compile
time. So the fix is for `mixinMembers` to handle it at run time.
Change-Id: I2b14ea437720bd26f2879c7daac5b3f796d48038
Reviewed-on: https://dart-review.googlesource.com/37645
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>