Commit Graph

58 Commits

Author SHA1 Message Date
Aske Simon Christensen 6cc0d9770f Skip expressions by parsing them with a no-op listener.
This change slows down Fasta by around 0.5%, as it now does a full
parse of expressions outside bodies in the outline and diet parsing
phases, but it is, for now, a more robust solution than the heuristic
skipExpression, fixing several crashes.

Fixes https://github.com/dart-lang/sdk/issues/31155
Fixes https://github.com/dart-lang/sdk/issues/31171
Fixes https://github.com/dart-lang/sdk/issues/31188

Change-Id: Id5639dbd8b4c3f1f7e42eed66e3bee60f37bc3dc
Reviewed-on: https://dart-review.googlesource.com/55660
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2018-05-22 16:51:29 +00:00
Dmitry Stefantsov 4bcf8ad411 [fasta] Handle static get in ConstnessEvaluator
Bug: http://dartbug.com/32737
Change-Id: I8e2199f114c4533212930bcd8e6e4c713a4f62f9
Reviewed-on: https://dart-review.googlesource.com/49140
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-04-04 16:02:17 +00:00
Dmitry Stefantsov b793c8a387 [fasta] Require explicit handling of all expression kinds in ConstnessEvaluator
Change-Id: I619f4e9e7d606232034d82645e02049b53cb94d5
Reviewed-on: https://dart-review.googlesource.com/49122
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-04-04 11:09:02 +00:00
Dmitry Stefantsov ec9c927b18 Resolve type arguments of redirecting factories invocations
Fixes #32068

Change-Id: Ifc2c832d5a761ae51b7f93084543aa04902a9529
Reviewed-on: https://dart-review.googlesource.com/40280
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-02-14 22:03:23 +00:00
Dmitry Stefantsov 47fbe76d03 Avoid patching with redirecting factories in vm-related patches
Change-Id: Id45696a38b281b1b75a9a0e26d89216388a4ec19
Reviewed-on: https://dart-review.googlesource.com/39942
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-02-08 14:11:50 +00:00
Dmitry Stefantsov b7a60e7ad9 Fix type variable references in factories of generic classes
Bug:
Change-Id: Ifb3a6cf2bff45ce12bb69135a9f2c172dcd8191d
Reviewed-on: https://dart-review.googlesource.com/37781
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-02-06 11:26:27 +00:00
Samir Jindel 7d00b79477 [kernel] Support native extensions in the VM through Kernel.
Change-Id: I860e66b3e66a882ff771e477c318362cefbd4eaa
Reviewed-on: https://dart-review.googlesource.com/35925
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-01-29 14:04:35 +00:00
Peter von der Ahé 6e4e931309 Ensure duplicated members also have a default supertype
Change-Id: I33b6fa0fef116f20d382dd77644476d05f1378c5
Reviewed-on: https://dart-review.googlesource.com/35661
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-01-18 16:50:14 +00:00
Kevin Millikin 6fa813d818 Change handling of Kernel static errors
Before: Kernel static errors were represented by throwing a distinguished
error or else by calling a distinguished library const constructor.

Now: Kernel static errors are represented by InvalidExpression.  To support
error reporting, InvalidExpression has an optional message and a file
offset.  A back end can choose to signal these errors at any time; for
example, when deserializing the binary, or when compiling the procedure
containing the static error, or when the erroneous expression is evaluated
at run time.

InvalidStatement is removed because it can be encoded as ExpressionStatement
of InvalidExpression.

Future work:

* supporting static errors where an expression cannot appear in the AST
* allowing InvalidExpression to contain an Expression for error recovery
* adding a top-level list of static errors and warnings to the binary

Bug: https://github.com/dart-lang/sdk/issues/29840
Change-Id: Ifdfe9a76cee6cefed28061bf245be70531d2f413
Reviewed-on: https://dart-review.googlesource.com/31320
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2018-01-04 11:00:25 +00:00
Paul Berry b75502513a Fix type inference of closures using '=>' syntax.
This CL fixes type inference of closures using '=>' syntax so that
they infer consistently with an equivalent closure defined using block
syntax ('{}').

Fixes #31436.

Change-Id: I5463dd0ba986e9953ebabbc24ce3ced9a7220007
Reviewed-on: https://dart-review.googlesource.com/27084
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-12-07 04:52:10 +00:00
Dmitry Stefantsov ccbeebe2a6 [kernel] Add new member kind for redirecting factory constructors
New type of AST nodes RedirectingFactoryConstructor is added to Kernel.
The goal is to keep the information about redirecting factory
constructors in the class for the linking phase.

