Commit Graph

4698 Commits

Author SHA1 Message Date
Brian Wilkerson f95e1475fc Remove the unused Listener.beginDottedName
Change-Id: I1c5752a9610f21dad62db6655972b4006ce632e9
Reviewed-on: https://dart-review.googlesource.com/17862
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
2017-11-01 18:35:45 +00:00
Brian Wilkerson 87a096e992 Remove the unused Listener.beginIdentifierList
Change-Id: I3644aaff3fa7a8a97b9e9bcc83f549f628a1fb71
Reviewed-on: https://dart-review.googlesource.com/17861
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-11-01 17:21:05 +00:00
Johnni Winther 1852cbab70 Use the right receiver mask in expose this computation
Change-Id: I298eeb12fca7b1e78b904b63e64ceb6414d0996a
Reviewed-on: https://dart-review.googlesource.com/17440
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-01 09:14:59 +00:00
Stephen Adams 9c4c9b5f3f Keep ClassEnv members in a list
Process the ir.Class members by fields/procedures/constructors rather
than via the get:members (which is constructed on demand).

The list of (non-constructor) members is sorted by location to keep
getters and setters in same relative order.

The list of members is iterated frequently, so iterating should be
simpler.

Unfortunately it is not possible to pre-compute the MemberEntities
since the lookup happens with both K- and J- element maps, so we still
have to create a closure in forEachMember to iterate the members.

Remaining differences:

- The position of patched members is at the whim of the file order in the sdk.

- Libraries could be similarly processed to move setters back to their relative position.

Change-Id: I1cfe1efc7bf66fd4ddaf0b0e8881e5a291656cac
Reviewed-on: https://dart-review.googlesource.com/17064
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-31 00:43:55 +00:00
Leaf Petersen 4270b99d75 Fix dynamic as bottom uses in front end and dart2js.
Re-enable the dynamic as bottom hint in analysis_options.yaml and fix
the code to be hint clean again.

Fixes #30589
Fixes #30590

Bug:
Change-Id: Idb7910b3ab1c6d931a3ead3eed885d8bd172e621
Reviewed-on: https://dart-review.googlesource.com/17062
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-30 19:54:26 +00:00
Johnni Winther 395095b21d Make semantics of isExternal consistent between frontends
Change-Id: Ieda4b47442d9e4ec7e4fcdef159e72bcf28c99e6
Reviewed-on: https://dart-review.googlesource.com/16946
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-30 10:03:32 +00:00
Stephen Adams b3a93f44eb Add dart2js noInline and tryInline annotations to package:meta
There will be a follow-up change to remove NoInline from package:expect.

Change-Id: I6dc33241ea6d8b6a8994da6a8ec5295dab30f4da
Reviewed-on: https://dart-review.googlesource.com/17043
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-27 21:21:13 +00:00
Johnni Winther 4fdbf54473 Revert "Improve precision of instantiated types for redirecting constructor"
This reverts commit f41896052c.

Change-Id: Ice6eb30c46b77e6a10faee2d6025eb92af80f03a
Reviewed-on: https://dart-review.googlesource.com/16947
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-27 11:38:16 +00:00
Johnni Winther 855388b629 Treat getter access as non-constant.
Change-Id: I2d4a07629be5984f25f6a58d2c540d8d8bb7aa6b
Reviewed-on: https://dart-review.googlesource.com/16800
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-27 08:08:36 +00:00
Johnni Winther f41896052c Improve precision of instantiated types for redirecting constructor
This also eliminates some of the noise from the old frontend compared to the new frontend.

Change-Id: Ie943063ec59d3f0e1ee7662ca1b130733cf11b9e
Reviewed-on: https://dart-review.googlesource.com/16442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-27 07:49:30 +00:00
Stephen Adams 13aca35586 dart2js kernel: closure fields are not assignable
TBR=efortuna@google.com

