Commit graph

20143 commits

Author SHA1 Message Date
Konstantin Shcheglov 76a30dd594 Initial implementation of 'execution.getSuggestions'.
Only local variables, no tests for multiple blocks, or parameters.
No support for classes yet.

No support for expressions or runtime variable types.

R=brianwilkerson@google.com

Change-Id: I9ec5c40e407cda48be408e4e4882d97349413b9c
Reviewed-on: https://dart-review.googlesource.com/55762
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-17 20:25:04 +00:00
Konstantin Shcheglov abb1ee98f7 Move library related operations to DartFileEditBuilderImpl. Initialize enclosing elements into fields lazily.
R=brianwilkerson@google.com

Change-Id: Ic933c9399f2288805e1f450f9d564e174516addc
Reviewed-on: https://dart-review.googlesource.com/55760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-17 18:41:49 +00:00
Dan Rubel 7d5ebb937b A few more Analyzer/CFE type argument tests
Change-Id: I32e3dd65f470893f1ff244412eae7fccc0a6c150
Reviewed-on: https://dart-review.googlesource.com/55740
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-17 17:17:16 +00:00
Konstantin Shcheglov 62ffedefdd Rewrite writing types to using existing writeXYZ() methods.
Also extract code that ensures imports and writes prefixes into a
separate method.

R=brianwilkerson@google.com

Change-Id: Icd35af19435153bfaebd46f7611823e6a9830d20
Reviewed-on: https://dart-review.googlesource.com/55640
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-17 15:51:27 +00:00
Dmitry Stefantsov d59745029a [fasta] Update expectation files after CL 50945
Change-Id: I639fe81e848bec4a3d8735f55750d59eb422763d
Reviewed-on: https://dart-review.googlesource.com/54246
Reviewed-by: Samir Jindel <sjindel@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-05-17 14:27:46 +00:00
Dmitry Stefantsov 6fc4854e98 [fasta] Run instantiate-to-bound on functions
Change-Id: Icff76f2e8f309b6d96059839f05b3ec4cc61510d
Reviewed-on: https://dart-review.googlesource.com/50945
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-17 14:27:46 +00:00
Dan Rubel b827b70e89 Extract IdentifierContext.typeVariableContext into new subclass
Change-Id: Iae637b02ee517e06d4d04f1e0f0289d760750195
Reviewed-on: https://dart-review.googlesource.com/55600
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-17 13:39:36 +00:00
Dan Rubel b7659e6d03 Improve typedef declaration recovery
This CL improves typedef recovery and removes another call to parseType.

Change-Id: I55aca86fe08bb06b040f5ec3c54266fcf795dbb3
Reviewed-on: https://dart-review.googlesource.com/55540
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-17 13:39:36 +00:00
Brian Wilkerson 7c1ae73a21 Fix a Dart 2 runtime bug in BodyBuilder
Change-Id: Iea2acd59b7b6283a6144dd06e1cabc0c10521d35
Reviewed-on: https://dart-review.googlesource.com/55583
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-17 13:18:16 +00:00
Peter von der Ahé 812189d3e7 Convert LargeIntAccessor to LargeIntAccessGenerator
Change-Id: I904562f31a5f03fb7dfdd8dac3db55b5085ed68a
Reviewed-on: https://dart-review.googlesource.com/55469
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-05-17 08:45:05 +00:00
Peter von der Ahé 5e98c49606 Convert ReadOnlyAccessor to ReadOnlyAccessGenerator
Change-Id: If4ba17b46dbe366ff148f50f55df99d79f492fe0
Reviewed-on: https://dart-review.googlesource.com/55467
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-17 08:45:05 +00:00
Peter von der Ahé 17e284fbc2 Convert DeferredAccessor to DeferredAccessGenerator
Change-Id: I591895d94b051534c0151e30689d1798d803796d
Reviewed-on: https://dart-review.googlesource.com/55466
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-17 08:45:05 +00:00
Johnni Winther d5719cae62 Small cleanup in compiler.dart
Change-Id: I2b3d3ce5925d6c7078250ab3fdadfc3daef90d73
Reviewed-on: https://dart-review.googlesource.com/55462
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-17 08:40:03 +00:00
Johnni Winther 54173bf293 Move TypeMask cache to CommonMasks
Change-Id: I908046245f822079dab41421b868a8cc786c9745
Reviewed-on: https://dart-review.googlesource.com/55463
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-17 08:05:42 +00:00
Johnni Winther 78f348b3d5 Don't export types/masks.dart from types/types.dart
To make uses of TypeMask explicit in the imports.

