Commit Graph

19418 Commits

Author SHA1 Message Date
Konstantin Shcheglov 6469f4c78a Support for extracting widget from a function.
R=brianwilkerson@google.com

Change-Id: I2775ac681f14d26d96a872aae98c473062d47305
Reviewed-on: https://dart-review.googlesource.com/47380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-20 23:29:19 +00:00
Dan Rubel d26c310a27 Rework parsing of local const declarations
Similar to earlier work that reworked parsing of variable declarations,
this CL reworks parsing of local constant declarations to use
TypeInfo rather than parseType. This simplifies and improves recovery,
and reduces the number of error messages in some recovery situations.

Change-Id: I32705bdba20a0cb7aee41c64510c4c2896a5ae68
Reviewed-on: https://dart-review.googlesource.com/47241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 22:50:20 +00:00
Konstantin Shcheglov 8abeb56ebb Basic 'Extract Widget' refactoring.
Only a widget creation expression can be extracted.

Not exposed through Analysis Server API.

R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I6a47cc1851d69b54a2812bd6a5320c287d5b9eae
Reviewed-on: https://dart-review.googlesource.com/47360
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 21:24:56 +00:00
Sigmund Cherem 996277d427 Entity-fy the non-frequence minifier so it can be supported under the CFE.
This minifier is used only when passing --no-frequency-based-minification.

Closes #32600

Bug: https://github.com/dart-lang/sdk/issues/32600
Change-Id: I91ae293c78f4cfe3dd0421493162d9e5744a9217
Reviewed-on: https://dart-review.googlesource.com/47303
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-20 20:28:53 +00:00
Brian Wilkerson 0e764393f3 A few more Dart2 related fixes
Change-Id: If2503b93e11f0831787dfa21e5ae0abb74e9162f
Reviewed-on: https://dart-review.googlesource.com/47302
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 20:17:59 +00:00
Konstantin Shcheglov 965cb81c0f Add AnalysisSessionHelper and move getClass() into it.
R=brianwilkerson@google.com

Change-Id: I5d1f121ff86d1eea75d6f79663394bb79305c4ca
Reviewed-on: https://dart-review.googlesource.com/47187
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 19:05:24 +00:00
danrubel 08d305bbd7 Inline modifiers into endTopLevelFields and endFields events
Change-Id: I9681e22ae96c43626558ff567cbf4a12117095fa
Reviewed-on: https://dart-review.googlesource.com/47240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 15:00:35 +00:00
Brian Wilkerson efab00ce5c Fix type issues caused by running with --preview-dart-2
Change-Id: I99758d562e0140095d8f539419da9a98a55e6132
Reviewed-on: https://dart-review.googlesource.com/46941
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 13:36:17 +00:00
Dan Rubel adb9f8cc0b Inline modifiers into beginClassDeclaration and beginNamedMixinApplication
Change-Id: I0d95029c203a77d4a9e9dc2d8f1b40bced7535c5
Reviewed-on: https://dart-review.googlesource.com/47186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 13:28:17 +00:00
Dan Rubel fd005e17bc Rework parsing of local function declarations
This CL reworks parsing local variable and local function
declarations to improve recovery and error messages.
In addition, the fasta parser properly parses metadata
before a local function declaration.

Change-Id: Ia43c8bab3f3ce3b824390a4aa36d50b85f1ea9af
Reviewed-on: https://dart-review.googlesource.com/46952
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 12:01:26 +00:00
Johnni Winther 8eb749e032 Fix sourcemaps/name_test for kernel
Change-Id: I77e60ae236cf8a17edc3854496fc900d67915bd0
Reviewed-on: https://dart-review.googlesource.com/47040
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-20 11:35:49 +00:00
Sigmund Cherem 031ef989ac Provide better error message when a linked dependency doesn't exist
This comes up for dart2js when the location for dart2js_platform.dill is invalid
or when the file was not provided. Today dart2js produces a bad crash message in
that scenario, instead of a readable error.

I wanted to provide a better message, but I'm not sure I can. For example, I
wanted to say "SDK Platform file not found", but I can't because linked
dependencies can be used for other puposes.