Change-Id: I8644a627ad45da6f3cbc422e07f7b132e6861db6
Reviewed-on: https://dart-review.googlesource.com/16902
Reviewed-by: Stephen Adams <sra@google.com>
2017-10-27 00:02:05 +00:00
Stephen Adams b55f646683 dart2js: Add SSA tracing for kernel builder
Change-Id: I35e9a6e83fc390cd9828e921912990954fa304ac
Reviewed-on: https://dart-review.googlesource.com/16690
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-26 23:44:37 +00:00
Dan Rubel a02662c47e improve errors and recovery for factory methods
Change-Id: I55711bdb0f98c0747c7055bebda173702c2c138f
Reviewed-on: https://dart-review.googlesource.com/16720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2017-10-26 21:21:00 +00:00
Harry Terkelsen 8b12b7b7a4 Remove unused method in ssa graph builder
Change-Id: Ibc3eef48e4591c55b41f3a414e02d6036a5b656a
Reviewed-on: https://dart-review.googlesource.com/16682
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Harry Terkelsen <het@google.com>
2017-10-25 21:28:08 +00:00
Brian Wilkerson 5b6260ce13 Add support for reporting errors that span multiple tokens
Change-Id: I257225465d79e1831392af14d98e0799f0a8b184
Reviewed-on: https://dart-review.googlesource.com/16660
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-25 21:19:58 +00:00
Harry Terkelsen c9aa3a688b Add custom element support to the kernel ssa builder
Change-Id: I06ec8bc2f53dd88116abb11655c83783de1d48cd
Reviewed-on: https://dart-review.googlesource.com/16328
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-10-25 16:36:29 +00:00
Stephen Adams 9a6509f68c dart2js: replace closure call to static tear-off with static call
Bug:
Change-Id: I675ec4a231773a492385992b093ba509bbc06ad8
Reviewed-on: https://dart-review.googlesource.com/15862
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2017-10-24 18:11:58 +00:00
Emily Fortuna 0b69394c49 Usage of type variables with mixins.
Bug:
Change-Id: I8c7fdf203e76e63164b3f28c23d9c0e2c9939cd8
Reviewed-on: https://dart-review.googlesource.com/15986
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2017-10-24 18:00:18 +00:00
Harry Terkelsen df4bd6c398 Don't check for cycles in constructors in const evaluation
You can use the same constructor multiple times in a single constant
evaluation. For example:

    class A {
      final List<A> deps;
      const A({this.deps: const []});
    }

    const a = const A();
    const b = const A(deps: const [a]);

    main() { print(b); }

The program above will evaluate the 'A' constructor multiple times
when compiling the constant for 'b', but that's okay, as long as
we don't examine the same field (or local) multiple times.

Change-Id: Icda198ccb47ea91a046134f55deba9041fcf1f4a
Reviewed-on: https://dart-review.googlesource.com/15989
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-10-24 16:31:08 +00:00
Johnni Winther 4c8e2af760 Handle [] in _spanFromTokens
Change-Id: I42e734a1a00ee3e9ad0bca1d445e1a8ab0bd1c5c
Reviewed-on: https://dart-review.googlesource.com/16200
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2017-10-24 09:47:59 +00:00
Johnni Winther 313ded4e1c Revert "Handle synthesized multiple inheritance"
This reverts commit 898a1ae1aa.

Change-Id: Ifca20a405a017299da3dd585fbe2f7727638d8e5
Reviewed-on: https://dart-review.googlesource.com/16220
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-24 09:39:47 +00:00
Dan Rubel dde9eb69a9 add handleInvalidMember to improve recovery
* add handleInvalidMember event
* update NodeListener to track invalidMemberCount
* update ClassMethodModifierContext to trigger handleInvalidMember
  event, reducing number of superflous errors.

Also, address comment
https://dart-review.googlesource.com/c/sdk/+/16040/1/pkg/analyzer/lib/src/fasta/ast_builder.dart#1580
Change-Id: I4c630faeee7731e2f85bbfaf0a6790bf6f4382b3
Reviewed-on: https://dart-review.googlesource.com/16100
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2017-10-24 02:58:28 +00:00
Brian Wilkerson 9575182790 Pass the period in field formal parameters to listeners to enable recovery
Change-Id: I04975f3fb1aeb3b3b6b842e3373a792f13a91685
Reviewed-on: https://dart-review.googlesource.com/16000
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-23 20:57:00 +00:00
Brian Wilkerson 6d11a2e3b4 Explicitly pass the colon following the default case in a switch to allow better recovery
Change-Id: I7e39727e1dd0a005e8e6ed565ec16cc8c503d049
Reviewed-on: https://dart-review.googlesource.com/15960
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-23 20:55:29 +00:00
Johnni Winther 898a1ae1aa Handle synthesized multiple inheritance
The reuse of mixin applications employed by kernel introduces unneeded
multiple inheritance (the same class implemented with different type arguments).
The type system in dart2js does not support multiple inheritance and flags such
cases as compile-time errors.