Change-Id: I7c0c2377b65720394dcda217e5e68a4e3f9a4e9c
Reviewed-on: https://dart-review.googlesource.com/55421
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-17 08:05:42 +00:00
Johnni Winther d2d763411d Use AbstractValue in inference results.
Change-Id: I2a932abd2d8d3236b560721c9d5ec010271d2b85
Reviewed-on: https://dart-review.googlesource.com/55362
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-17 08:05:42 +00:00
Johnni Winther 1c0b52ccc0 Reapply "Cleanup after removing MirrorsData" with fix
Change-Id: I4083b06ed2ea8d9e8bdc9e884803f238adb564fb
Reviewed-on: https://dart-review.googlesource.com/55420
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-17 08:01:22 +00:00
Jens Johansen e491bc5d86 Allow to specify what dill file to initialize from
This CL updates the frontend_server to allow specifying what dill
file to initialize from.

Normally, it tries to initialize from the same dill file as is the
output. This is fine in many cases (e.g. flutter run always says it
should output to build/app.dill): The first time it compiles
everything, subsequent times (across restarts) it only recompiles
what's needed.

When running tests, however, the output is in a temporary directory,
so it doesn't work across restarts. The startup time for tests is
always rather high, because it always has to recompile everything.

This CL updates the frontend_server to allow specifying what dill
file to initialize from. Flutter can thus save the compiled test
file in a centralized location (e.g. build/test.dill) and load from
that across restarts.

Plumbing this into flutter yields the following result, when running
a single test (the one automatically created when creating a new
flutter project):

Before: ~5.5 seconds
Now, first run: ~5.5 second (unchanged)
Now, subsequent runs: ~3.4 seconds

Approximate breakdown:

