Commit Graph

339 Commits

Author SHA1 Message Date
Johnni Winther 7580e77ef2 Support modular code generation
Change-Id: Id5511296eb0b6acf812bc464d71efa4019f211d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/103523
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-05-24 07:38:13 +00:00
Nate Bosch 69a4f20347 Add override annotations consistently
This makes it easier to follow class hierarchies and understand where a
class is changing the interface. I hit this when I found a class that
had the annotation on some methods it was overriding, but not all, which
made it confusing.

Prepares for adding the lint rule and enforcing it.

40% of overridden methods were annotated - add annotations to the remaining 60%.

Change-Id: I02472f4b6c5026a820cf9ff1a7ada663a60f1868
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/96666
Commit-Queue: Nate Bosch <nbosch@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-03-13 22:36:11 +00:00
Johnni Winther 430560d928 Track parameter use in invocations in MemberUsage
Change-Id: I53b4ad1ff533d913bdff7e48558fdc56ce016e3f
Reviewed-on: https://dart-review.googlesource.com/c/89525
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2019-01-17 08:48:48 +00:00
Stephen Adams f0c7d971c4 [dart2js] Run dartfmt --fix-doc-comments
Change-Id: I004a5da3f3e3adb5fc6f3088ba8dc3ca5082fbef
Reviewed-on: https://dart-review.googlesource.com/c/89163
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2019-01-11 21:13:17 +00:00
Johnni Winther 1e4b123e54 Delete DartType.isMalformed
Change-Id: I5715c7d4caf0d1821f1487adef0ae74784d6c35b
Reviewed-on: https://dart-review.googlesource.com/c/86701
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-12-10 09:39:21 +00:00
Johnni Winther 41c50d9ac9 Support serialization of deferred imports
+ add tests for various fixes
+ add canonicalization support in serialization

Change-Id: Ib6a8bfd6073dbd93c1ba4fd9d2feff77ac43b178
Reviewed-on: https://dart-review.googlesource.com/c/81402
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-26 09:36:18 +00:00
Johnni Winther 8b6f8969a6 Support post-inference serialization/deserialization
Currently handling Swarm in-memory serialization/deserialization.

Change-Id: I4b01f70d1e42d7462ed079ece227d6c2ed4de597
Reviewed-on: https://dart-review.googlesource.com/c/80445
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
2018-10-22 14:37:04 +00:00
Johnni Winther 843b4c9c23 Refactoring to prepare for serialization
- pipes GlobalLocalsMap, ClosureData and OutputUnitData through JClosedWorld

Change-Id: Id1d8353a9c75217aab7e06a276bfb503f50a5811
Reviewed-on: https://dart-review.googlesource.com/c/79683
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-10-17 12:05:05 +00:00
Peter von der Ahé 248954117a Consolidate dart2js front-end dependencies
Also, convert dart2js to use onDiagnostic.

Change-Id: Ifdf89349eaf2ebe8cfcd1994712b3d1be2dd4197
Reviewed-on: https://dart-review.googlesource.com/77400
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2018-10-02 12:34:28 +00:00
Stephen Adams 1e5b80918a [dart2js] hashCode stability to improve repeatability
The default Object.hashCode is different on every run, so avoid using it for MemberEntity.hashCode.

Using a consistent (if arbitrary) hashCode appears to fix issue 34527
and also makes the *.js.map files consistent.
We also sort instructions in SsaCodeMotion to make order less sensitive to unrelated changes.

We might still want to impose a canonical ordering for map files, e.g. minified map file entries might be sorted by name.

Change-Id: I94ad6c1e18ac808b92e62e76b48558a7e2fbd7b7
Reviewed-on: https://dart-review.googlesource.com/75982
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-09-21 23:47:50 +00:00
Johnni Winther db1570bdcd Split element maps for J/K further
* The J model is in the /js_model/ folder and KernelToElementMapForBuilding is renamed
  to JsToElementMap.
* The K model is in the /kernel/ folder and KernelToElementMapForImpact is renamed
  to KernelToElementMap.