With this CL such synthesized cases are bypassed, while regular cases are still flagged.

Change-Id: Ieb07d2b6559e15a7b745baeddc80c07acff7a3d1
Reviewed-on: https://dart-review.googlesource.com/15886
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-10-23 18:04:22 +00:00
Johnni Winther 9bf7fc9130 Add test of index operations
Change-Id: I34e5cf8ba7bdd38a2b4094c71bc0e71c4a68c613
Reviewed-on: https://dart-review.googlesource.com/13802
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-23 08:26:43 +00:00
Johnni Winther 222af2dd08 Compute side effects during inference.
Change-Id: Iad5567cb76c8725b19446b6a802e6e704d42e99e
Reviewed-on: https://dart-review.googlesource.com/13800
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-23 07:37:18 +00:00
Johnni Winther b2e7058747 Specialize list constructors in inferrer
+ handle native methods and js-interop constructors

Change-Id: I901301bf6d4926e6ecb1e427e3d16e512d888aab
Reviewed-on: https://dart-review.googlesource.com/13722
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-23 07:29:51 +00:00
Emily Fortuna ba3cc12592 Entity-ify trustType in type_builder.
Bug:
Change-Id: Ie58b98f5a23268e97d2730f4f694d125ae9baf93
Reviewed-on: https://dart-review.googlesource.com/15060
Reviewed-by: Stephen Adams <sra@google.com>
2017-10-19 17:15:20 +00:00
Harry Terkelsen f36b1f49d6 Only set model.scopeInfo for the outer member, not nested closures
Change-Id: I848e18e1000158b4a198782227bfb2524104e805
Reviewed-on: https://dart-review.googlesource.com/14700
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-10-18 21:00:06 +00:00
Emily Fortuna 2b33f79dd1 Update localsMap when inlining or looking at super constructors.
Bug:
Change-Id: I60b2d0d87d84901817d7d03b685a068c9d2f6100
Reviewed-on: https://dart-review.googlesource.com/14621
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-10-18 17:58:32 +00:00
Emily Fortuna af3bbc194b Fix up dart2js argument passing of 'platform-binaries' so that it actually recognizes the flag.
Bug:
Change-Id: I632dc8ea1e1c145cbb93a8cb7ba061c0d2ebc948
Reviewed-on: https://dart-review.googlesource.com/14508
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Emily Fortuna <efortuna@google.com>
2017-10-17 21:02:31 +00:00
Peter von der Ahé b96ac4520a Update most clients to use computePlatformBinariesLocation.
Change-Id: I6e6960c471b2fab3f0cd8a672da05d7699217410
Reviewed-on: https://dart-review.googlesource.com/12291
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-17 10:48:40 +00:00
Emily Fortuna e3d0a7093c Test TypeVariables in isTest correctly (and non-type variables) in Kernel.
Bug:
Change-Id: I624e7a111841bcab77d370163ac21d2c5cc3010a
Reviewed-on: https://dart-review.googlesource.com/13681
Reviewed-by: Stephen Adams <sra@google.com>
2017-10-14 00:20:44 +00:00
Harry Terkelsen cbfb3b642d Treat async-for-in statements as if they are wrapped in a try-finally
Change-Id: Ide40e69f93db199e2b452a4ee5acbbabe331bcbf
Reviewed-on: https://dart-review.googlesource.com/13921
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-10-13 22:19:46 +00:00
Johnni Winther f80860ddbd Track exposure of this in inferrer
Change-Id: I07d899ed59fd28ffe258c518743c66aa20fa0540
Reviewed-on: https://dart-review.googlesource.com/13480
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-13 07:50:35 +00:00
Brian Wilkerson a22c8dc958 Recover when enum constants have metadata
Change-Id: I1432c3b2d4ce63c5520087c79dd33e48c57cee5b
Reviewed-on: https://dart-review.googlesource.com/13102
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Dan Rubel <danrubel@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2017-10-12 20:50:31 +00:00
Johnni Winther 99af2fef35 Handle initializers in inferrer.
Change-Id: I0f21682448da8e427a73b849c8e6c8cc523c8201
Reviewed-on: https://dart-review.googlesource.com/12940
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-12 08:08:03 +00:00
Johnni Winther 0daecdf552 Skip captured variables in refinement.
Change-Id: Iad54833db0dbdc683790fccec3dca4f5cf435657
Reviewed-on: https://dart-review.googlesource.com/12442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-12 07:59:13 +00:00
Sigmund Cherem 606e8502f8 fix recovery on ||= and &&= in dart2js
Bug: https://github.com/dart-lang/sdk/issues/31061
Change-Id: I3f8667d5dab92d256122484a6fc83b3527228085
Reviewed-on: https://dart-review.googlesource.com/12760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-11 22:37:17 +00:00
Harry Terkelsen d62eb05435 Search for members in superclasses when searching for a class member
This changes 'hasConcreteMatch' to search the superclass chain in the
kernel implementation. This matches what the Element model does.

