Commit graph

56116 commits

Author SHA1 Message Date
Paul Berry bbb8905075 Observatory strong mode fixes: specify type argument to .map when not inferable.
This ensures that the resulting Iterable will have the proper type
when run with strong mode semantics.

In Dart 1.0 semantics, the type argument to .map is ignored, so this
change should be safe.

Change-Id: I34924bc7e803b1520af7d174cfe80f5be6b7ac0f
Reviewed-on: https://dart-review.googlesource.com/55908
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 20:28:48 +00:00
Paul Berry 841a91b3a0 Observatory strong mode fixes: Add abstract Location.toUserString to Location.
This is necessary because many call sites invoke toUserString without
first casting to one of the derived classes.

This should be safe since both derived classes (SourceLocation and
UnresolvedSourceLocation) contain a definition of toUserString.

Change-Id: I69eeda326883d87fc4e8cedd732881d250cae8cb
Reviewed-on: https://dart-review.googlesource.com/55909
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 20:07:39 +00:00
Alexander Aprelev fc206a7589 Add Kill isolate service request.
This is useful when embedder needs to kill an isolate that might be paused on a breakpoint.

Change-Id: If54decda5d16c694b81a25ae43d37f8eb41e8105
Reviewed-on: https://dart-review.googlesource.com/55276
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-05-21 20:00:58 +00:00
Paul Berry aad3270ab8 Observatory strong mode fixes: fix C-style parameter declarations.
This CL fixes some cases where Observatory mistakenly tried to use a
C-style parameter declaration, e.g.

    void foo(String);

The intent is to declare the parameter to have type `String`, but Dart
interprets the parameter as having *name* `String` and type `dynamic`.

In most cases the fix applies to abstract method declarations, whose
types aren't semantically relevant in Dart 1.0, so these parts of the
CL should be safe.

In one case it applies to a typedef, IsConnectedVMTargetDelegate.  The
only use of this typedef is as the type of
TargetRepository._isConnectedVMTarget, whose value is always the
static function ObservatoryApplication.isConnectedVMTarget.  The type
of ObservatoryApplication.isConnectedVMTarget matches the typedef
(according to Dart 1.0 rules) both before and after the change, so
this should be safe as well.

Change-Id: Ia67f5f14d5a012ccb8a44cbd88a8233f8c9ad171
Reviewed-on: https://dart-review.googlesource.com/55901
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 19:58:38 +00:00
Paul Berry ea4d10915c Observatory strong mode fixes: make return types more specific.
This CL addresses a code pattern where a method has a more general
return type than it needs, causing a strong mode error at the site
where the method is called or torn off.  For example:

    Object f() => 'x';
    void g(String callback()) { ... }
    void h() {
      g(f); // Error: () -> Object is not a subtype of () -> String
    }

The solution is to tighen up the return type.  In all cases in this
CL, it is obvious from the method definition that the value returned
at runtime will satisfy the tighter return type, so this should be a
safe change.

Change-Id: Ifbd476d969274342653d2619c1c81e2e014817c4
Reviewed-on: https://dart-review.googlesource.com/55904
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-21 19:52:38 +00:00
Aart Bik 0f506ba3ae Added period to comment for consistency.
Rationale:
Getting familiar with the Dart workflow.

Bug: none
Change-Id: If145b28fd3d6868b2208fa0239fd3ea5a88e79b9
Reviewed-on: https://dart-review.googlesource.com/55584
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2018-05-21 19:04:38 +00:00
Ryan Macnak 5ab4294074 [vm] Allow for creating a CoreJIT snapshot from a kernel file.
Change-Id: Ibc0ea5c75393c88bf70520fca6ff218ada0cd928
Reviewed-on: https://dart-review.googlesource.com/55840
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-21 18:20:06 +00:00
Alexander Aprelev d5b99860e4 [frontend-server] Introduce compile-expression command.
Change-Id: I5b200ab00076710b08527ec4b35322a6a5fcc4b9
Reviewed-on: https://dart-review.googlesource.com/49040
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
2018-05-21 18:11:09 +00:00
Mike Fairhurst ac8971a98a New package:build workspace before we support it at the language level.
Does not work with dartanalyzer, only dart analysis server.