Change-Id: I1739ec36dab16b2fd72552e5e7716cd573a8ebd0
Reviewed-on: https://dart-review.googlesource.com/46943
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-20 01:03:37 +00:00
Jenny Messerly d9878ae0da fix regression in DDC handling of top-level field named 'name'
Also refactors the code to make this sort of issue less likely.

Change-Id: Iff72e53720ba78e84c3d219e69ccd0d6a47c09a0
Reviewed-on: https://dart-review.googlesource.com/47188
Commit-Queue: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2018-03-20 00:49:58 +00:00
Konstantin Shcheglov ac322d0fb4 Move LibraryElement caching to AnalysisSession.
I need something similar for Extract Widget refactoring - get references
to some Flutter types, which are probably already available from the
resolved unit.

R=brianwilkerson@google.com

Change-Id: I8d9a9e6c35c9fe7ef8fba6547c560642f650d018
Reviewed-on: https://dart-review.googlesource.com/47184
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 22:26:47 +00:00
Brian Wilkerson 2047d44631 Handle the case where there is no selection(issue 32563)
Change-Id: I5f1981a89a5af438ccc0e0b4395083ed04cda180
Reviewed-on: https://dart-review.googlesource.com/47185
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 22:06:37 +00:00
Dan Rubel 06949dc985 Inline modifiers into beginFactoryMethod event
Change-Id: Ibc1053126b020577625279f4fab0bcff71aa5d15
Reviewed-on: https://dart-review.googlesource.com/47182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 22:04:37 +00:00
Konstantin Shcheglov 8eb9f3db80 Create new AnalysisSession instance on changes.
R=brianwilkerson@google.com

Change-Id: I98ec3e28eadc20076a22ae9ac5d872557e73c9ef
Reviewed-on: https://dart-review.googlesource.com/47181
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 21:01:38 +00:00
Brian Wilkerson 9df1d66b57 Flip analyzer and server to preview-dart-2 by default
Change-Id: I5d009debf962ba49ae715a87aa117538f552fbdb
Reviewed-on: https://dart-review.googlesource.com/47122
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 20:57:17 +00:00
Dan Rubel 8fde515354 Inline modifiers into beginTopLevelMethod event
Change-Id: I40423fcd53dc6a374a1c5be280d1806c31f34a6d
Reviewed-on: https://dart-review.googlesource.com/47120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 20:20:37 +00:00
Konstantin Shcheglov 1d184ace7b Fixes for packages:args deprecated uses.
Mostly addOption() -> addMultiOption().

Change-Id: Iab40059aab45a371e0def89fbdfcd08bd1487d47
Reviewed-on: https://dart-review.googlesource.com/47121
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 20:15:37 +00:00
Sigmund Cherem 0c75857ad8 Fix old2new API conversion to use utf8.encode
Pub still uses the old API to provide inputs. Source files are provided as
String, which were were incorrectly provided as codeunits. The FE expected the
binary input to be utf8 encoded.

As a separate follow up, I can update pub to provide binary data directly, or
even move it to use the new API instead so we can delete the old API soon.
Because pub-build is being replaced, I'm inclined to only do a small fix there.
Closes #32561

Bug= dartbug.com/32561
R=johnniwinther@google.com

Change-Id: I69d9ac896d534427a918ded721ee946aa5c0fc34
Reviewed-on: https://dart-review.googlesource.com/46945
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-03-19 19:55:16 +00:00
Brian Wilkerson 6856e70b2f Disable unused tests
Change-Id: Ib5c50063215e282c2b28b2b2fc207a3d63f81413
Reviewed-on: https://dart-review.googlesource.com/47100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 18:00:26 +00:00
Lasse Reichstein Holst Nielsen a81bc639b5 Fix bug in BigInt.from with certain double values.
Add test.

