When recovering from an invalid annotation in a type variable
(e.g. "< @Foo.bar T >"), the parser could get stuck in an
infinite loop trying to recover. This fixes that situation.
Change-Id: If01e43b9eec575824329808eeb93437432830654
Reviewed-on: https://dart-review.googlesource.com/52300
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Rename the TypeInfo constants and related constants in preparation
for refactoring and improving type argument and type parameter parsing.
Change-Id: I5a741ee06f373800973942c233490fe83916e39c
Reviewed-on: https://dart-review.googlesource.com/52140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This improves recovery when parsing conditional import expressions
by repositioning the synthetic closing ')' that was inserted by the
scanner in a less than optimal location.
This approach relies on the beforeSynthetic field being set correctly.
While the scanner still sets the 'next' and 'beforeSynthetic' fields
directly for efficiency, most other functions which update an existing
token stream have been revised to call 'setNext()' rather than setting
the 'next' field directly. This ensures that the 'beforeSynthetic' field
will be correctly updated.
Change-Id: Id631fd600c64d1feaf00593acb74a7070e354f07
Reviewed-on: https://dart-review.googlesource.com/52120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This CL updates SyntheticToken to have a new beforeSynthetic field
and the fasta scanner to set that field for synthetic ")", "]", and "}" tokens.
This makes it much more efficient for the parser to move a synthetic
closer when the scanner has inserted it in a less than optimal location
in the token stream.
This CL also addresses a comment in
Address comment in https://dart-review.googlesource.com/c/sdk/+/51561
Change-Id: I7f056ac25f2ca4cf5edb0ef4bce7f1e9dd76de9a
Reviewed-on: https://dart-review.googlesource.com/52040
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL improves recovery given invalid or malformed formal parameter
types and identifiers. This accomplished by switching the
parseFormalParameter method to use computeType rather than parseType,
improving recovery when parsing field initializers, and in the process,
further reducing the size of parseType and eliminating 6 unused
TypeContinuation elements.
Change-Id: I6f05d8018bf8d9f2c256e5a64408c29db006a8e2
Reviewed-on: https://dart-review.googlesource.com/52000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This CL improves recovery when a type is required to interpret
"Foo.", ".", and ".Foo" as malformed prefixed type references.
When a type is *not* required, each of the above are still interpreted
as no-type-reference.
Change-Id: Ia20caa8619821d24c5b16fd0015cee03987ee2a6
Reviewed-on: https://dart-review.googlesource.com/51900
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Solves problems with absolute Dart SDK file URIs appearing in
expectations files, causing incompatibility between local runs and bots.
Change-Id: I75c5a167834503fa6ffea3b34f6d647e78a46adf
Reviewed-on: https://dart-review.googlesource.com/50700
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
This CL updates the beginFormalParameters event to include
the covariant and const/final/var modifiers, and cleans up
a number of unused classes and methods including:
* the original implementation of ModifierContext/Recovery
* handleModifier and handleModifiers events
Change-Id: Ie89a202d17872fba85cd1a477091472a8d2d223b
Reviewed-on: https://dart-review.googlesource.com/51380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
During top-level type inference, method types are inferred
immediately. There is no need to have MethodInferenceNodes which
exist for the purpose of delaying type inference.
Change-Id: I0044ab64a31e43ca807db75631ee8fa259c07a22
Reviewed-on: https://dart-review.googlesource.com/51320
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Create a single return in ForwardingNode._finalize to make it easier
to inline and specialize. Use for-in instead of raw iterator methods
in MemberInferenceNode._matchTypes to make it more obvious.
Change-Id: Ie35618fa57db41b8bc070d9cbed46bb717399605
Reviewed-on: https://dart-review.googlesource.com/51300
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This CL removes the library sorting the produces a (more) bit-perfect
result when initializing from a dill file.
In general it is not needed, and was only added to satisfy tests,
but sorting is now done in the tests instead.
Change-Id: I71e968720439ab6dacd07e6039990915ce4c1286
Reviewed-on: https://dart-review.googlesource.com/49162
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
This is the 2nd attempt.
First attempt was committed as 5367304ba5
but was reverted as 2676c132cb
This attempt forgoes the "handles change package versions" as it creates
problems for flutter. A subsequent CL the handles it better will be
created later.
This CL addresses comments from previous CLs, mostly renaming variables.
Fixes#32776.
Change-Id: I634056069d3e8c3e41ba349ccd0fe5ffa5f99458
Reviewed-on: https://dart-review.googlesource.com/49510
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This includes Fasta, tools and observatory, so the checked-in SDK must
have the lower-case constants.
Change-Id: I8380ad041ad058f7d02ae19caccfecd434d13d75
Reviewed-on: https://dart-review.googlesource.com/50201
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
This CL cleans up the TypeInfo library including:
* moving ComplexTypeInfo to type_info_impl.dart
* splitting up and enhancing the tests
* adding a new ensureTypeOrVoid method for use in a subsequent CL
Change-Id: I2d13f74152f8c4eb2e8b3ee504f108225cfa60eb
Reviewed-on: https://dart-review.googlesource.com/51080
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
This changes wrapInCompileTimeError so we are certain that
compile-time errors are reported before the erroneous nodes.
We want to preserve erroneous nodes as, long term, this should help
with code completion.
Also introduce a located version as my next CL I'll have slightly
more accurate locations.
Change-Id: Id83d4b7a7d4fe260916816d72fac331251bad948
Reviewed-on: https://dart-review.googlesource.com/50422
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
In a86b864fa9 the incremental compiler was
updated to always bypass the cache when getting a UrlTranslator to be
able to handle the case where .packages had been updated.
This was driven by Flutter not invalidating .packages.
This has now been introduced in flutter with
https://github.com/flutter/flutter/pull/16467
and we can now limit when we bypass the cache to when the .packages file
has been invalidated.
This CL does just that, and further more adds tests where .packages either
appears or disappears.
Change-Id: I3e2d001a993a59c115bc00fcf714f97094357d35
Reviewed-on: https://dart-review.googlesource.com/50940
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Prior to this CL a builder loaded from a dill file - but where the
file has now been deleted (and we've previously been told about it) -
was kept around, meaning that it could get resurrected in a later
call to computeDelta.
This CL introduces a test and fixes the problem.
Change-Id: Ia18639a1387b37f8d641f803f202288dd185af5c
Reviewed-on: https://dart-review.googlesource.com/50722
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
e6962790a1 introduced a speed-regression
e.g. by increasing the time it takes to run `flutter test` in
flutter/packages/flutter from ~2:30 to ~3:10.
This regression was caused by making the functionaliy that removes
unused builders work for packages too.
Before that commit landed we tried to remove unused "package:*" builders,
but failed because we tried to remove them by their fileUri and not the
importUri (which they are actually saved under). The commit (among other
things) fixed that (i.e. they are now removed by their importUri).
This CL "re-introduces" the "don't remove unused 'package:*' builders"
functionality - though this time by design.
This reduces the time it takes to run `flutter test` in
flutter/packages/flutter and gets it back down to ~2:30.
Change-Id: I335ae3d473b0a0eda955741e5e3ce4c946916452
Reviewed-on: https://dart-review.googlesource.com/50662
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
It complicates the intermediate language, none of the back ends are
using it, and it's not something that we want transformation writers
and code generators to deal with.
Change-Id: Ic79f7935dd8619bd233346bb25947e864f38a104
Reviewed-on: https://dart-review.googlesource.com/50440
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Samir Jindel <sjindel@google.com>
Potential constness is determined syntactically, based on the shape of
the expression and potential constness of its nodes. Constants are not
evaluated in any way, and their values and types don't affect potential
constness of expressions. 'Const' is inserted on a constructor
invocation if it is potential const; 'new' is inserted otherwise.
Bug: http://dartbug.com/32737
Change-Id: Ice13803ebe3abf0a0f47cbbff29d13638c2d8e92
Reviewed-on: https://dart-review.googlesource.com/49683
Reviewed-by: Kevin Millikin <kmillikin@google.com>