Commit Graph

2696 Commits

Author SHA1 Message Date
Johnni Winther b42f954364 [cfe] Use experiment release version when non-nullable is enabled explicitly
Even when non-nullable is enabled by default, enabling the experiment
explicitly should result in the experiment release version (and not
the experiment enabled version) to be used for opting in.

For this change, the semantics of parseExperimentalFlags was change
to _not_ normalize the flags to a full mapping including default values.
For this reason all uses of such maps are renamed to
'explicitExperimentalFlags'.

Closes #43879

Change-Id: I0d0262e68ec1403549abcfd305ae3a4404fe93e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168654
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-22 06:17:39 +00:00
Jens Johansen 29fa4e8148 [CFE et al] Compile flutter platform as agnostic for test; set component mode more
Bug: dartbug.com/43844 dartbug.com/43807
Change-Id: Iba662f0955897244aaac86ceace73b213fa06319
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168482
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-21 10:04:41 +00:00
Nicholas Shahan f990e70930 [ddc] Opt code in nullable inference test
Avoids breaks that appear when enabling the `nnbd` experiment
by default as seen in:
https://dart-review.googlesource.com/c/sdk/+/166790

Change-Id: Idaf69b40c27336c8601cb143741f79604d2647e7
Fixes: https://github.com/dart-lang/sdk/issues/43843
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168583
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-20 21:38:51 +00:00
Lasse Reichstein Holst Nielsen 48c73d82bf Clean up annotations and update @override documentation.
Fixes #43622

Bug: http://dartbug.com/43622
Change-Id: I4adea2995146ecd317d5c90a514cb564afa4f846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165800
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-10-20 15:56:13 +00:00
Anna Gringauze f04bc85e4f Refined scope calculation in expression compiler
- make sure nested blocks scopes are visited
- make sure variable definitions do not leak beyond block scopes
- properly collect scopes for loops, if statements, constructors
- add calculation of fileEndOffsets for blocks
- save block file offsets to dill
  - update binary format version
  - change kernel readers and writers to read and write block offsets
  - change vm readers to read and block offsets for new version
- add missing fileOffsets and fileEndOffsets on functions for
  late fields
- add missing fileOffsets and fileEndOffsets on functions for
  extensions
- add errors on failures to find scope
- find libraries for private fields correctly
- add more expression compilation tests
- add test to verify fileOffsets and fileEndOffsets are set for
  SDK summary (will add full dill tests later)

Closes: https://github.com/dart-lang/sdk/issues/40278
Related: https://github.com/dart-lang/sdk/issues/34942

Change-Id: I5bc1bb645543045b689d8d61069ee77dc4ee9025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167541
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-20 01:44:52 +00:00
Nicholas Shahan f3962367a5 [ddc] Add language version to test files
Avoids breaks that appear when enabling the `nnbd` experiment
by default as seen in:
https://dart-review.googlesource.com/c/sdk/+/166790

Some of these synthetic files are created as packages but the
expression compiler wasn't designed to handle that information.
In the future we should support language versioning better in the
expression compiler or setup similar tests for opted in code since
in reality the language versioning might be handled by the dev
build system.

Fixes: https://github.com/dart-lang/sdk/issues/43843

Change-Id: Icfac40d1c9b47e75fb92d7672700e066ac372267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168441
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-20 00:48:08 +00:00
Michal Terepeta 9dade7fd21 Revert "[ddc] Move native null-checks to definitions"
This reverts commit e02085bec3.