Change-Id: I385f7237e1b3d004b4401e18a82919b15d097181
Reviewed-on: https://dart-review.googlesource.com/46460
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2018-03-19 17:46:35 +00:00
Konstantin Shcheglov 538dbb62d6 Don't expect type arguments for class type parameters of static methods.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32396
Change-Id: I4b6b6804cfced4c6628198a7e99e0123f77c2108
Reviewed-on: https://dart-review.googlesource.com/46940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-19 17:03:15 +00:00
Brian Wilkerson 209809eee0 Changes to AST impl classes
Change-Id: I2889157892e4a9666d15c5346d0ea24fe8d9d7a0
Reviewed-on: https://dart-review.googlesource.com/47062
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 16:19:56 +00:00
Brian Wilkerson 1560f19844 Fixes to make analyzer preview-dart-2 safe, part 1 of many
Change-Id: I8f88168a1fab61b3d0d808b5d9e09e6391325302
Reviewed-on: https://dart-review.googlesource.com/46953
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-19 13:15:46 +00:00
Johnni Winther c3f177b8cc Add FutureOr to dart2js static type system
Change-Id: I0e26c82fffaa41d2e3fc02ba4d2b253c3673ce1a
Reviewed-on: https://dart-review.googlesource.com/46260
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-19 11:50:55 +00:00
Brian Wilkerson 746c2557a2 Correctly handle casts of Set in quick fix
Change-Id: I00067a03b41cc0ace16501fc21b990b91ea0af61
Reviewed-on: https://dart-review.googlesource.com/46944
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-17 14:55:38 +00:00
Emily Fortuna db21add40c Adding test for async closures with type variables, and fixing how we emit stubs
with type parameters in the meanwhile.

Change-Id: I5fe1e94e7423af30adf4020b46269b8ea81ac07f
Reviewed-on: https://dart-review.googlesource.com/46700
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-16 17:46:18 +00:00
Alexander Markov 9a20a001a6 [vm/kernel/aot] Make static non-const fields nullable in TFA
In Dart, if initializer throws an exception, a static non-const field
will have a null value, even if result of initializer is non-nullable.
This CL fixes TFA to make static non-const fields with initializer
nullable in order to correctly handle this case.

Change-Id: Ib451927b3da508c18ea43fcd0533066fb129a45e
Reviewed-on: https://dart-review.googlesource.com/46577
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2018-03-16 17:15:47 +00:00
Konstantin Shcheglov 91d3c02d19 Rewrite relative URIs in instrumented Flutter outline code.
R=brianwilkerson@google.com, devoncarew@google.com

Change-Id: I33e73400643d77eb7c2b105eae918f4997e7d55d
Reviewed-on: https://dart-review.googlesource.com/46920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-16 16:52:40 +00:00
Brian Wilkerson f6f1327fbe Add a fix to add an explicit cast
Change-Id: Ib27b2609cce14ea6d7c1666388c653e757b82a64
Reviewed-on: https://dart-review.googlesource.com/46881
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-16 16:43:58 +00:00
Dan Rubel b2dd274e08 Remove modifiers from local function event structures
This removes pushing and popping modifiers when parsing a local function
declaration since they cannot have modifiers.

Change-Id: Iabbc6bb050d7006d07d4ec5d2220947593d62fd6
Reviewed-on: https://dart-review.googlesource.com/46880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-16 16:05:07 +00:00
Kevin Millikin 8108ad9e0e Make the Kernel serializer implement, not extend, Visitor
Extending visitor makes it impossible to get a static error when new
syntax is added to Kernel.  Also, add @override annotations so we can
get a hint when syntax is removed from Kernel.

Change-Id: I9f3111e406e9994e76a637d2782e24cde264fd31
Reviewed-on: https://dart-review.googlesource.com/46721
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-16 11:03:57 +00:00
Peter von der Ahé e5c84938f2 Update names derived from Program
Change-Id: Ifdb072506fef909ccf5ad2e5270b1976ae61e3cc
Reviewed-on: https://dart-review.googlesource.com/31143
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-16 09:33:07 +00:00
danrubel f1ebe2bd5c Inline utility method closeBraceTokenFor
Now that Token implements endGroup, there is no need for a type check
and the associated utility method can be inlined.