* Code shared between JsToElementMap and KernelToElementMap is in the /ir/ folder using
  the interface IrToElementMap internally.
* KernelToElementMap and JsToElementMap do _not_ implement IrToElementMap so all code
  that is not part of the implementation must explicitly use one or the other.
* Both KernelToElementMap and JsToElementMap extend KernelToElementMapBase
  but this will be changed in a follow-up.

Change-Id: Id6b762984d25354477cb099dc2f8301b83a7ba07
Reviewed-on: https://dart-review.googlesource.com/73382
Reviewed-by: Stephen Adams <sra@google.com>
2018-09-11 11:10:37 +00:00
Johnni Winther 814738b273 Remove CompilerOptions.strongMode/enableTypeAssertions/trustTypeAnnotations
Change-Id: I4a51b081f42d76f12c70c140286c28375fcbd5ce
Reviewed-on: https://dart-review.googlesource.com/70515
Reviewed-by: Stephen Adams <sra@google.com>
2018-08-21 08:21:02 +00:00
Stephen Adams 4d156f9fb0 [dart2js] Fix function_type GVN bug
Fixes #30476

Change-Id: Ie1e536c197b137ccddeeaa45d337f1bd16a2ff78
Reviewed-on: https://dart-review.googlesource.com/68848
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-08-08 00:05:14 +00:00
Johnni Winther 1c673b1046 Include bounds in type literals
Change-Id: Ieb3e5b09e88c98f8943a6e7ca9031c8a6ab776e1
Reviewed-on: https://dart-review.googlesource.com/63820
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-09 12:24:04 +00:00
Johnni Winther 5dbf6da529 Remove generics where only ir.Node is used
Change-Id: I500b237a871ee21aca1a800806cdc95828713b5c
Reviewed-on: https://dart-review.googlesource.com/63944
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-07-06 22:02:57 +00:00
Johnni Winther 21b65a9732 Remove unused typedef code
We only use the name of typedef type literals. These are passed through
TypeConstantExpression to TypeConstantValue and used directly as the
nominal identity (!) of the emitted typedef type literal constant value.

Note that the emitted typedef type literal has no relation to its alias.

Change-Id: I1cdc5a88a9b3d75faa0786ecd07226b5075df1c4
Reviewed-on: https://dart-review.googlesource.com/55898
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-24 09:52:50 +00:00
Johnni Winther f1f660fe1e Small cleanup
Change-Id: I368fbaa3bac5a5a47c374f26998cce8ad8b265a6
Reviewed-on: https://dart-review.googlesource.com/55890
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-18 19:33:48 +00:00
Johnni Winther 54331b1c4b Delete elements.dart and resolution_types.dart
Change-Id: Ib50dabdbeec72ebf443e85b51b818d9ed0602b4f
Reviewed-on: https://dart-review.googlesource.com/55221
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther baf09db165 Remove Resolution and Target
Change-Id: I30fb47acd820077b0dd9efebc3460a9a8a1e6e1f
Reviewed-on: https://dart-review.googlesource.com/55200
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther 47a67b2b8f Delete AST nodes
Change-Id: Iab9396b3a21cd9502c455fb73633216faed777ef
Reviewed-on: https://dart-review.googlesource.com/55126
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-16 09:54:18 +00:00
Johnni Winther 6fe26e7e55 Delete ElementVisitor, equivalence_helper and move live Elements functions
Change-Id: I0af209210d4a471ba12f939bd8e3a429dab100df
Reviewed-on: https://dart-review.googlesource.com/54913
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-15 08:37:29 +00:00
Johnni Winther 330271ed2b Delete modelx
Change-Id: I8f69655ee251cef097b46d80ddfbb7d2434b1051
Reviewed-on: https://dart-review.googlesource.com/54903
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-15 08:37:29 +00:00
Johnni Winther 4d76600b22 Delete SemanticSendVisitor
Change-Id: I0ccf8527e973dc5cfeac19caaaac026f91795e17
Reviewed-on: https://dart-review.googlesource.com/54860
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2018-05-15 08:37:29 +00:00
Johnni Winther c71e680152 Delete ResolverVisitor and friends
Change-Id: I012a86ca2d0f1986b226f1e4fea20ee295ccb6ed
Reviewed-on: https://dart-review.googlesource.com/54409
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-14 08:14:07 +00:00
Johnni Winther d13bf49870 Check type-variable bounds on generic methods
Closes #32711