Change-Id: I1d7c3fbbbda512d799ac44a6fa5a188d1a3bb8c3
Reviewed-on: https://dart-review.googlesource.com/55586
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
2018-05-21 17:45:28 +00:00
Brian Wilkerson 99eb2195c8 Add Forest support for break and continue statements
Change-Id: Id7b109ca9acaa6d68cdc0682109bb65bd7cda62f
Reviewed-on: https://dart-review.googlesource.com/55991
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-05-21 16:45:40 +00:00
Ryan Macnak 4d3ebab589 [vm] Fix error message when an API function is called without a current isolate.
Change-Id: Id29fe5d14a58d85984902952dc53cc56cda16ccc
Reviewed-on: https://dart-review.googlesource.com/55842
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2018-05-21 16:27:48 +00:00
Samir Jindel c31b9a461d [vm/kernel] Reference constants in Dill by offset into constants table.
Summary:

The constants table contains a concatenation of the variable-length encodings of
each constant used in the serialized component. Previously, we referenced the
constants in the code by index into the constants table, which requires reading
potentially the entire constants table to dereference. Now, we refer to the
constant by the binary offset into the constants table, which allows us to peek
into it in constant time.

Test Plan:

The constants table is used by all the precompiler modes, so the new encoding
will inherit the coverage of the existing encoding.

Results from debug and release precompiler bots are available under the
"cl-linux-try" button.

Change-Id: I4782bc0035d0b0cbd5bd6b9d086561ea601286c8
Reviewed-on: https://dart-review.googlesource.com/55470
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2018-05-21 15:54:08 +00:00
Brian Wilkerson 0ff6c20c66 Add Forest support for return statements
Change-Id: I84df2c0e392de16130e6933544a7aa41bb7d9a7f
Reviewed-on: https://dart-review.googlesource.com/55993
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-21 13:08:28 +00:00
Brian Wilkerson 85fbc71f22 More test framework cleanup
Change-Id: I9090c4f07154fb86621e8870158876053bad5336
Reviewed-on: https://dart-review.googlesource.com/55992
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-21 02:44:28 +00:00
Alexander Markov 6202749429 [vm/kernel/bytecode] Support try-catch-finally in bytecode generator
Change-Id: I2882546741b1dd8f6e03a21d85b5487fb754b742
Reviewed-on: https://dart-review.googlesource.com/55324
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-05-20 19:52:07 +00:00
Dan Rubel 78cc8a13a2 Improve type parameter recovery
This CL replaces several calls to parseTypeVariablesOpt with calls
to computeTypeParam with improved recovery for missing '>'.

In addition, this CL
* moves isOneOfOrEof to util.dart
* moves insertSyntheticIdentifierAfter into TokenStreamRewriter

Change-Id: I48080809d156dd98ccfed7aa2f67be254f4da201
Reviewed-on: https://dart-review.googlesource.com/55940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-20 12:02:56 +00:00
Dan Rubel 3e7eef12d4 Remove reference to token.previous
Change-Id: Ia1ae04e03b868dfb482d4853fac1c288331a6085
Reviewed-on: https://dart-review.googlesource.com/55942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-20 02:33:00 +00:00
Konstantin Shcheglov 5b4d67b22e Compute runtime completions in the context file itsef.
So, we support all elements - class fields, top-level functions and
variables, etc. And it is just simpler too.

R=brianwilkerson@google.com

Change-Id: Ifed8f9b8d8ef857750b28c48f851d8611a56ef22
Reviewed-on: https://dart-review.googlesource.com/55990
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-19 17:03:21 +00:00
Brian Wilkerson 720b6c963c Improve some tests and fix a Dart 2 error
Change-Id: Ia9581c5b27e7fc0540054b7acde9dd1a96dfe927
Reviewed-on: https://dart-review.googlesource.com/55981
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-19 15:06:51 +00:00
Stephen Adams ff76905aeb [dart2js] Don't try to generate stubs for generator bodies
Change-Id: I8e176d1ccb97d0c12d87427529f41e7db39d8723
Reviewed-on: https://dart-review.googlesource.com/55989
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-05-19 06:52:30 +00:00
Peter von der Ahé 4610daa1c1 Convert ThisAccessor to ThisAccessGenerator
Change-Id: I097c330712c789a65a1ce9c6a57ef0c81a3a32ed
Reviewed-on: https://dart-review.googlesource.com/55893
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-19 06:29:19 +00:00
Peter von der Ahé cb9bf910f9 Test that fasta_codes_generated.dart is up to date
Change-Id: If9fbbdaf495b32da7a5a288e2fe63bee6f29ee1e
Reviewed-on: https://dart-review.googlesource.com/55888
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-05-19 06:09:49 +00:00
Peter von der Ahé eec11ebe4a Convert ErrorAccessor to ErroneousExpressionGenerator
Change-Id: Ie62314781b264a56a77e466f334f6c9d8cec2cba
Reviewed-on: https://dart-review.googlesource.com/55887
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-19 06:09:49 +00:00
Kevin Moore a155d6c9e5 Update dependencies on async, collection, http_throttle packages
Helps with https://github.com/dart-lang/pub/issues/1899
...but there are still more issues with upload

