Commit graph

62 commits

Author SHA1 Message Date
Chloe Stefantsova c747272f1f [cfe] Report mismatching joint variables on the first use
Closes https://github.com/dart-lang/sdk/issues/51929

Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ib20bdb5eb9b0b5c1e8b34cfbac6498e642350875
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292782
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-04-04 11:56:48 +00:00
Johnni Winther e54fdb19a1 [cfe] Use library features for allow patterns in the parser
The parser used the global features and not the library features to
determine whether pattern syntax should be expected.

Closes #51625
Closes #51626

Change-Id: I3adc05468c0f9d2c5b919dc7fa12a5de4dcbbc7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288504
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-14 11:37:28 +00:00
Johnni Winther f17cf33c6d [kernel] Move Pattern nodes to package:kernel
These AST nodes were so far internal to the CFE, but since we need to
move the pattern lowering to the constant evaluator we need to support them in the AST defined in package:kernel.

TEST=existing

Change-Id: Ie6c5f0f8ad75a866c5d965fdf506bc869ffaf654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288241
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2023-03-13 08:43:07 +00:00
Johnni Winther e1a2b10a81 [cfe] Add PatternVisitor
This adds a pattern visitor and moves the matching expression into
a visitor. Also, the InferenceVisitorImpl implements the pattern
visitor and uses it for visiting patterns.

This is preparation for move the Pattern nodes to the
external AST and move pattern lowering to the constant evaluation.

Change-Id: I9a05f4c61032cfe3d823d4558922822b501c1ac1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282105
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-02-10 10:32:15 +00:00
Johnni Winther 68c326f455 [cfe] Refactor pattern matching generation
This enables caching during matching.

Closes https://github.com/dart-lang/sdk/issues/50934
Closes https://github.com/dart-lang/sdk/issues/50987

Change-Id: Iae1d8e0989029a193ba77f58338890d9bfa0c09f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279384
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-01-25 08:33:38 +00:00
Johnni Winther 376886ed1d [cfe] Add caseOffsets to internal SwitchCase node
This prepares for reporting exhaustiveness errors on pattern cases.

Change-Id: I01cdf3f8226a68e4549aed4a85560742bc0804dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279161
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-01-18 09:26:58 +00:00
Chloe Stefantsova 4a8c6fa480 [cfe] Support guards and multiple heads in pattern switch statements
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I6c0dcd4bd2cb7921c27168b71f61f1793c8b2a12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278182
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-01-05 11:36:28 +00:00
Chloe Stefantsova 9383820f15 [cfe] Desugar pattern variable assignments
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ibae19d0e64f023aea047b007d73f3cee9910d259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277683
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-12-30 15:44:37 +00:00
Johnni Winther e6d59342ff [cfe] Build PatternVariableDeclaration in BodyBuilder
Change-Id: Ic55dbc03bf2cf4865275b186266c0f420263d406
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273744
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-13 17:03:13 +00:00
Johnni Winther be7779ae7f [cfe] Handle switch expression in BodyBuilder
Change-Id: Idf987e8bb59a11d1628fc866d677267f439ed5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272300
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-30 16:21:28 +00:00
Johnni Winther f85185aaa0 [cfe] Handle patterns in switch cases in BodyBuilder
Change-Id: Ib52a0cd077e1cd056cd5150b8b1fddf867aef3ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271706
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-25 12:33:40 +00:00
Chloe Stefantsova 8b12c0c6fb [cfe] Desugar BinaryPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I98dd7d63c560eb4c48350c32826e51df1491d9d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271708
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 17:45:05 +00:00
Chloe Stefantsova 85a841e881 [cfe] Combine Matchers and Binders into Patterns
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I1400d854d722e8280b9d0d66c9e1630829542aa5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266682
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-10-31 16:18:23 +00:00
Johnni Winther 646921914b [cfe] Add MapMatcher
+ include textual representation of internal nodes in ast-to-text
to verify the encoding.

Change-Id: I3b4fd1327539fd6d2e5176daee2a8fb79dc3c6e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266201
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-10-28 12:02:27 +00:00
Johnni Winther 142bf69440 [cfe] Pass on guard in if-case statement
Change-Id: Ic7c201bd90b2cf67a2b7526fc4ac035b21f34cc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265720
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-10-26 10:19:58 +00:00
Johnni Winther 8995807b2b [cfe] Create various matcher in the body builder
This add the Expression-, Binary-, Cast-, NullAssert-, NullCheck-, List-
and RelationalMatcher and creates these during body building. The
IfCaseStatement is added to support propagation of these to the
inference visitor.