Reason for revert: This seems to break an internal test
(http://b/171029249).

Original change's description:
> [ddc] Move native null-checks to definitions
>
> Bug: https://github.com/dart-lang/sdk/issues/42535
>
> Native null-checks are moved to member definitions, and native
> member accesses are changed to use this indirection in the case
> where the member type can be checked.
>
> Change-Id: I499bb3a4f6a66021dd0ab7930a55e7233c1ce020
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166785
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>

TBR=sigmund@google.com,nshahan@google.com,srujzs@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: https://github.com/dart-lang/sdk/issues/42535
Change-Id: I145ff11a18374d0d63e2042956ad53ea0939baf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168345
Commit-Queue: Michal Terepeta <michalt@google.com>
Reviewed-by: David Morgan <davidmorgan@google.com>
Reviewed-by: Michal Terepeta <michalt@google.com>
2020-10-19 13:43:27 +00:00
Nicholas Shahan 6b84ac8d0f [ddc] Optimize creating native typed data lists
Connect the type hierarchy with the missing (compared to the
dart2js versions) of the JSMutableIndexable class.

Avoids an extra copying of all data to a temporary list during
the construction just to get access to the index operator.

Change-Id: I8a9f8ba4d956ac49d6fb635709d11a6e7c018270
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166782
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan 0376746d84 [ddc] Optimize list operations
Avoid redundant element casts and checks if the list is growable.

Change-Id: Ib915ccf2ec65fbe7d32ecaabe23899f2530617c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166781
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan 885cc8ce18 [ddc] Optimize toString() calls
Change-Id: Ib2caa2d08076fac80917336f69c22ab771e95664
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166301
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan bef5ffde1e [ddc] Optimize calling values typed as a Function
Change-Id: Idb74eb268de780e935d72c91f0758cbb02552d2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166300
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan 4cb164215f [ddc] Trust non-nullability of awaited expressions
Change-Id: I0691dd2b2b7fd9f3e563952d983514cd095bb6ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166940
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan ed8933db3f [ddc] Trust non-nullability of casts
Change-Id: I19f73e7a3e1f65e27a27eb00f6f6d41ffda598af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165141
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan e2a4906c51 [ddc] Trust non-nullability of return types
Change-Id: I2587fc8f263762524dfac27c75bd975d7aa51299
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165140
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Nicholas Shahan e92b1b30b0 [ddc] Trust non-nullability of variables
Use the non-nullablity of local variables and method arguments
to help guide the nullable inference when running with sound
null safety.

Change-Id: I00484dc908502b600de058103381af6588c4a958
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155301
Reviewed-by: Mark Zhou <markzipan@google.com>
2020-10-16 21:21:42 +00:00
Srujan Gaddam e02085bec3 [ddc] Move native null-checks to definitions
Bug: https://github.com/dart-lang/sdk/issues/42535

Native null-checks are moved to member definitions, and native
member accesses are changed to use this indirection in the case
where the member type can be checked.

Change-Id: I499bb3a4f6a66021dd0ab7930a55e7233c1ce020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166785
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-10-15 21:10:57 +00:00
Kevin Moore 98a21f44d5 dev_compiler: cleanup outdated URLs
dartlang.org -> dart.dev
Remove references to dev-compiler group that has been deleted

Change-Id: I8d994b5f2dba19aab3c3b0fc16c5c340fbce80fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167442
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-10-13 20:06:28 +00:00
Kevin Moore 8f43fb01c7 This package is no longer published
Change-Id: Ic5e3156ed5e8be131cbd2498017da6f336038761
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167420
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-13 17:19:06 +00:00
Anna Gringauze a8c727a61a Use types of parameters for expression compilation
- use parameter types passed to IncrementalCompiler.compileExpression
  for compilation of the synthetic function containing the expression
- updated expression compiler tests

Note: some expressions that previously compiled wouldn't now
Example:

** package:test/library.dart **

class TestLibraryClass {
  final int field;
  final int _field;
  TestLibraryClass(this.field, this._field);
}

** main.dart **

import 'package:test/library.dart';

void main() {
  var instance = TestLibraryClass(1, 2);
  print('$instance'); // Breakpoint here
}

Expression:

`instance._field`

Previously, the incremental compiler would compile the expression
to kernel due to the type of instance being Dynamic. That compilation
result made it impossible for dartdevc to generate correct code due
 to missing type information.

Now, the compilation will fail with "Getter isn't defined"
error. To properly evaluate private fields now, we would need
the CFE to support a special mode for expression compilation
where private fields from other libraries are allowed.

Closes: https://github.com/dart-lang/sdk/issues/43469
Change-Id: Id8015c5e334115a82049fb2d1725db54dd3ea3dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166925
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-10-13 01:44:02 +00:00
Leaf Petersen e85bf740ef Opt pkg/dev_compiler out of null safety.
Change-Id: I62207a436605480b6981b8b00bf7b88d8589db0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166980
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-10-12 23:25:42 +00:00
Mark Zhou 38667e5667 [dartdevc] Lazily executing deferred types to prevent improper module reordering.
Supercedes the following (reverted/abandoned) CLs:
  * https://dart-review.googlesource.com/c/sdk/+/162383
  * https://dart-review.googlesource.com/c/sdk/+/165149
  * https://dart-review.googlesource.com/c/sdk/+/165782

Fixes https://github.com/flutter/flutter/issues/66859 and https://github.com/flutter/flutter/issues/64011

Thanks to Siggi for this approach!

Change-Id: I8e496fdb938e18252ec8a0cf7232c99ca8c27080
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166127
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-10-06 21:31:33 +00:00
Nicholas Shahan 59fe3d510d [ddc] Fix incorrect source maps from JS templates
JS templates should always use their own source information. DDC
was incorrectly caching and reusing templates with the same source
information in various parts of the program. This lead to incorrect
source maps and in some cases compiler crashes when the source map
in a user application pointed to source location in the SDK.

Change-Id: I11607e6f02b894ead1d350e9b3071173ba36a048
Fixes: https://github.com/dart-lang/sdk/issues/43589
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166122
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-10-06 01:17:53 +00:00
Mark Zhou 350481a93c Revert "[dartdevc] Fixing issue related to dual exports of multiple entrypoints in a cyclic import loop."
This reverts commit 53895b2270.

Reason for revert: Replacing this change with a new strategy for better module reordering.

Original change's description:
> [dartdevc] Fixing issue related to dual exports of multiple entrypoints in a cyclic import loop.
>
> See: https://github.com/flutter/flutter/issues/64011
> Change-Id: I8a11e9d3f19428a516cf7a60ee45c3bacf26545d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162383
> Commit-Queue: Mark Zhou <markzipan@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>

TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Iee91d33d1696ffa7406b724466144ab06af80394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165873
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-05 23:49:53 +00:00
Anna Gringauze 719094028a Ensure expression compiler worker can terminate
- add handling a 'Shutdown' message to expression compiler worker
  so the parent program can terminate it before exiting itself

Closes: https://github.com/dart-lang/sdk/issues/43513
Change-Id: I18a4cbd9214a5e72c90d725039c2936e6e67a231
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163960
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-10-05 22:22:12 +00:00
Johnni Winther 8b07d1902c [kernel] Remove DirectPropertyGet/DirectPropertySet/DirectMethodInvocation
These nodes are no longer used.

Change-Id: I40c8df7376f0c40a4122c22d934fb3c6f6fd520d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165902
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-10-03 19:15:41 +00:00
Mark Zhou 3234534bf9 Revert "[dartdevc] Conserving virtual mixin superclass hierarchies even when marked as deferred"
This reverts commit 17dba76fb5.

Reason for revert: Replacing this change with a new strategy for better module reordering.

Original change's description:
> [dartdevc] Conserving virtual mixin superclass hierarchies even when marked as deferred
>
> Fixes https://github.com/flutter/flutter/issues/66859
>
> Change-Id: I9ca3ae7a312d48192659508f2fa0617c7f85efd9
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165149
> Reviewed-by: Nicholas Shahan <nshahan@google.com>
> Commit-Queue: Mark Zhou <markzipan@google.com>

TBR=sigmund@google.com,nshahan@google.com,markzipan@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: I02561ab7e4678392ee96a6132b96c7f0a1499a34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165872
Reviewed-by: Mark Zhou <markzipan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-10-02 23:55:11 +00:00
Jens Johansen fc7de901ee [kernel] Make LogicalExpression operator an enum (and rename)
Change-Id: I6054e8e44133d2419582d74700c4223d51495978
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165606
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-02 09:41:12 +00:00
Mark Zhou 17dba76fb5 [dartdevc] Conserving virtual mixin superclass hierarchies even when marked as deferred
Fixes https://github.com/flutter/flutter/issues/66859

Change-Id: I9ca3ae7a312d48192659508f2fa0617c7f85efd9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165149
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Mark Zhou <markzipan@google.com>
2020-10-01 20:12:20 +00:00
Sigmund Cherem 22c3d24f77 [ddc] allow stack trace to be visible when running ddb with d8
Change-Id: I97017bfdf113c4815e2d634c55c017d4b433fcbd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164602
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-09-26 00:35:14 +00:00
Srujan Gaddam f4f53ca252 [ddc] Add nullability assertions for native values
Bug: https://github.com/dart-lang/sdk/issues/42535

Adds a runtime flag to ddc to enable runtime checks on native APIs.
In the case where an API is typed non-nullable but returns a null
value, throws a null assertion error.

Change-Id: I4d5d7529ba28d9308687dad5d51f1b9c71274455
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162461
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-09-25 01:32:43 +00:00
Johnni Winther 5d8a9340ae [cfe] Add support for using backend defined sentinels in late lowering
Change-Id: Iabcd0c79fb8f09c9de99856e50518eb7ace38464
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163860
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-09-23 08:07:26 +00:00
Anna Gringauze 1c8020cfc7 Emit module and add logging with timer to expression compilation
- Emit module before expression compilation to JavaScript so the
  ProgramCompiler has all types available.

- Add logging with ticker to expression compilation in expression
  compilation worker in DDC and in frontend server.

- Remove excessively verbose logging

Related:
https://github.com/dart-lang/webdev/issues/1006
https://github.com/dart-lang/webdev/issues/1106
Change-Id: Ia3a985f2d12d27f0bcc2c5d3923db137070e9cdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162624
Commit-Queue: Anna Gringauze <annagrin@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-09-22 02:17:12 +00:00
Johnni Winther f4501b6e83 Reland "[kernel] Rename Name.name to Name.text"
Including a deprecated getter to avoid breaking dependent code outside
the Dart repo.

Change-Id: I365957b7c2da6e0cb5c71eb8d2906b0dc6ff18ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163062
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-17 06:10:49 +00:00
Nicholas Shahan 1d34f60b66 [ddc] Fix missing covariant checks from mixins
Collect all forwarding stubs from anonymous mixin classes and insert
them in the target class if no override exists.

Change-Id: Id62f20b644ce7bbabe114d0d1648664392748a2d
Fixes: https://github.com/dart-lang/sdk/issues/43027
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161760
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-09-16 18:56:58 +00:00
Johnni Winther 644df9b9fb Revert "Reland: [kernel] Rename Name.name to Name.text"
This reverts commit c430a0ac0b.

Reason for revert: Will break flutter_frontend_server when rolled into google3

Original change's description:
> Reland: [kernel] Rename Name.name to Name.text
> 
> Change-Id: I5240b0ff09faf35184998920202d7600dc97766d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162746
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: Ib6961f49dd416171c5d5935c490d79d6f7be779e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162748
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 08:22:55 +00:00
Johnni Winther c430a0ac0b Reland: [kernel] Rename Name.name to Name.text
Change-Id: I5240b0ff09faf35184998920202d7600dc97766d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162746
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-16 07:42:42 +00:00
Daco Harkes 7302e01a79 Revert "[kernel] Rename Name.name to Name.text"
This reverts commit 3ff8dd2f51.

Reason for revert: Fails all CI builders. Possibly something landed
in the mean time.

Original change's description:
> [kernel] Rename Name.name to Name.text
> 
> Change-Id: I93162fb387ba123b949e19a7829bd5614845b15d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162722
> Reviewed-by: Jens Johansen <jensj@google.com>
> Commit-Queue: Johnni Winther <johnniwinther@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: I2ffe526dabf37ae09d5e4ab1fbe514925f6e8768
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162744
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2020-09-15 15:21:35 +00:00
Johnni Winther 3ff8dd2f51 [kernel] Rename Name.name to Name.text
Change-Id: I93162fb387ba123b949e19a7829bd5614845b15d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162722
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-15 14:27:22 +00:00
Mark Zhou 53895b2270 [dartdevc] Fixing issue related to dual exports of multiple entrypoints in a cyclic import loop.
See: https://github.com/flutter/flutter/issues/64011
Change-Id: I8a11e9d3f19428a516cf7a60ee45c3bacf26545d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162383
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2020-09-14 18:49:00 +00:00
Nicholas Shahan 50dfbe9579 [ddc] Escape type name identifiers
Avoids a compiler crash if invalid characters in the type names leak
from the CFE.

Change-Id: I3c9a9fcfd2ac6ef4f7ef5593a53d6f936653955e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162260
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-09-10 01:02:46 +00:00
Anna Gringauze 0567798ea5 fix expression_compiler_worker_test failure on windows
Closes: https://github.com/dart-lang/sdk/issues/43324
Change-Id: I73c861e8b665d023ac5c820fc88eb75d62edb179
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162106
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-09-09 16:22:29 +00:00
Anna Gringauze 34052bf2bb Add expression evaluation to ddc for google3
- Move expression evaluation to ddc in preparation for google3
- Added server to ddc to handle update and compileExpression requests
- Added tests
- Added 'experimental-output-compiled-kernel' option to ddc to generate
  full kernel files only for compiled libraries, and store with
  '.full.dill' extension
- Added AssetFileSystem to communicate to the asset server in the
  debugger
- Made expression_compiler_worker work with full kernel files,
  so removed invalidation of current file to improve performance
- Made expression_compiler_worker reuse already loaded imports
  to avoid reading them from source in the incremental compiler
- Updated tests to work with DDC (for simulating webdev)
- Disabled tests that work with bazel kernel worker for now
  as it does not generate full dill files yet
- Addressed code review comments from the prototype version:
  https://dart-review.googlesource.com/c/sdk/+/157005

Details:

Currently, in flutter tools, expression evaluation is supported via
expression compilation, which is done by the incremental compiler in
the frontend server. The same incremental compiler is used for initial
application compilation, incremental code compilation for hot reload,
and any number of expression compilation requests.

In google3, the apps are typically too large to be compiled as a whole
in memory by the frontend server. Build in google3 is currently done by
blaze, as a distributed build using a task dependency graph. Build tasks
output kernel outline files as an interface between components produced
by individual tasks.

We are proposing an implementation of the expression compilation in
google3 that is taking advantage of full kernel files produced by the
build (supporting build changes to follow). This change introduces a
small server based on dev_compiler, which can handle following requests:

- update: load full kernel for given modules (done on app start)
- compileExpression: compile expression in a given library and module
  (done when paused on a breakpoint)

Expression compilation uses previously loaded kernel files for the
application component and its dependencies to compile an expression.


Change-Id: Icf73868069faf3a2eb6d43ba78e459f8457e9e35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160944
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2020-09-03 03:05:13 +00:00
Johnni Winther 082295a61e [cfe] Support lowering of static fields with initializers
This adds support lowering the encoding of top-level/static fields
with initializers as if they were marked as late fields. This ensures
that LateInitialization is thrown if final fields are written to during
initialization.

Closes #42956

Change-Id: I488fdddd87ebd935a0cdaf82a724e9b87d5f91ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160724
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-09-01 07:20:58 +00:00
Paul Berry 08dd4b1faa Null-safe numbers: implement static typing rules, hook up for binary operators.
Future CLs will hook up the static typing rules for method calls
(`clamp` and `remainder`) and will implement the rules for contexts.

Bug: https://github.com/dart-lang/sdk/issues/42629
Change-Id: Iccfb1fa1ac9aff6c0832d65e4835b5b9bd51a804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-08-24 15:34:33 +00:00
Devon Carew 4c97369a71 [package_deps] improve package deps validation
Change-Id: I8ad92243dece86cf6255eb463672c53066da31df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159601
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2020-08-21 19:22:20 +00:00
Devon Carew d26469f715 update the pubspec.yaml files to reflect actual package usage
Change-Id: I7a46c42dff3506cd5d09d3d793c072258e09a6e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159143
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-08-20 16:08:59 +00:00
Konstantin Shcheglov 39e4dfe571 Update experimental_features.yaml, set experimentalReleaseVersion for non-nullable.
Bug: https://github.com/dart-lang/sdk/issues/43032
Change-Id: I28b27b3416826abd807a185b2d4214782571fb98
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159383
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-08-20 01:38:48 +00:00
Nicholas Shahan c1d18d72f2 [ddc] Fix issues with sdk compile from dill
- Wait for the file writes to complete before exiting.
- Only accept the arguments that are actually used.
- Consistently read the arguments that are passed.

Change-Id: I913b8bd35135495cb5e94e4f88555997aea42e54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159181
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
2020-08-19 20:26:47 +00:00
Konstantin Shcheglov 2b7fc8f134 Update FeatureSet to the new rules.
Bug: https://github.com/dart-lang/sdk/issues/43032
Change-Id: I6c7d7dc56fd0d4edcc3c6f6cc6fb0422316b8f4c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159187
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-08-19 18:27:37 +00:00
Nicholas Shahan 8661e01552 [ddc] Use renamed library name in export
Fixes the case where libraries got renamed when created and
they are exported. Previously ddc was emitting broken code that
incorrectly used the original name in the export.

This bug was breaking some benchmarks at runtime.

Change-Id: Id8b27d645766db41fb5ccb5c74d8655dd4a5d4ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157000
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-08-05 01:32:06 +00:00