The CL is a step towards have a more restricted and wellstructured
handled of references and canonical names.
The CL moves Reference to canonical_name.dart and makes
CanonicalName.reference private, and replaces CanonicalName.getReference
with a 'reference' getter.
It also removes NamedNode.canonicalName, Field.getterCanonicalName and
Field.setterCanonicalName so that these can only be accessed through the
corresponding reference. This is to reduce the reliance on the
canonical names which, ideally, should only be part of serialization and
deserialization.
TEST=existing
Change-Id: I955fb7d52d4e112d8741f7c12dcf38b74ae0c91a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190442
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This removes the @fields and @=fields canonical name
encodings that allowed for encoding of conflicting members
and didn't support field<->getter/setter conversion
between dills or between outline and full dill.
TEST=existing tests+add aot expectation tests
Change-Id: I119b0c95f90e456356146cdc2d9241de4c1b4fff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186680
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
* Add InstanceGetterInvocation for getter/field invocation in web
backends
* Add localFunction getter to LocalFunctionInvocation
* Remove isNot from EqualsCall and EqualsNull - the encoding didn't
carry its weight.
* Remove uses of Name.name
* Remove BottomType code from VM
TEST=existing
Change-Id: I99d05d35b9ef193d092cc151c99ad472dbd60834
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188725
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
The CFE can invoke transformations despite having compile-time errors.
The async transform was crashing the compiler if it hits for-in
iterables that have an invalid type or never type.
In case of an invalid type, the program has a compile-time error and
won't be able to run propertly. So we'll replace the entire for-in with
an invalid expression statement if the iterable is an invalid
expression.
In case of a never type, the program should compile fine, which this CL
also fixes.
This makes the newly added tests no longer result in DartkCrash but
rather in a compile-time error (invalid expression) or runtime-error
(never type).
Closes https://github.com/dart-lang/sdk/issues/45014
Change-Id: Ic50f68400b67b57dd4a2c0a125b08f0f3e0d8dd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/188463
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This means that when useGrowableLists is false all empty TypeParameter
lists are the same (unmodifiable) empty list.
When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 30MB of memory.
Change-Id: Iee31016d238650de19db584a5617ca4a16889fe7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186940
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reduces heap in large link scenario by 850MB.
Change-Id: I9dd8c82868b4cc45e6389007348d8b6086c28ee1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186745
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
In https://dart-review.googlesource.com/c/sdk/+/185828 @vegorov explains
how using `const []` where there before was a non-const list can
introduce polymorphism.
This CL applies the same trick in kernel as suggested there, on the
instances of `const []` recently introduced.
Change-Id: I47033cd7487d56bfde1ed9088fef027466f26875
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186580
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
This reverts commit 3892e95547.
Reason for revert: Breaks Flutter web
Original change's description:
> [cfe] Encode field references as @getters and @setters
>
> This removes the @fields and @=fields canonical name
> encodings that allowed for encoding of conflicting members
> and didn't support field<->getter/setter conversion
> between dills or between outline and full dill.
>
> TEST=existing tests
>
> Change-Id: Id15e58ad4d1847d2c98a688705e5945196146c6d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184783
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>
Change-Id: I744e284b16e097fa0833c5bdf1bc7653f13bdf63
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/186147
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 140MB of memory.
Change-Id: I348f5c46ec430c5a486591897557bfef95d3b435
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185827
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
This is the first part of using the new encodings of MethodInvocation,
PropertyGet and PropertySet in dart2js. In this CL the new visitors
are implemented in static_type.dart. This change is done by refactoring
the existing implementation into helpers and new registration methods
that can be used by both the old and the new encoding but lends itself
to take advance of the new encoding. The new encoding is not enabled
until all of dart2js has been migrated to the new encoding. The
refactoring is intentionally not changing the outcome of the
static_type.dart to make it easier to detect accidental regressions
introduced by the migration.
Change-Id: I93d2033969c33d4c7a5957ad7a6c0b1cdf47fe6f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184220
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
This removes the @fields and @=fields canonical name
encodings that allowed for encoding of conflicting members
and didn't support field<->getter/setter conversion
between dills or between outline and full dill.
TEST=existing tests
Change-Id: Id15e58ad4d1847d2c98a688705e5945196146c6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184783
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Most lists created when loading a dill file are growable.
That's not always needed, though, and a non-growable list is more compact than
a growable one.
When running dart2js in its "linker scenario" on a large internal app
this saves something along the lines of 90MB of memory.
Change-Id: I113a73ed150efb56a5172ac7e1daf1d28f4bc188
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185825
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
Make Extension.name non-nullable
Make Class.name non-nullable
Make Extension.onType late non-nullable
Make LabeledStatement.body late non-nullable
Make SwitchCase.body late non-nullable
Change-Id: Iccf21fc800faa620c5d4b7bea68f74eec8bf62e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185083
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This CL completes the migration of the first wave of
interdependent libraries in package:kernel, including ast.dart.
In order to ensure non-nullability on AST properties, the Transformer
has been split in 2 variants: Transformer which doesn't support
removal of nodes and RemovingTransformer which supports removal where
allowed by the context using 'removal sentinels'.
Start reviewing Transformer and RemovingTransformer in visitors.dart
since many of the changes are caused by the changes here.
Included in the migration are the mixin_deduplication.dart and
unreachable_code_elimination.dart since these needed porting to
the RemovingTransformer which was aided by opting in the libraries
which only depended on ast.dart.
TEST=existing
Change-Id: I9e63b985bd24896c25edd4ee51e37770187bcc17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184786
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
The front end previously enforced a stricter-than-spec requirement on
conflicting imports on its own code. The check was included of the
kernel snapshot and therefore always enforced, even in published sdks.
The extra check was removed a month ago and now tools/sdks/ have been
updated to use a later version of the sdk, so the unneeded hide
combinators can now be removed from the source code.
Closes#44667
TEST=existing
Change-Id: I1d1053b1ef9a40b6a918eef515a02d7b404906c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185084
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
The MergeVisitor was trying to merge FunctionType.typedefType in order
to merge function types, thus preventing nnbd top merge of two
compatible types that were just introduced through different typedefs
or function type syntax.
Change-Id: Icea75598168c86ed33314db22ebeec3e666c3675
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184785
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
+ restrict replaceWith and replaceChild to only support replacement and
not removal.
TEST=existing
Change-Id: I5381b4907725dd0ea7cf544e133bdb296df48ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184469
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.
TEST=Refactoring
Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
In preparation for null safety migration, List.filled is replaced
with List.generate in ast_from_binary.dart where the element can be
created by a simple function expression.
Change-Id: I17bc68edebb8dc7d8918d87e9cdc38a9a8711682
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179761
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This reverts commit ce81216885.
Reason for revert: Flutter dependency
Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>
TBR=jensj@google.com,johnniwinther@google.com
Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.
TEST=Refactoring
Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Serializing Let.fileOffset supports positions in stacktraces resulting
from null aware expressions, like `if (o?.foo) ...` when `o` is `null`.
Adding Function.futureValueType supports the proper backend
implementation for the fix in
https://dart-review.googlesource.com/c/sdk/+/181303Closes#44654
TEST=existing
Change-Id: Ie5939a248d3d8bf41388e8f435e4ba4195afeabd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182269
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Members declared in mixins are treated as if these were declared in
the class where they are mixed in. This means that use their types as
declared types, instead of including them in a combined member signature.
This failed in the case where a member was synthetically added to the
mixin class, because the types of these we wrongfully be handled as
declared types.
We now skip all synthetic members when reasoning about mixed in members
as declared members.
Change-Id: I9c2311b4472fe16162fcdc4c56fce8db2d946f4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181201
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>