Change-Id: I86c123f5a8b9eda393b276248cdd27d1b109354b
Reviewed-on: https://dart-review.googlesource.com/53201
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-05-03 09:36:58 +00:00
Johnni Winther f74ee52c70 Optimize signature need computation.
Change-Id: Ied6dfbfe71a9d323e189dbcacdb5ae2985c3fbb8
Reviewed-on: https://dart-review.googlesource.com/52221
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-23 08:00:02 +00:00
Stephen Adams 81d779c41b Redo "Pass type argument into rewritten marked function"
TBR=sigmund@google.com

Change-Id: I0999ab52f76da185c601ce7105e4a8491c5e4edf
Reviewed-on: https://dart-review.googlesource.com/52262
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2018-04-21 01:14:49 +00:00
Stephen Adams a5ea3c5e33 Revert "Pass type argument into rewritten marked function"
This reverts commit 25b3dbb7b3.

TBR=sigmund@google.com

Change-Id: If0e37738e1516efcb144bffbaf57cfc7d3028d13
Reviewed-on: https://dart-review.googlesource.com/52261
Reviewed-by: Stephen Adams <sra@google.com>
2018-04-20 19:30:14 +00:00
Johnni Winther 395c96153b Fix subtype/equals for function types with type variable return types.
Change-Id: I645f73cabc74c4a427eb100220b3ddcf7232b0a4
Reviewed-on: https://dart-review.googlesource.com/52101
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2018-04-20 19:21:59 +00:00
Stephen Adams 25b3dbb7b3 Pass type argument into rewritten marked function
The values returned from calling sync*, async and async* are now parameterised.
Simple cases where the type has no type parameters are handled.

The next step is to introduce a signature-like j-model entity to compute the type in more complex cases.


Change-Id: I2e43088cc6383a70e3a3d3067ec7542694ee2d0a
Reviewed-on: https://dart-review.googlesource.com/51421
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-20 18:41:59 +00:00
Johnni Winther 1dfb1c2f64 Implement Dart 2 static subtyping
Change-Id: I8b61b30d036e4e89d04b2704c265b5f6ebea9f47
Reviewed-on: https://dart-review.googlesource.com/49120
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-04-04 08:02:51 +00:00
Stephen Adams 0c892a8bc8 Improve signatures of tear-offs
Signatures for static tear-offs cannot have free variables, so we can
always generate them in the types table.

Signatures for instance tear-offs can always use the existing
mechanism, since the type must be parameterized only by the class
instance type parameters.

Change-Id: I3ccfe8fc9220c57cfee07e1f7d9afbd5674b2b92
Reviewed-on: https://dart-review.googlesource.com/48841
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2018-03-31 01:30:21 +00:00
Johnni Winther 5271cc4e81 Support FutureOr at runtime
Change-Id: I6d442ac160739490c2591367055aaa0ba0c00047
Reviewed-on: https://dart-review.googlesource.com/48143
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-26 12:54:58 +00:00
Johnni Winther c3f177b8cc Add FutureOr to dart2js static type system
Change-Id: I0e26c82fffaa41d2e3fc02ba4d2b253c3673ce1a
Reviewed-on: https://dart-review.googlesource.com/46260
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-03-19 11:50:55 +00:00
Johnni Winther 7c2d96490d Support forwarding bounds in function type variables
Change-Id: Ifeab9ad06f512d9b6a5db02fc89d45250c25c054
Reviewed-on: https://dart-review.googlesource.com/40821
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-26 09:45:56 +00:00
Johnni Winther 41118c438e Reimplement runtime type checks computation
Change-Id: Ic1baa96e60db30cf9afe3414e605f0200361583b
Reviewed-on: https://dart-review.googlesource.com/37560
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-02-12 13:29:30 +00:00
Sigmund Cherem 3b6d39cc2c Correctly defer typedef references
Change-Id: I61fb5ebb399dcfca5193b7ae870badc10add23e5
Reviewed-on: https://dart-review.googlesource.com/37880
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2018-01-31 21:10:29 +00:00
Johnni Winther 9b0d9a2882 Track type variable tests through generic method invocations.
Change-Id: Ibb4fdf92ca1085034db5d10c3f10b46f60c70c16
Reviewed-on: https://dart-review.googlesource.com/36941
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2018-01-29 09:20:02 +00:00
Brian Wilkerson 72200eee24 Fix expressions in asserts to be bool rather than a closure
Change-Id: I2fbb495b51ba4ff34b3893075b86153d294607b8
Reviewed-on: https://dart-review.googlesource.com/32684
Reviewed-by: Emily Fortuna <efortuna@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2018-01-06 01:54:18 +00:00
Emily Fortuna 21891a965f Do id equivalence testing for deferred imports.
Also allows us to more generally compare annotations in multi-file tests.