Change-Id: Ibb7b54837e4b459dbfa35b987c67794b05e0d579
Reviewed-on: https://dart-review.googlesource.com/46576
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 23:29:35 +00:00
Konstantin Shcheglov 2881ebcd78 Fix for lint non_constant_identifier_names.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/32488
Change-Id: I76580a581845d8c6d3c8003b6b0f631a5fc40cdb
Reviewed-on: https://dart-review.googlesource.com/46822
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 22:44:44 +00:00
Konstantin Shcheglov 64e092d4a3 Add fields codeOffset/codeLength to FlutterOutline.
R=brianwilkerson@google.com

Change-Id: I917a780704882fcd7537a9334febc21098aabd4f
Reviewed-on: https://dart-review.googlesource.com/46579
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-03-15 21:01:14 +00:00
Brian Wilkerson 02ac20deb0 Fix bug in optional new/const support
Change-Id: I5798e3ea145f87fe34a996205e2903533179918f
Reviewed-on: https://dart-review.googlesource.com/46578
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 20:52:34 +00:00
Konstantin Shcheglov c9cb9c6700 Infer type arguments in constructor redirections.
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/30855
Change-Id: I05e9102fe7b7a304be6ac6dd4d59e11bdafee59c
Reviewed-on: https://dart-review.googlesource.com/46575
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 19:37:45 +00:00
danrubel 236c8dae8d Remove unnecessary typeContinuation variable
Change-Id: I1a78007491598b3a2d17091e96519182bd921f8d
Reviewed-on: https://dart-review.googlesource.com/46569
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 19:32:35 +00:00
Brian Wilkerson a0295ffa0e Convert analysis_server tests to pass under preview-dart-2
Change-Id: Ibfdc53c7b1252166d44a0bda077e464a8c474572
Reviewed-on: https://dart-review.googlesource.com/46574
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 18:49:24 +00:00
Brian Wilkerson e9cdb5d4a8 Convert more analyzer tests to pass under preview-dart-2
Change-Id: Id2c7069da725db2d2572507fb73b51f5ab574d8a
Reviewed-on: https://dart-review.googlesource.com/46571
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 17:25:54 +00:00
Brian Wilkerson b15860f43a Convert analyzer_plugin tests to pass under preview-dart-2
Change-Id: I4531491524de0e93391a75a3972f249d604f0e2b
Reviewed-on: https://dart-review.googlesource.com/46568
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 16:54:59 +00:00
Brian Wilkerson 7a607ab239 Convert analyzer_cli tests to pass under preview-dart-2
Change-Id: I763ddcb880db9d7afb633d145c3de70dfb96f7b9
Reviewed-on: https://dart-review.googlesource.com/46567
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 16:46:54 +00:00
Brian Wilkerson 8819d9fe98 Update analyzer tests for preview-dart-2, part 1
Change-Id: I3440607f7b3892193e1d9883709a1b9d4a7463d9
Reviewed-on: https://dart-review.googlesource.com/46562
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-03-15 16:45:04 +00:00
Samir Jindel 34cfabff5d Add expectation.
Change-Id: I1b07ece35aece7cd2de57065529209635721144b
Reviewed-on: https://dart-review.googlesource.com/46760
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-15 13:50:57 +00:00
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00
Samir Jindel 4289a9967b Check expected outputs of transforms.
Change-Id: I56ff4d4391b7a22d709dc60b696646895928e34c
Reviewed-on: https://dart-review.googlesource.com/46100
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-03-15 12:11:13 +00:00
Dan Rubel 71e16622cd Improve for statement errors and recovery
This CL updates fasta parsing of `for` statements
to detect additional errors and improve recovery.

The parser originally called parseType when parsing `for` statements
which committed the parser down a particular path
and limited the ability of the caller to gracefully recovery.
Now the parser calls computeType, which parses and caches
the type information, so that the caller has more opportunity
to recover gracefully.

Change-Id: I6296ffb1f75e77a87a7533bfca77dae18cfcf60d
Reviewed-on: https://dart-review.googlesource.com/46383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 11:43:13 +00:00