Change-Id: I79fba90722631eb4a4685037478d25611a1d74c2
Reviewed-on: https://dart-review.googlesource.com/55988
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Commit-Queue: Kevin Moore <kevmoo@google.com>
2018-05-19 01:46:09 +00:00
asiva ce1dc86620 Adjust status file.
Change-Id: Iad9b4c3aaeabf22767a1e99d7d2e1033268570ee
Reviewed-on: https://dart-review.googlesource.com/55987
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-19 01:11:40 +00:00
Jenny Messerly 21fbf7d767 fix #33103, switch dartdevk to use Kernel nSM stubs
Change-Id: I383b36809b1e8b43f9f7a36ca84d8db5da7cef67
Reviewed-on: https://dart-review.googlesource.com/55266
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-05-18 23:43:58 +00:00
asiva 5632b1cb47 Adjust status file for precompiled target (see issue 33168)
Change-Id: Ice333a0f1ed11dfebb1f113f53a9f80d64207ff8
Reviewed-on: https://dart-review.googlesource.com/55986
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-18 23:02:08 +00:00
asiva 41468e7c03 [VM] bypass some app_jit tests which have issues with mismatched VM options between the snapshot version and the invoked dart process.
Change-Id: I3f22f75a47255ebb99b8f884044fc186b83ebcfc
Reviewed-on: https://dart-review.googlesource.com/55985
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-18 22:31:16 +00:00
Zach Anderson c38bca632d [fuchsia] Fix bad state error on namespace cleanup
We have to close the fds we got from the namespace before destroying
the namespace.

Change-Id: I3298868a444d262b4ded147a1dc8eb1a99c92a1c
Reviewed-on: https://dart-review.googlesource.com/55983
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-18 22:19:23 +00:00
Johnni Winther b911f78ee2 Use AbstractValue/AbstractValueDomain in function_set.dart
Change-Id: I8c2e80d7d6722254eec2c8753c2f37a495a9026a
Reviewed-on: https://dart-review.googlesource.com/55899
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-18 22:12:48 +00:00
Konstantin Shcheglov c9ea44bd8f Use the static type from the identifier element is local completions.
We always have fully reoslved unit, so usually actual types are available.

For the case when the type annotation cannot be resolved, keep the
old code that returns unresolved type string in this case. Probably
can be simplified more, e.g. remember declared types on the side instead
of passing them around just in case. Later.

R=brianwilkerson@google.com

Change-Id: Ida0b6caa90fc1408e5e7d12b762b19651cb201f6
Reviewed-on: https://dart-review.googlesource.com/55980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-18 22:06:08 +00:00
Dan Rubel 715ba58048 Remove reference to token.previous
Change-Id: Ia25035e592637376e5c8a895516b9e6dc53f5d62
Reviewed-on: https://dart-review.googlesource.com/55941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-18 21:47:28 +00:00
pq 4edb23cfc1 Bump to linter 0.1.51.
* `unrelated_type_equality_checks` now allows comparison between `Int64` or `Int32` and `int`
* `unnecessary_parenthesis` improved to handle cascades _in_ cascades

Change-Id: I588893132e04a706e9fc93a7a16a07005465eb1f
Reviewed-on: https://dart-review.googlesource.com/55914
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 21:03:16 +00:00
Nate Bosch 2ff2af7921 Allow running pub with --preview-dart-2
- Make a snapshot in Dart 2 mode
- Check for the VM argument `--preview-dart-2` and run the correct
  snapshot

Towards fixing https://github.com/dart-lang/sdk/issues/32188

Change-Id: I56d5e7f268ff40b80783fae571981705536280f2
Reviewed-on: https://dart-review.googlesource.com/54743
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2018-05-18 20:27:29 +00:00
Ben Konyi 7aacf7e188 [ VM / dart:io ] Fixed memory leak in SecurityContext on MacOS.
Fixes #33114.

Change-Id: I6e2272c6d63b11bbd82c3d5b7c3aedf75306ba05
Reviewed-on: https://dart-review.googlesource.com/55523
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-18 20:17:49 +00:00
Johnni Winther ada23cde0b Add deferred test for local functions
Change-Id: I9f4b67de9435e74378af72d2a0c0fc711c0b0252
Reviewed-on: https://dart-review.googlesource.com/55891
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-18 19:33:48 +00:00
Johnni Winther f1f660fe1e Small cleanup
Change-Id: I368fbaa3bac5a5a47c374f26998cce8ad8b265a6
Reviewed-on: https://dart-review.googlesource.com/55890
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-18 19:33:48 +00:00
Vijay Menon 9f6e8a3a96 Move DDC to Dart 2 snapshot
This is not yet working.