Change-Id: Ia9add15e504cb06af711efc1697a00b8e235e1a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263128
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-10-21 14:01:02 +00:00
Lasse R.H. Nielsen 8a883fa54d Change : to = for default values in pkg.
Leaves some in parser test:
 pkg/front_end/parser_testcases/error_recovery/keyword_named_formal_parameter_prime.dart

TEST=Refactoring, covered by existing tests.

Change-Id: I7a83ef95df3cbd283878b3685b5c747bd89a1b16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256125
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-08-24 15:57:16 +00:00
Johnni Winther 40ad7aee40 [cfe] Use [BlockExpression] to encode named function expressions
Previously a named function expression (function declaration occurring
in an expression context) was encoded using a
[NamedFunctionExpressionJudgment] which was a specialization of a [Let]
expression. This encoding couldn't handle recursive calls occurring in
the body of the named function expression, since the let variable
is not available in the initializer of the let variable, leading to
a crash in serialization.

This CL changes the encoding to use a [BlockExpression] instead and
deletes the [NamedFunctionExpressionJudgment] node.

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

Change-Id: I40c5535624b2d8933a6f400c927ba42b028f7a29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/246445
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-05-31 11:47:33 +00:00
Johnni Winther d802a46c5c [cfe] Remove use of TypeUse.functionSignature
- and remove VariableDeclarationImpl.functionNestingLevel.

Change-Id: Iee7c619794bc34f1009ec17d03ec34680dba1283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245363
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-05-20 09:17:20 +00:00
Johnni Winther 5222bfd90c [cfe] Refactor bounds checking
This CL moves the bounds checking into the TypeBuilder instead of
performing it from the outside on the computed DartType node.
This solves several problems:

  1) Errors are now reported on the type in the code instead of the
     declaration which holds the type.
  2) Checking of type aliases (both function and nonfunction type
     aliases) is now handled correctly in all cases. This achieved by
     computed the aliased type (containing TypedefType nodes)
     internally and performing the checking on this type, and only
     convert the type into the unaliased version (without TypedefType
     nodes) after checks have been performed. Previously this handled
     through the FunctionType.typedefType property for function type
     aliases and through and incomplete work-around for nonfunction
     type aliases.
  3) With 2) FunctionType.typedefType is no longer needed and is
     removed.

TEST=general/bounds_*

Change-Id: I7653bca5ccb0ebf4b3553828a298d1ad918ef235
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243722
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2022-05-17 14:36:19 +00:00
Jens Johansen 430abc54e8 [CFE] Add toText to Reference and CanonicalName
Add `toText` to both Reference and CanonicalName.
Change how CanonicalNames are printed through `text_util.dart` to be
more aligned with how the corresponding node would be printed had
it existed (and the CanonicalName thus normally not been used for
printing).
Add a test for (some definition of) common cases where printing should
be the same wherther done though the node, the reference or the
canonical name.
Fix usage of toStringInternal in the constant evaluator (though only
in use through an experiment) and add a test that showed that the
previous output was bad and the new isn't (at least in this case).

Change-Id: I10cbc1a542c7d8b079e0510bbd5eb5173b2e7563
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/242102
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-04-25 11:13:44 +00:00
Johnni Winther b297e41ea7 [cfe] Change nullability handling in legacy libraries
This changes two parts about handling of nullability in libraries:
1) Instead of using Nullability.nullable for explicit nullability in
   legacy libraries, which is an error case, we use Nullability.legacy
   so that legacy libraries only contain legacy nullabilities.
2) Avoid performing legacy erasure on parameter types. This change
   explicit `Never` from "Null" to the correct "Never*".

Change-Id: Iba2fa8244c8820375056d106f30d6de8054f2681
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240921
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-04-19 11:22:27 +00:00
Johnni Winther f8b306cf27 [cfe] Don't check bounds on uninferred invocations
Invocations that haven't been inferred are now not checked wrt. bounds.
These can occur in erroneous code or in outline expressions that are
currently created both in the outline phase (where they are fully
inferred) and in the body building phase where they are not inferred.

Additionally, an assertion is added to verify that these invocations
are no longer part of the AST, and therefore safe to leave incomplete.

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

Change-Id: I6d83c2db05d43b016e21abf915cbe5a312b20c79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228560
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-01-18 09:15:56 +00:00
Johnni Winther 3e2f98d652 [cfe] Add support for custom data in id testing
This allows for using data created in the TestConfig in the computation
of test results.