Change-Id: I7477c617fa7fd4935ceb23098ec7c056d1f286ca
Reviewed-on: https://dart-review.googlesource.com/14740
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-11-28 17:36:44 +00:00
Paul Berry 0eefa06d14 Insert implicit downcasts for the conditions of while statements.
Change-Id: Ieb1bc13de5afb16e75ab810de35002bb3b966ea8
Reviewed-on: https://dart-review.googlesource.com/23742
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-11-27 17:07:41 +00:00
Paul Berry 419a8c342e Insert implicit downcasts for field initializers.
Tests that have begun failing due to this change are marked with a
reference to issue #31402.

Change-Id: I0ea8fcf94728e70d92f4be771f3ca5d10c366375
Reviewed-on: https://dart-review.googlesource.com/23725
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-11-26 06:33:50 +00:00
Paul Berry 5ce5811216 Insert implicit downcasts for the conditions of for statements.
Change-Id: I213617cb4ea1a5c29f8a6a56f54792c59cc4e132
Reviewed-on: https://dart-review.googlesource.com/23221
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-11-23 16:47:32 +00:00
Paul Berry 9255de668e Insert implicit downcasts for constructor initializer expressions.
Change-Id: Ic258db9c353a4a0ab33a96c3847b174937fcf9e5
Reviewed-on: https://dart-review.googlesource.com/23220
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-11-23 16:39:28 +00:00
Paul Berry 501872471c Insert implicit downcasts for the conditions of do statements.
Change-Id: I8bfffa0796775434cea767ec9ad13cf5697812d2
Reviewed-on: https://dart-review.googlesource.com/23140
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-11-22 21:47:14 +00:00
Paul Berry 245340dd7f Insert implicit downcasts for the conditions of if statements.
Change-Id: I788d50dc3d95bb4652ff122a993cd092d7262c31
Reviewed-on: https://dart-review.googlesource.com/23160
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-11-22 19:29:24 +00:00
Paul Berry 6786f1944a Insert implicit downcasts for the operands of "not" expressions.
Tests that have begun failing due to this change are marked with a
reference to issue #31402.

Change-Id: I3d29a1058af5ba43bc2868d85de1e9d87b666ee2
Reviewed-on: https://dart-review.googlesource.com/23080
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-11-22 17:55:27 +00:00
Paul Berry cd49cf1201 Insert implicit downcasts for compound assignments.
Change-Id: I090594e16fa890864775b2ebc58842d861c134a4
Reviewed-on: https://dart-review.googlesource.com/18517
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-11-03 22:07:10 +00:00
Paul Berry 9ac19f0122 Pass --strong to vm when running front_end testcases in strong mode.
Also, stop passing "Hello, World!" as a command line argument when
executing front_end testcases.

Change-Id: I7c3ec6a301537a84bd14e232b5a0d6b8a7bd1914
Reviewed-on: https://dart-review.googlesource.com/18503
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-03 18:28:51 +00:00
Dan Rubel 15a0abf956 Fix OutlineBuilder native class and AnalyzerDietListener tests
Update the OutlineBuilder and AstBuilder to fix native handling,
and in the process, fix several AnalyzerDietListener tests.

Fix https://github.com/dart-lang/sdk/issues/30836

Change-Id: I7e3b6c4c7d241f1325a5fce1e117e277c6166e49
Reviewed-on: https://dart-review.googlesource.com/18500
Reviewed-by: Paul Berry <paulberry@google.com>
2017-11-03 17:16:51 +00:00
Aske Simon Christensen e3c11c2703 Retain erroneous import, export and part (of) directives
If the URI of a directive is invalid, use a special URI with a
scheme marking it as malformed. In the loader, treat a file with
an invalid URI as empty.

Order all dependencies (imports and exports) by source position to
allow the DietListener to match them up properly with metadata.

For the same reason, add imports and exports within parts to
dependencies even though they are not permitted here.

Closes https://github.com/dart-lang/sdk/issues/30997
Closes https://github.com/dart-lang/sdk/issues/31004

Change-Id: Ic7efd0da058c246531c165508b7474475b4bdad2
Reviewed-on: https://dart-review.googlesource.com/17901
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-11-03 12:55:19 +00:00
Peter von der Ahé b4dcb76518 Read patch files directly when building legacy platform files.
Change-Id: Ib2e614b676021660c6a053dfc59f639c004279b9
Reviewed-on: https://dart-review.googlesource.com/18520
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-11-03 12:43:50 +00:00
Siva Chandra 9f0175059e Load class members lazily when loading from kernel.
This change brings down core snapshot size by ~750KB, and brings
down app-jit snapshot size of simple "Hello, World" dart script by
~650KB. The bot cycle times will also come down by around ~20%.