Change-Id: I86990eb7a8758d9bccee45997f30286d72a8925f
Reviewed-on: https://dart-review.googlesource.com/54532
Commit-Queue: Vijay Menon <vsm@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-05-18 19:13:08 +00:00
Konstantin Shcheglov be5b189c19 Exclude synthetic import prefixes from runtime completion.
R=brianwilkerson@google.com

Change-Id: I6ebcef8eab433782cc120810f50b872faa097314
Reviewed-on: https://dart-review.googlesource.com/55913
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-18 18:57:59 +00:00
Brian Wilkerson 7ac05a120a Add Forest support for do statements
Change-Id: Iefa5f5bda3f7b47cc230f4ae8da93fbe3897961f
Reviewed-on: https://dart-review.googlesource.com/55912
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 18:49:58 +00:00
Brian Wilkerson 029e1394f7 Make type promotion conditional depending on which builder is being used
Change-Id: I5a689de071ae9d34816d354ffc10e95e719cae4a
Reviewed-on: https://dart-review.googlesource.com/55910
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 18:21:27 +00:00
Konstantin Shcheglov 817965f49d Runtime completion support for constructors, for loops, and function expressions.
R=brianwilkerson@google.com

Change-Id: I3d33841b9386b6c9fb0e0f74946ca6fe9449581a
Reviewed-on: https://dart-review.googlesource.com/55911
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 18:14:32 +00:00
asiva 02e47a9731 [VM] Fix for issue 32188 (cannot use pub with --preview-dart-2)
- Fix for 'unable to read .packages file' error when generating
  kernel file (script snapshot).
- Make sync-async an isolate specific flag and turn it off for
  the kernel isolate as it runs in Dart 1 mode
- Include 'reify-generic-functions' and 'sync-async' flags to the
  list of flags to check an app JIT snapshot against.

Change-Id: I2b16270f65705213660487f9c15fe0348fc84c8b
Reviewed-on: https://dart-review.googlesource.com/55589
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Zach Anderson <zra@google.com>
2018-05-18 18:12:08 +00:00
Konstantin Shcheglov 97b6c2e09d Don't give Source and ResourceProvider to CompletionRequestImpl.
It knows them already.

R=brianwilkerson@google.com

Change-Id: I48de58d7de140b210b17a11d7cc085c43461803c
Reviewed-on: https://dart-review.googlesource.com/55905
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 17:52:28 +00:00
Brian Wilkerson 04816270fa Add Forest support for creating parenthesized conditions
Change-Id: I69aa15244dff20d18d7a34c6b052bd9eeed388ed
Reviewed-on: https://dart-review.googlesource.com/55761
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-18 17:51:08 +00:00
Konstantin Shcheglov 7a90ed9b88 Tests for completion with nested blocks, functions, and methods.
R=brianwilkerson@google.com

Change-Id: I050aaa2f80a3374fd92587a0b8461bc170078bd8
Reviewed-on: https://dart-review.googlesource.com/55903
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-18 17:43:38 +00:00
Brian Wilkerson 353ddbaea1 Add Forest support for while statements
Change-Id: Iffec7799642a44fc6ab2b5f8b7493135d2d05ac5
Reviewed-on: https://dart-review.googlesource.com/55906
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 17:34:28 +00:00
Johnni Winther 8d0bda43f3 Fix codesize regression from Cleanup after removing MirrorsData
Change-Id: If67905010f46797e0d007cf80973905a8f6e5537
Reviewed-on: https://dart-review.googlesource.com/55889
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-18 17:05:47 +00:00
Brian Wilkerson 802c25aff9 Add tests to test InstanceCreationExpressionImpl.canBeConst
Change-Id: Id678d054d7b54e5eb33e5f406efa7b51a7aa4361
Reviewed-on: https://dart-review.googlesource.com/55902
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-18 16:51:27 +00:00
Konstantin Shcheglov def6f6c86c Don't create linked groups when nothing was written.
In particular, if the type was invalid, so that we cannot write it.

R=brianwilkerson@google.com

Change-Id: I5499e17e2aa3527d21cab050b7fecfd3cd09efc7
Reviewed-on: https://dart-review.googlesource.com/55860
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-18 15:54:29 +00:00