Startup cost (e.g. if there's no test directory):        ~ 800 ms
Starting up the actual frontend server: ~150 ms
Reading source from old dill, loading all relevant files
and invalidating source:                                 ~ 300 ms
Compiling everything (or, rather, nothing as it's all
from the dill at this point):                            ~ 650 ms
Serializing:                                             ~ 250 ms
Copying files:                                           ~  50 ms
Running the actual test:                                 ~1100 ms

Total:                                                   ~3300 ms

`time flutter test --local-engine=host_debug --preview-dart-2`
says ~3.4 seconds...

To compare, --no-preview-dart-2 takes ~2.2 seconds,
so dart2 still has a (significantly) higher startup cost.

Moves the needle on https://github.com/flutter/flutter/issues/15767.

Change-Id: I36a2d05bc76e0193d369df42eb3b9f08416dd78f
Reviewed-on: https://dart-review.googlesource.com/51820
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-05-17 06:49:41 +00:00
Jens Johansen 8101ee0479 [kernel] Remove unused GlobalIndexer from ast_to_binary.dart
Change-Id: Ide2b8997d831f811fa278164a25139ea1fde0c5f
Reviewed-on: https://dart-review.googlesource.com/55460
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-05-17 06:03:02 +00:00
Konstantin Shcheglov 0ad2b1243d Use carbon copy buffer field instead of passing it around.
R=brianwilkerson@google.com

Change-Id: I96d60d3012687c152168032717569c32cf0dc314
Reviewed-on: https://dart-review.googlesource.com/55585
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-17 01:40:52 +00:00
Stephen Adams 6d55ba3037 [dart2js] Remove checks from inlined static call sites
Change-Id: Ib309684efa6c518dd57bff76491484fe7288e628
Reviewed-on: https://dart-review.googlesource.com/55522
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-17 00:03:24 +00:00
Dan Rubel 6363cf6d3d Add new handleParenthesizedCondition event
* Extract parseParenthesizedCondition from parseParenthesizedExpression
* Update parsing of control structures to use parseParenthesizedCondition
* Add a new handleParenthesizedCondition event

Change-Id: I9972bfa3fa4060fc6de2e6315902c4c524c76544
Reviewed-on: https://dart-review.googlesource.com/55560
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-16 22:12:34 +00:00
Jenny Messerly 393a47441f fix #33138, local class name should not conflict with inline-JS in SDK
Also this removes the workaround for dart:html that used a RegExp to
attempt to match inline-JS code that might trigger the problem.

Change-Id: I74b447928aaeaca43b3a9241d42526c284dbeffa
Reviewed-on: https://dart-review.googlesource.com/55504
Reviewed-by: Vijay Menon <vsm@google.com>
Commit-Queue: Jenny Messerly <jmesserly@google.com>
2018-05-16 22:04:05 +00:00
Stephen Adams 6c3a861f8f [dart2js] Check arguments declared with generic method type parameter
Change-Id: Ic479695a2859e30867639d38930bed07b459f50a
Reviewed-on: https://dart-review.googlesource.com/55480
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 20:50:24 +00:00
Konstantin Shcheglov d91af4625c Fix fix import URIs from file:// URIs on Windows.
This fix the issue we see on bots.

R=brianwilkerson@google.com

Change-Id: I65dfde81a6194a8bbdbf860129d4c19b646ef730
Reviewed-on: https://dart-review.googlesource.com/55521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-05-16 20:23:23 +00:00
Konstantin Shcheglov 53a51d17db Support for optional ImportPrefixGenerator to generate prefixes for new imports.
Only one import is generated for each library.
If there is already an import for a library, new prefix is not asked.
If a prefix was generated once, it is not possible to force another
import with a different prefix.

R=brianwilkerson@google.com

Change-Id: I1676a1953002060b5e7155ce90abf87b3bfe270e
Reviewed-on: https://dart-review.googlesource.com/55326
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-16 20:15:03 +00:00
Brian Wilkerson 338a423416 Add Forest support for creating try statements
Change-Id: Ib0241b929fa4c9eda533beec1e3f902973340821
Reviewed-on: https://dart-review.googlesource.com/55520
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-05-16 20:15:02 +00:00
Konstantin Shcheglov 757ef3979c Revert "Revert "Revert "Don't do implicit new/const code generation with --preview-dart-2 enabled."""
This reverts commit 4089111540.

R=brianwilkerson@google.com

Change-Id: I66297466f8baafe6e070acbcb1776b41f3d9fedc
Reviewed-on: https://dart-review.googlesource.com/55506
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-16 19:43:22 +00:00
Konstantin Shcheglov d9d7cb12a6 Replace DartFileEditBuilder.importLibraries() with importLibrary().
It now returns the text of the URI that will be actually used, so
we can show it in the quick fix message without computing it separately.

R=brianwilkerson@google.com

Change-Id: I16a455d8f6a3c3e3a9c5779c94d654de32992006
Reviewed-on: https://dart-review.googlesource.com/55501
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2018-05-16 18:46:22 +00:00
Konstantin Shcheglov f32509b849 Export 'resourceProvider' from AnalysisSession.
R=brianwilkerson@google.com

Change-Id: I0544be022a078f96be23c4e75923c32f70385589
Reviewed-on: https://dart-review.googlesource.com/55443
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-16 17:28:16 +00:00
Paul Berry 3466823189 Enable analyzer testing of pkg in strong mode.
Fixes #33116.
Fixes #28649.

Change-Id: I881eef1d23909b09c856515edbf8b5cee1821824
Reviewed-on: https://dart-review.googlesource.com/55302
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-05-16 16:31:42 +00:00
Martin Kustermann 775eeece8a [VM] Enable kernel2kernel constants evaluation in AOT for the VM.
Change-Id: Iff40aaf464f870235c9a15c4ee33385256e58023
Reviewed-on: https://dart-review.googlesource.com/55461
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2018-05-16 16:11:22 +00:00
Zach Anderson 42bcdcd332 [dart:io] Revert recent non-utf8 path handling
Reason for revert: Breaking API change blocks Flutter rolls. Reverting
to reconsider, work around, etc..

Revert "[ VM ] Fixed issue where backing array was deleted from an ExternalTypedData before the ExternalTypedData was used."

This reverts commit 916b9da48d.

Revert "[ VM ] Fixed tests for non-UTF8 paths on Windows / Macos."

This reverts commit 6327fe91c2.

Revert "[ VM ] Fix failing tests on Windows bots after non-UTF-8 paths change."

This reverts commit b51f4b7956.

Revert "[ VM ] Updated non-UTF-8 tests to expect exceptions on OSX/iOS."

This reverts commit bcb36247d2.

Revert "Revert "[ VM ] Updated non-UTF-8 tests to expect exceptions on OSX/iOS.""

This reverts commit 24450c79a5.

Change-Id: I756f74f4acdde168d0984fe130f05f9252366334
Reviewed-on: https://dart-review.googlesource.com/55441
Reviewed-by: Todd Volkert <tvolkert@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
2018-05-16 15:47:10 +00:00
Danny Tuppeny 39fa25cbe2 Implement FILE_HEADER folding
Bug: https://github.com/dart-lang/sdk/issues/33033
Change-Id: I66833cc73b4adecf1743c623cfc2c7fbd9af45bc
Reviewed-on: https://dart-review.googlesource.com/55284
Commit-Queue: Danny Tuppeny <dantup@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-05-16 15:37:20 +00:00
Kevin Millikin 05deb5b2f5 Just apply covariant fixes
The implementation built up a list of closures and then immediately
looped over them to apply them.  It seems simpler to do the operations
directly in the first place and it's probably faster too.

Change-Id: I4f3ce4cd1cb1bc3169f1b7190d54118ec22b8bda
Reviewed-on: https://dart-review.googlesource.com/55223
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 14:49:38 +00:00
Martin Kustermann aafc2a6d43 Reland "[vm/kernel] Enable kernel2kernel "constants" transformation in AOT mode (after running TFA)"
The CL was originally committed in 039e8a175 (and reverted in
46ab040e5). The fix for the issue has landed in 9d9ce8d69 .

This time the CL will land in "disabled" form and will be enabled in a separate CL.

Change-Id: I3d5eb952230aee99875e3c58a6595691c5145e25
Reviewed-on: https://dart-review.googlesource.com/55361
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-05-16 12:48:38 +00:00
Dan Rubel 137942aca5 Implement TypeParamOrArgInfo.parseVariables
This CL is the next step in replacing parseType and improving recovery.
It introduces a new parseVariables method for parsing type parameters
(aka type variables) method in addition to improving recovery in the
parseArguments method.

Change-Id: I4049528152a7c731771d7a8145e5f79729165d79
Reviewed-on: https://dart-review.googlesource.com/55301
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-05-16 11:44:08 +00:00
Johnni Winther 9bfdaf9182 Revert "Cleanup after removing MirrorsData"
Apparently a bit to eager :(

Change-Id: Id1e87447f3641c4d9689a4a7aa8cdd8cbd839d89
Reviewed-on: https://dart-review.googlesource.com/55380
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-05-16 11:35:13 +00:00
Peter von der Ahé 4e9f455220 Ensure toString is always implemented on generators
Change-Id: Iedff0cd12652ec57400718cb3ad9e865623d9165
Reviewed-on: https://dart-review.googlesource.com/55280
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 10:45:08 +00:00
Peter von der Ahé 7a2afce0aa Convert LoadLibraryAccessor to LoadLibraryGenerator
Change-Id: I60d7c905df8fa133693ce981d15476c1792be36e
Reviewed-on: https://dart-review.googlesource.com/55129
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 10:45:08 +00:00
Peter von der Ahé 6a10efba11 Convert StaticAccessor to StaticAccessGenerator
Change-Id: Ie3265ce20ce6e6b5114f8866010579e485bdcd38
Reviewed-on: https://dart-review.googlesource.com/55125
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 10:45:08 +00:00
Peter von der Ahé 331d31f56c Convert SuperIndexAccessor to SuperIndexedAccessGenerator
Change-Id: I0b4b53373b248e88058f0353a293d57a6eae766e
Reviewed-on: https://dart-review.googlesource.com/55124
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 10:45:08 +00:00
Peter von der Ahé 21ae1a0ab7 Convert ThisIndexAccessor to ThisIndexedAccessGenerator
Change-Id: I2ea175bbaa391bf719ba7fa000c164eff701e8c4
Reviewed-on: https://dart-review.googlesource.com/55123
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 10:45:08 +00:00
Peter von der Ahé 7e7c795919 Convert IndexAccessor to IndexedAccessGenerator
Change-Id: Ib5c1ef8b78543a0d9e0a98e10d6c1315409d9246
Reviewed-on: https://dart-review.googlesource.com/55122
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-05-16 10:45:08 +00:00
Kevin Millikin fbb9f525be Make reportCrash generic
This avoids a runtime typecheck failure because Future is Future<dynamic>
which isn't a subtype of Future<T> for any T that is not a top type.

Change-Id: I067987e27177f3ed81ec14101c965488f1c35e2e
Reviewed-on: https://dart-review.googlesource.com/55281
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-05-16 09:59:23 +00:00
Johnni Winther 54331b1c4b Delete elements.dart and resolution_types.dart
Change-Id: Ib50dabdbeec72ebf443e85b51b818d9ed0602b4f
Reviewed-on: https://dart-review.googlesource.com/55221
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther baf09db165 Remove Resolution and Target
Change-Id: I30fb47acd820077b0dd9efebc3460a9a8a1e6e1f
Reviewed-on: https://dart-review.googlesource.com/55200
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther 944ce140e2 Remove most imports of elements/elements.dart
Change-Id: I4ecd45286fab1171eab1e2d3d443a0441bbdc883
Reviewed-on: https://dart-review.googlesource.com/55180
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther c18311933b Cleanup after removing MirrorsData
Closes #23873

Change-Id: Iaa7e0b1d4f0426280bdc496d47d7799ce30543fa
Reviewed-on: https://dart-review.googlesource.com/55167
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther fc7f18a420 Delete MirrorsData
Change-Id: Ic5330226349dafc33c27291aa576bfe4d0ea09e8
Reviewed-on: https://dart-review.googlesource.com/55160
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00