Change-Id: I2a01c98bedc7ebfa2a653983995486a71504daf3
Reviewed-on: https://dart-review.googlesource.com/16323
Commit-Queue: Siva Chandra <sivachandra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2017-10-31 19:19:25 +00:00
Paul Berry 5c143d4353 Test a corner case of forwarding stubs.
Change-Id: Ifa41ee5caa8b353c34163d76ea799a8402527b2d
Reviewed-on: https://dart-review.googlesource.com/16685
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-10-26 13:58:51 +00:00
Dan Rubel 49eb459c11 test for issue 31155
Change-Id: I0ac565a8ffc27a921c331fc50343e32b907f3100
Reviewed-on: https://dart-review.googlesource.com/16335
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-26 13:58:41 +00:00
Paul Berry cc3f95b41d Check procedure kind when matching up forwarding stubs during mixin resolution.
Otherwise we might match up a getter to a setter and crash.

The test cases indirectly verify that mixin resolution does the right
thing by checking the semantics of the generated code.  These tests do
not pass yet, because covariance checks are not yet implemented in the
VM.

Change-Id: Ibe6d8b7479f86151c515c45c20ed7c880bf2ad43
Reviewed-on: https://dart-review.googlesource.com/16686
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Karl Klose <karlklose@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-26 12:54:08 +00:00
Brian Wilkerson 7932a17557 Recover from having a missing closing bracket in an index expression
Change-Id: I2fa44b001cf3b72f21a9c3b5859e41d0ecdd7ad3
Reviewed-on: https://dart-review.googlesource.com/15680
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-20 21:06:59 +00:00
Konstantin Shcheglov 3fedd483f3 Parse metadata for import/export directives and resynthesize in Analyzer.
R=ahe@google.com, paulberry@google.com, sigmund@google.com

Bug: https://github.com/dart-lang/sdk/issues/30284
Change-Id: I57af6f4d58b6de39f13b9656af25f0be6949cf79
Reviewed-on: https://dart-review.googlesource.com/14363
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2017-10-19 16:35:17 +00:00
Paul Berry 18c87cbb64 Skip type inference for fields that have no type inferrer.
This can happen in certain error recovery circumstances.

Fixes #31124.

Change-Id: Id814f2434ada93030b40f6dfcb5e62ec1a323d0e
Reviewed-on: https://dart-review.googlesource.com/14504
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-17 19:11:42 +00:00
Aske Simon Christensen 2f9d4efff6 Produce error statement for return with value from generator
Introduces a handleInvalidStatement method in listeners to signal
that the previous statement was invalid.

Closes https://github.com/dart-lang/sdk/issues/29983
Change-Id: I08d69062aa626a554b88d11d2c8c0e31b0abbe28
Reviewed-on: https://dart-review.googlesource.com/11501
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-10 08:34:21 +00:00
Aske Simon Christensen 868f5d9fa6 Recover from error in for initializer
When a variable declaration in a for initializer has an error,
an error-throwing expression statement is produced by the general
variable declaration parser code. The body builder was not prepared
for this, but was trivially extended to handle it.

Closes https://github.com/dart-lang/sdk/issues/29984
Change-Id: Iace9a095cc150e26e62ed17716823e62e5d2ece3
Reviewed-on: https://dart-review.googlesource.com/8801
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-03 15:09:09 +00:00
Aske Simon Christensen accddd1d97 Use error message templates for error tokens
Also fixes unicode U+ notation in error messages to use uppercase
letters for the hex code, as per the Unicode Standard conventions.

Closes https://github.com/dart-lang/sdk/issues/29985
Change-Id: I6397e03cb3e0d5eca156621bb4b19dfa643d9437
Reviewed-on: https://dart-review.googlesource.com/9320
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-02 14:23:26 +00:00
Peter von der Ahé aff25fdef2 Restore compile.status.
Change-Id: I85a371fb9e4ff3003863b69ad62e90370619c8dd
Reviewed-on: https://dart-review.googlesource.com/9484
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2017-10-02 12:43:36 +00:00
Régis Crelier fc9b871d2f Mark vm-kernel compile/function_type_recovery as failing, but passes locally.
Change-Id: I6feb770f4cd8eefb2d13292de211978dce800b2f
Reviewed-on: https://dart-review.googlesource.com/9143
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 02:25:55 +00:00
Régis Crelier db8b20107b Revert "Revert "Dart Core Lib change to support generic functions in class NoSuchMethodError.""
This reverts commit 8cf9ef22c4.

The expectations in Dart2js and Kernel tests have now been updated.

Change-Id: I9d65ff207490cfc783849b1b726db81cf56ecfc2
Reviewed-on: https://dart-review.googlesource.com/9124
Reviewed-by: Régis Crelier <regis@google.com>
2017-09-28 00:27:24 +00:00
Aske Simon Christensen 394f854fec Catch URI parse failure and report error
Closes https://github.com/dart-lang/sdk/issues/29977
Closes https://github.com/dart-lang/sdk/issues/29987
Change-Id: I448089036b20572d1cc8cb9d5e79cfd402caf273
Reviewed-on: https://dart-review.googlesource.com/8440
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-26 11:26:20 +00:00
Sigmund Cherem 4c893290e4 Reapply "Check whether type-arguments and type-parameters length match from the body builder."
This reverts commit 1ca12788c6.