Change-Id: Ia4820d0b739b01272f10d2c2561fcf77ae007031
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/225731
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-12-31 15:12:32 +00:00
Johnni Winther 450ff2976d [cfe] Migrate (more) CFE tests (part 11)
Change-Id: I905adcd2125ce66d6ba9923d996354657b679cec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/220965
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-11-24 11:15:41 +00:00
Jens Johansen 1197e15a7e [CFE] Enable avoid_void_async lint
This CL enables the avoid_void_async lint in the CFE, makes the needed
changes and adds the missing `await` (because the lint
`unawaited_futures` doesn't react to void async methods).

Change-Id: Iffc1f173badd3c2d48356ee02e81a9aed492ce5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213481
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-09-23 11:58:18 +00:00
Johnni Winther a6cc772b67 [cfe] Add always_declare_return_types lint
Change-Id: I206a7a8132b5ea79dc019acf5c2e0cd800307bcf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212161
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-02 08:07:23 +00:00
Johnni Winther 3eac19026b [cfe] Add annotate_overrides lint
Change-Id: I90a6d5c7d64ed23acd94b9a8dda58d53da4fe8df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212041
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-01 16:24:16 +00:00
Johnni Winther 114ccb2c5c [cfe] Handle redirecting factory invocation in cloned expressions
Change-Id: I82f2c60da94017dae8dc5e258402d9ee64c9cdf8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211441
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 16:09:08 +00:00
Johnni Winther e7638e8e96 [cfe] Use wrapInProblem instead of buildProblem in inference
Change-Id: I51fe495d162e26ac7cd97629272170c85cafea36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208642
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-04 10:07:24 +00:00
Johnni Winther 33c758690a [cfe] Rename InternalMethodInvocation to MethodInvocation
+ (Internal)PropertyGet and (Internal)PropertySet

Change-Id: Ib5086f5fa308a2cbdeea05ee5fe42c2c66df0007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208188
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-28 19:13:14 +00:00
Johnni Winther cb3a9b0043 [cfe] Remove old method invocation encoding nodes
TEST=existing

Change-Id: I05ee649ecfa7945e2e0f5e5d09441d8916a9c46e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208185
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-07-28 15:44:04 +00:00
Johnni Winther 16ebd4fe57 [cfe] Add InternalMethodInvocation, InternalPropertyGet and InternalPropertySet
- to replace internal use of the old method invocation encoding.

Change-Id: I7ca876d28beec265f1a143ce5f29deb9e61616d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208184
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-07-28 10:13:34 +00:00
Johnni Winther 49e2148dea [cfe] Migrate wave 10 aka the big one
Change-Id: I77a1996fe3ebd3605efc5afc6ff3308f6ebc3cac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205580
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-07-07 15:18:02 +00:00
Johnni Winther e817b2d05a [cfe] Migrate kernel/collections.dart
Change-Id: I2cfb17e8afd75e966688d8c3a142378efdf29025
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201265
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-05-26 10:28:52 +00:00
Sam Rawlins 245705e23c Remove unnecessary imports in pkg/front_end
In each library where an import is removed, the library uses some elements
provided by the import, BUT there is another import which provides all of the
same elements, and at least one more which the library uses.

In this change, we remove the imports which can be simply removed in favor of
the other already present imports.

See https://github.com/dart-lang/sdk/issues/44569 for more information.

Change-Id: Iea21ddba3f26637a244437911730253e4c6f22dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199460
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-05-13 23:47:28 +00:00
Paul Berry 73db2ff205 Replace CFE and analyzer legacy type promotion with a shared implementation.
This allows us to remove a substantial amount of CFE and analyzer
code.

It also fixes a minor CFE type promotion bug
(language_2/type_promotion/assignment_defeats_promotion_lhs_and_test).

TEST=standard trybots
Change-Id: Ia0c159bdb9161d73648c9eb73b92822168f28d84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175583
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-04-21 14:21:30 +00:00
Johnni Winther 3e44898e08 [kernel] Make FileUriNode.fileUri non-nullable
TEST=existing

Change-Id: I72583e500cb0b69d9352b040c3e2885f9e0450c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/195681
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-04-19 08:03:30 +00:00
Dmitry Stefantsov c191551fac [cfe] Remove BottomType
TEST=Covered by existing tests.

Change-Id: Ied8be1874164e68e0a3a48e1b2f9a33310071381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183009
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-24 13:21:55 +00:00
Johnni Winther 8467186ca0 [kernel] Initial migration of package kernel wave 1
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>
2021-02-18 16:01:17 +00:00
asiva 34f9734b41 Revert "[cfe] Handle conditional await in CFE"
This reverts commit 14032a6209.

Reason for revert : Several customer flutter tests are failing because
of the change in behavior.

TEST=revert of previous CL.

Change-Id: Ia235aa93b9c81fbab066803dc0625856f93acceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-02-01 23:41:01 +00:00
Johnni Winther 14032a6209 [cfe] Handle conditional await in CFE
This converts `return e` in async methods in opt-in libraries into

   return let v = e in v is Future<FTV> ? await v ; v

where FTV is the future value type of the enclosing function.

Closes #44395
Closes #44396
Closes #44397
Closes #44399

TEST=existing tests

Change-Id: I59687039bfe4a97ffdaa55ac0f193ca4fb208f44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175310
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2021-01-22 19:12:24 +00:00
Johnni Winther 34fb48bb8a [kernel,front_end] Migrate first wave of pkg/kernel and pkg/front_end
Migrates libraries dependent only on already migrated libraries.

Change-Id: I0e85ee8dbc2afce031b92e0009e71c206a55af28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179502
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-01-18 15:40:21 +00:00
Johnni Winther 706632d994 [cfe] Use isPureExpression to ensure temp variables are not created for this expressions
Closes #44475

Change-Id: Ie5a767448e27d2f84b90ebd0ebe2287d897fcd6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176441
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-12-17 17:57:43 +00:00
Johnni Winther 5dbb6e245b [kernel,cfe,ddc] Add new method invocation node to package:kernel
This adds
* InstanceInvocation, DynamicInvocation, FunctionInvocation, and
   LocalFunctionInvocation, EqualsCall, and EqualsNull as a future
   replacement for MethodInvocation.
* InstanceGet, DynamicGet, InstanceTearOff, and FunctionTearOff as a
   future replacement for PropertyGet
* InstanceSet and DynamicSet as a future replacement of PropertySet
* StaticTearOff as an addition to StaticGet

TEST=pkg/front_end/test/binary_md_vm_tags_and_version_test.dart

This CL combines
* https://dart-review.googlesource.com/c/sdk/+/171729
* https://dart-review.googlesource.com/c/sdk/+/172649
* https://dart-review.googlesource.com/c/sdk/+/172650
* https://dart-review.googlesource.com/c/sdk/+/172651

using the initial encoding fo EqualsCall and EqualsNull

Change-Id: I98e020b5f2b405a812663bdcd2c05aba8efa74c8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175480
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-12-14 10:55:48 +00:00
Johnni Winther 90ec6f2531 [cfe] Ensure that shorting is stopped before expression usage
The creation of the shorting stop expression was done lazily
in NullAwareExpressionInferenceResult.expression. Since the shorting
calls flow analysis to stop null promotion doing this out of order
let to inconsistent flow analysis state.

This CL introduces an `inferNullAwareExpression` the allows to
caller to continue the shorting (if in an opt-in library). The
inferExpression method, used everywhere else, stops any shorting
currently in progress.

Closes #43275

Change-Id: I448163e29bdb0de8e493e5c62aa0474d0c9a593f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/173729
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-11-25 11:28:13 +00:00
Dmitry Stefantsov d54e2bb568 [cfe,ddc,dart2js,vm] Add NullType
This CL is the sum of the following 5 CLs:
* https://dart-review.googlesource.com/c/sdk/+/170342/
* https://dart-review.googlesource.com/c/sdk/+/170344/
* https://dart-review.googlesource.com/c/sdk/+/170345/
* https://dart-review.googlesource.com/c/sdk/+/170346/
* https://dart-review.googlesource.com/c/sdk/+/170347/

The reason for landing the 5 CLs as one CL is to prevent potential
troubles with bisecting over the branch because the change is fully
functional only with all 5 CLs.

Closes #40122.

TEST=Verified by changes in .expect files in pkg/vm/.
Bug: https://github.com/dart-lang/sdk/issues/40122
Change-Id: Ib8197802fdc69694387ae47ac990c58b3aaab7a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170689
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-06 12:43:52 +00:00
Jens Johansen ae5fc78992 [kernel] Remove 'addMember'
Most of the time one already knows at the call site if it's a Field,
a Procedure etc --- so use that instead.

For now I'll leave the corresponding getters that are basically
documented as "don't use" ("[...] for convenience, not efficiency.
Consider manually iterating the members [...]").

Change-Id: Ib732759432c62963e6645f85f6df301c4281df9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168826
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-27 11:36:58 +00:00
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
Johnni Winther 1c0c0a1e86 [cfe] Resolve "Never" as "Null" in opt-out libraries
Closes #43499

Change-Id: I5d0ba97a626248019d7aab4e7a5a68d0a566a87a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166440
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-10-08 15:08:05 +00:00