Bug:
Change-Id: I2f4ac34b918cc80400ebc417dfcc2caf56457ac2
Reviewed-on: https://dart-review.googlesource.com/30923
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-12-22 20:04:44 +00:00
Sigmund Cherem 414bad86df Directly create dart2js platform files using its patch files
Change-Id: I1c7d59968bfafeeb5a8b5252fa2d47e3c05b893e
Reviewed-on: https://dart-review.googlesource.com/27404
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Emily Fortuna <efortuna@google.com>
2017-12-19 20:31:57 +00:00
Johnni Winther b13a6015cc Support subtyping for function type variables.
Change-Id: I0e00330d76cc9b1f3d48bb1f0d87f6334976de54
Reviewed-on: https://dart-review.googlesource.com/29281
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-14 10:09:55 +00:00
Johnni Winther cd2afed97b Add typeArgumentCount to CallStructure
- to prepare for passing type parameters to generic methods.

Change-Id: I71fce9b2febdc69e650ec13569a70564b75ea3f1
Reviewed-on: https://dart-review.googlesource.com/26602
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-07 08:43:23 +00:00
Emily Fortuna fe178582ef Add constraint checks for constructors (factory and generative).
Bug:
Change-Id: I68a3420276cd49c33ca4697262117aa8d4a3ff0f
Reviewed-on: https://dart-review.googlesource.com/26740
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-06 21:51:30 +00:00
Johnni Winther 08bd6919bf Introduce FunctionTypeVariable
+ rewrite subtype_test and friends to enable type tests from kernel
+ compute bounds on regular type variables

Change-Id: I8979d3e69bdfe7713146f546cc80c4d81f04778b
Reviewed-on: https://dart-review.googlesource.com/26200
Reviewed-by: Emily Fortuna <efortuna@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-12-06 14:46:44 +00:00
Emily Fortuna dc1b5525bf Create temporary Method type in kernel world for compatibility with Dart 1
Bug:
Change-Id: I9efa163ce1a9a76df405f32d35850743e7f090cc
Reviewed-on: https://dart-review.googlesource.com/25723
Commit-Queue: Emily Fortuna <efortuna@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2017-12-04 19:37:54 +00:00
Sigmund Cherem 5799422d80 Support deferred loading in the kernel pipeline.
Change-Id: I8189a39db57e8cbac1e708a628dfcae70682ef3b
Reviewed-on: https://dart-review.googlesource.com/18685
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-11-07 23:00:50 +00:00
Johnni Winther 29f3cc0db1 Various fixes for erroneous cases
Change-Id: I1c370dd220ff5e27196dcc8294d3c8eeda80462c
Reviewed-on: https://dart-review.googlesource.com/18483
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2017-11-06 08:42:46 +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
Harry Terkelsen dfb71004c7 Register seen classes as part of the impact.
This allows us to construct the class hierarchy from the impact results.

Change-Id: Id10a197eb80e60d5e25e093ffdadf8d0af092ecf
Reviewed-on: https://dart-review.googlesource.com/10208
Commit-Queue: Harry Terkelsen <het@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-03 21:36:33 +00:00