Patchset 1 is the reverted CL, patchset 2 shows the changes.

Bug:
Change-Id: I4ffcb9ec20f2ac3c59d09adc3a6693f52c71601d
Reviewed-on: https://dart-review.googlesource.com/6360
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-26 04:09:37 +00:00
Aske Simon Christensen fab74715fe Report error if a member has the same name as the enclosing class
To recover properly from the error, change lookup priority in the Diet Listener from setter, field/getter/method, constructor to setter, constructor, field/method/getter.

Closes https://github.com/dart-lang/sdk/issues/29944
Change-Id: I3648501880e4e2059c386aa0032d37d0470aab96
Reviewed-on: https://dart-review.googlesource.com/7712
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-25 11:55:02 +00:00
Aske Simon Christensen 944b7715bd More general handling of expected identifier after dot
Don't crash when a dot is followed by something which is not an identifier or keyword. Give a more general error message which does not assume that the unexpected token is a keyword.

Closes https://github.com/dart-lang/sdk/issues/29941
Closes https://github.com/dart-lang/sdk/issues/29943
Change-Id: I6e8ea9682680e5f374b70a6ee8c6bb9dd3271b4b
Reviewed-on: https://dart-review.googlesource.com/7270
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-22 10:32:55 +00:00
Brian Wilkerson 6edb5d8df7 Add recovery for field formal parameters
Change-Id: I09a1c6627a8fc1d67ffad4010212f2e9511612fe
Reviewed-on: https://dart-review.googlesource.com/7108
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2017-09-21 13:47:52 +00:00
Sigmund Cherem 1ca12788c6 Revert "Check whether type-arguments and type-parameters length match from the body builder."
This reverts commit 321a4ec048.

Some VM tests expect to see the behavior with a raw type instead of
an invalid type. I'll revert first, then resend this CL with the default
result changed.

R=ahe@google.com

Change-Id: I2cdd855dbaec93d0a0c257f7e202518fd9b59c81
Reviewed-on: https://dart-review.googlesource.com/6342
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-09-15 22:15:09 +00:00
Sigmund Cherem 321a4ec048 Check whether type-arguments and type-parameters length match from the body builder.
Bug:
Change-Id: I395365393c9032ff179d675f42ca56b7981531e0
Reviewed-on: https://dart-review.googlesource.com/5620
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-09-15 20:37:41 +00:00
Paul Berry 5014aebb8d Avoid a crash when a method overrides a field.
Fixes #30695.

Change-Id: I7935f8d1895e47477ddb1291809efb246c92b913
Reviewed-on: https://dart-review.googlesource.com/5960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2017-09-14 21:44:58 +00:00
Konstantin Shcheglov e0f906068b Resolve to dynamic if the type prefix is not a String.
Currently we implicitly cast the prefix to String and this sometimes
fails, and cause one test in Analyzer resynthesizer fail in checked
mode only.
https://dart-review.googlesource.com/c/sdk/+/5891

R=ahe@google.com, paulberry@google.com

Bug:
Change-Id: I92993b12f74799defed837c43bda1be734a97787
Reviewed-on: https://dart-review.googlesource.com/5940
Reviewed-by: Paul Berry <paulberry@google.com>
2017-09-14 21:07:55 +00:00
Peter von der Ahé 893b4d4fe9 Add missing copyright on test cases.
Also rename void-methods.dart to void_methods.dart.

R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/3006963002 .
2017-08-31 13:09:20 +02:00
Peter von der Ahé 48503c8720 Don't export unnamed mixins.
Fixes https://github.com/dart-lang/sdk/issues/30553

R=sigmund@google.com

Review-Url: https://codereview.chromium.org/3004703002 .
2017-08-29 16:33:33 +02:00
Peter von der Ahé c89fb50056 Fix issues from CL 3009573002.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/3003993002 .
2017-08-28 13:51:52 +02:00
Peter von der Ahé 07cf2557ed Implement type variables on local function declarations and expressions.
Closes https://github.com/dart-lang/sdk/issues/29798

R=danrubel@google.com

Review-Url: https://codereview.chromium.org/2994973002 .
2017-08-15 11:21:01 +02:00
danrubel 5909efe401 Fix scanning of unterminated strings
This fixes
* lineStart tracking when synthetic strings added
* token charOffset when scanning UTF-8 stream

These changes prevent the crashes mentioned in
#29976 and #29982.

R=ahe@google.com

Review-Url: https://codereview.chromium.org/2984713002 .
2017-08-01 17:31:07 -04:00