Change-Id: I6a0ab69bc7e6fe705139d6fa69fffc2346582702
Reviewed-on: https://dart-review.googlesource.com/12843
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-11 22:07:11 +00:00
Paul Berry 7df0fb6c28 Add type propagation support for conditional expressions.
This required adding a few extra parser events to allow the type
propagator to update its state when the `?` and `:` are encountered
(similar to what was done for `if`).

Fixes #30620.

Change-Id: I0d3ede8056fd8bab01ead5b242d00803286c9373
Reviewed-on: https://dart-review.googlesource.com/13182
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2017-10-11 20:21:22 +00:00
Emily Fortuna a40fd8b507 Fixed up JS Interop, correct "native" detection, and made HN angular app run!
Bug:
Change-Id: Iea339d62d891661d6d1415424b12ac3f914b046e
Reviewed-on: https://dart-review.googlesource.com/12460
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-10 18:26:54 +00:00
Sigmund Cherem ec49b67b19 Split init.metadata by deferred chunk
Bug: http://dartbug.com/30002
Change-Id: I532f122a9b10054a51e40c49b3759c0af471370e
Reviewed-on: https://dart-review.googlesource.com/9140
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
2017-10-09 19:41:15 +00:00
Harry Terkelsen 954aa98da5 Use the RHS as the return value for super set exprs
Change-Id: If456ee64873354cd0cfb61024982e35ce5e97149
Reviewed-on: https://dart-review.googlesource.com/12241
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-09 18:53:55 +00:00
Johnni Winther da3eff3cbf Handle if-null and conditional access in inferrer
- including refinement of locals

Change-Id: I0a77f406ae734fc7823832e1835a8454c975cc85
Reviewed-on: https://dart-review.googlesource.com/12140
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-06 20:49:16 +00:00
Johnni Winther a6bc13adb9 Refine locals in inferrer.
Change-Id: I3d43f739e680bba7b08f0cf004745a03e52c2f30
Reviewed-on: https://dart-review.googlesource.com/11923
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-06 20:14:51 +00:00
Johnni Winther a39a5729b2 Handle optimizer hints in inferrer.
Change-Id: I2daac411c59a491a8860e6bfc1c85a653816d411
Reviewed-on: https://dart-review.googlesource.com/11920
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-06 20:05:38 +00:00
Johnni Winther 9e1532121e Handle await, await for, and yield in inferrer.
Change-Id: Idd3c86a095493ca37997388f4e531d7cb5e0a772
Reviewed-on: https://dart-review.googlesource.com/11900
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-06 19:59:24 +00:00
Harry Terkelsen f690f6225e Use the validating constructor when creating a Symbol.
Change-Id: Iae150ad036f8a72dcc853b86ecd01c569d28bd0b
Reviewed-on: https://dart-review.googlesource.com/11963
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-10-06 19:54:47 +00:00