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>
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>
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>
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>
When inferring const or new for expressions that aren't required to be const,
Fasta always choses new. That's not correct, and this is a short-term work
around to avoid introducing a breaking change in the future. The plan is to
implement this feature correctly, but that will require more time than we have
right now.
Originally submitted by ahe@google.com. Added: status file fixes.
Change-Id: I2d70bd2488de6b69fcd5546c1f4654dfbbb30b7f
Reviewed-on: https://dart-review.googlesource.com/46340
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
This CL extracts the core logic out of parseType into a new computeType
function. This enables the TypeContinuation logic in parseType to be
moved into the callers of parseType so that recovery can be improved.
Change-Id: Ibded6f5eacfeaccdc6c56e234b305596d9582a92
Reviewed-on: https://dart-review.googlesource.com/45760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
I'm not sure -- I ticked analyzer to 0.32 from 0.31-alpha.
I think because of the new methods, this is the right call (though it
leaves us in the weird place where there was no stable publish of
0.31.2?)
Also not sure if I need to update any other downstream packages (args?
dart_style?). Seems like if so, those are all in other repos.
Change-Id: I512e6674549a99fdafe47f2138738463f4e66e37
Reviewed-on: https://dart-review.googlesource.com/46126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@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>
This simplifies formatting and reporting logic.
Also move the noLength constant to fasta_codes.dart, where it more
rightly belongs. This avoids loads of bogus imports of the parser.
Change-Id: I2720df0e6ff627fba8f4bdd9ed03ee87bc0db0bd
Reviewed-on: https://dart-review.googlesource.com/44424
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Previously, we were setting `expression` incorrectly after generating
the implicit tear-off of .call, so if an implicit downcast was needed
as well, it was not attached to the proper kernel node, and the
resulting kernel representation was invalid.
Addresses the front end manifestation of #32426.
Change-Id: Ibd86b75c54a53db1fc4606b7583910c57e1c4aae
Reviewed-on: https://dart-review.googlesource.com/45522
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This CL changes the handling of writeContext (for complex
assignments), returnOrYieldContext (for closures), expectedType (for
ensureAssignable), and receiverType (for findInterfaceMember) so that
they no longer use `null` to represent a context; they use UnknownType
or DynamicType as appropriate.
It also changes the handling of expectedType (for ensureAssignable) so
that it does not require the type to be known. That makes this CL
simpler and paves the way for fixing #31792.
Change-Id: Ib1be06182f9a9e9f77a9eb81f5daf2364de0f3a7
Reviewed-on: https://dart-review.googlesource.com/44800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
This CL adds a test that invalidates a part file after initializing from
a dill file. It futher more fixes the found issue so the part file (and
subsequent entire library it is a part of) is invalidated. Previously
invalidating a part file had no effect.
Change-Id: I0e76998d0ce2247b58c4a0e6cd691062b3069a2b
Reviewed-on: https://dart-review.googlesource.com/45181
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
In the incremental compiler, invalidating a file that exports other
libraries (among them one containing main) will fail to have a main set
in the resulting dill file.
This CL fixes the issue and introduces a test.
Change-Id: Ib7fe5ca46a44017eba6c5fcd39c358fe1b857a26
Reviewed-on: https://dart-review.googlesource.com/45000
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
This CL adds another incremental compilation test extracted from flutter
that currently fails.
Change-Id: I03c7cf48933b3a6608e93ec34e5c27941b7d1ecb
Reviewed-on: https://dart-review.googlesource.com/44940
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>