The scanner associates '<' with '>' and '>>',
but the parser cannot use '<'.endToken/endGroup reliably
and wastes time updating that token's endToken/endGroup field.
This CL updates type info parsing to ignore '<'.endGroup
and step through the token stream (which it has to do anyway),
for improved parsing.
This CL causes a handful of existing tests to fail (marked as @failingTest)
and test failures will be addressed in a subsequent CL.
Change-Id: I788e9a74cd2891f98f44bba15d5669febfec6c64
Reviewed-on: https://dart-review.googlesource.com/70001
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
async function return type check whenever running in 'legacy mode'.
Adapts language_2_kernel.status such that a MissingCompileTimeError is
expected for illegal return types of async functions when running in
'legacy mode'. Updates the commentary in finishFunction in
body_builder.dart.
Some legacy tests* have revealed that it may not always be correct to
check whether [strongMode] is enabled before checking the return type of
async functions. The reason behind the strongMode check was to ensure
that [_typeInferrer.typeSchemaEnvironment] would be instantiated as
per ahe's suggestion.
There seems to be some inconsistency in the code base as to when
[_typeInferrer.typeSchemaEnvironment] is non-null. For example, during
the fasta perf benchmarks one may observe a null value, whilst it
seems that the member is always non-null when running `dart
--no-preview-dart-2 <script.dart>`.
* test log: https://ci.chromium.org/p/dart/builders/luci.dart.ci.sandbox/front-end-legacy-linux-release-x64/621
Change-Id: I2211bfe0ae75a7aa35e2d698ff5cba27af484d07
Bug: 33425
Reviewed-on: https://dart-review.googlesource.com/69920
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
This replaces calls to lt.endGroup when parsing type arg/param
with calls to computeTypeParamOrArg. This is a step towards
removing lt.endGroup everywhere and making type arg/param
parsing more resiliant and streamlined.
Change-Id: I5b3374769367f601c8910afa18116a2edd3f80c0
Reviewed-on: https://dart-review.googlesource.com/70000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
declared return type of an async function is a super type of Future<T>
for any T. In case the check is not successful an error message is
produced. The location of the name of the offending function
declaration is used as location information for message. Ideally we
would use the location of the type, so until types get annotated with
location information the error message remains suboptimal.
This closes#33425 and closes#34057.
Thanks to dmitryas and jensj for their helpful guidance.
Bug: dartbug.com/33425 dartbug.com/34057
Change-Id: I3b3dadc25b574422ea1f38671fe8cba3ffdd494c
Reviewed-on: https://dart-review.googlesource.com/69307
Commit-Queue: Daniel Hillerström <hillerstrom@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This is the first CL of several needed to fix typedef parsing
when there is no space between the type parameters and the `=`.
typedef F<T>= T Function(T);
* Fix some typedef parsing failures
* Add new consts for simple type var ending with ">>" and ">="
* Update computeType and computeTypeParamOrArg to return new consts
* Extract splitGtEq/GtGt/GtGtEq from splitEndGroup
* Hide internal TypeInfo and TypeParamOrArgInfo consts
Change-Id: Ice550f5b15df1f3cad616a2a342644974f14d8ee
Reviewed-on: https://dart-review.googlesource.com/69261
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
Similar to how dart2js keeps its own target in package compiler.
This allows VmTarget to use package vm specific transformations and metadata.
Change-Id: I41dd2ae241b828224fb2c9a51e6ad5073b6fdea8
Reviewed-on: https://dart-review.googlesource.com/69160
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Tested with imports through current directory, VM binary directory,
and LD_LIBRARY_PATH. This also restores the Dart 1 behavior of not supporting
relative extension paths.
Change-Id: I090bf8592fef74d4ccde40e6f550baa84c98e3bc
Reviewed-on: https://dart-review.googlesource.com/69162
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
The style guide says to "PREFER relative paths when importing
libraries within your own package’s lib directory". Mixing them with
package: imports doesn't work. Before: we had a mix. Now: we don't.
Change-Id: Iadcf1dda7bae51121e325f5d4b8c6add8759da95
Reviewed-on: https://dart-review.googlesource.com/68082
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
This extracts and refactors a sizable chunk of dartdoc parsing out of AstBuilder
and into the fasta parser. Parsing dartdoc does not happen unless the listener
calls the new fasta parser parseCommentReferences method.
The new parseCommentReferences method generates a handleCommentReferenceText
event for each comment reference encountered. The listener calls the scanner
to tokenize the comment reference and forwards the result to a new
fasta parser parseOneCommentReference method. This method generates either
a handleCommentReference or a handleNoCommentReference depending upon
whether or not a reference is parsed.
parser.parseCommentReferences
* generates handleCommentReferenceText events
* returns # of events generated
listener.handleCommentReferenceText
* calls parser.parseOneCommentReference
parser.parseOneCommentReference
* generates either handleCommentReference or handleNoCommentReference
There are further improvements to be made, but I believe this chunk
will allow progress to be made on the kernel side.
Change-Id: I393dc4d1d4791b3d7a529f6cb3c16db3a5befddf
Reviewed-on: https://dart-review.googlesource.com/68461
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This is an alternative fix for #33452.
This was originally fixed in 8e4d5c0a38,
but it was pointed out that it doesn't work if there were type arguments.
This should fix the problem in more cases.
Change-Id: I08ed27ecea1a8d471be9675d28b997614248c65e
Reviewed-on: https://dart-review.googlesource.com/68080
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Before this CL, Judgments save Tokens in final fields.
This can take up quite a lot of space, and isn't actually (currently)
used for anything. Eventually it will be used in Analyzer.
This CL changes it so Judgments instead carry a `box` that is in
`non-analyzer-mode` just null, and in `analyzer mode` stores the Tokens
directly.
When running dart2js through the VM, this decreases the memory footprint
quite a lot, and seems to make the compile faster.
Details:
Removing the Tokens decrease the memory usage by almost 50MB
("Maximum resident set size" (as reported by /usr/bin/time -v)),
and more than 66MB from the old space in the kernel isolate after
ended compilation and changed the compile time of dart2js by
-7.71201% +/- 6.22211% (presumably because of less pressure on the GC).
For more details see the review page comments.
Change-Id: I7a31927f104e111c1b16be10b35f4164959a2130
Reviewed-on: https://dart-review.googlesource.com/67720
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
When compiling dart2js this cuts down the old generation
(after forced GC, VM kernel isolate) from ~230 MB to ~217 MB.
Change-Id: Id06a2666d1849e49acc18c4142ab346f581e5b23
Reviewed-on: https://dart-review.googlesource.com/67520
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
It's currently just passed around and never used, so remove it for
now. We will (obviously) restore it when and if we need it.
Change-Id: Ie47243f73d74190c2acf4c6f83eb2fa6f60702fd
Reviewed-on: https://dart-review.googlesource.com/67560
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
It fixes 8 tests, and opens a way to fix more.
It also "breaks" 4 tests, but only because we now check more rigorously.
Specifically - tests that check wrong number of type arguments and cycles.
This is something I will improve later.
Change-Id: I4a3bcd4ff56831f597fd02224bda032b7a0fadb9
Reviewed-on: https://dart-review.googlesource.com/66920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
This arc of work is breaking the Flutter roll--see
https://github.com/dart-lang/sdk/issues/33993.
This reverts the following commits:
- 55c0857037 (Create a common generator class to handle non-lvalues.)
- c9b197017c (Rename "assignment_of" -> "assignment_to".)
- 32fd7b15e4 (Remove special case for assignment to parenthesized
expressions.)
- 432e59e589 (Fix error reporting if a for-in statement attempts to
assign to a prefix.)
- 232bed3d11 (Change UnresolvedNameGenerator to use
NonLvalueGenerator.)
- 0b778d0697 (Change IncompleteErrorGenerator to make use of
NonLValueGenerator.)
- 1a5f94a0a4 (Fix analyzer-CFE integration of illegal references to
instance members from static contexts.)
Change-Id: Id637e5ec60150a73031c05d7bb4c6effefd2aa8a
Reviewed-on: https://dart-review.googlesource.com/67091
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>