Commit graph

10877 commits

Author SHA1 Message Date
Paul Berry 130d6199c3 Field promotion: make the core promotability algorithm sharable; fix bugs
In the following code, it's not safe for the field `C._f` to undergo
type promotion, because a variable with static type `C` might have
type `D` at runtime, in which case `C._f` will get dispatched to
`noSuchMethod`, which is not guaranteed to return a stable result.

    class C {
      final int? _f;
    }
    class D implements C {
      noSuchMethod(_) => ...;
    }
    foo(C c) {
      if (c._f != null) {
        print(c._f + 1); // UNSAFE!
      }
    }

Therefore, in order to determine which fields are promotable, the
implementations need to analyze enough of the class hierarchy to
figure out which field accesses might get dispatched to
`noSuchMethod`.

Currently, the CFE does this by following its usual algorithm for
generating `noSuchMethod` forwarders before trying to determine which
fields are promotable. The analyzer, on the other hand, doesn't have
an algorithm for generating `noSuchMethod` forwarders (since it
doesn't implement execution semantics); so instead it has its own
logic to figure out when a `noSuchMethod` forwarder is needed for a
field, and disable promotion for that field.

But there's a chicken-and-egg problem in the CFE: the CFE needs to
determine which fields are promotable before doing top-level inference
(since the initializers of top-level fields might make use of field
promotion, affecting their inferred types--see #50522). But it doesn't
decide where `noSuchMethod` forwarders are needed until after
top-level inference (because the same phase that generates
`noSuchMethod` forwarders also generates forwarders that do runtime
covariant type-checking, and so it has to run after all top level
types have been inferred).

To fix the chicken-and-egg problem, I plan to rework the CFE so that
it uses the same algorithm as the analyzer to determine which fields
are promotable. This CL makes a first step towards that goal, by
reworking the analyzer's field promotability algorithm into a form
where it can be shared with the CFE, and moving it to
`package:_fe_analyzer_shared`.  Since this required a fairly
substantial rewrite, I went ahead and fixed #52938 in the process.

Fixes #52938.

Change-Id: I9e68f51b3ea9a967f55f15bdc445cc1c0efdabdd
Bug: https://github.com/dart-lang/sdk/issues/52938
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313293
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-07-18 18:54:26 +00:00
Konstantin Shcheglov 6b4337ab69 Inheritance inference for methods in augmentations, and using combined interfaces for classes and mixins.
Change-Id: I27af575219ab1e3bfba3f894ebc83e0806f7f968
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-18 18:51:27 +00:00
Konstantin Shcheglov f06a1d58d8 Inference of mixin type arguments in augmentations.
Change-Id: I3f3cb93a3df23fca6e2c764e387f910290bb9eda
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314301
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-18 15:30:47 +00:00
Konstantin Shcheglov 87c49d9848 Use 'augmented' for ClassHierarchy.
Change-Id: Id4b9fb27990dd02f4c1d94faf11c6e25f056a5a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313221
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-17 21:12:49 +00:00
Jake Macdonald c5bd32bac2 Major refactor to simplify the macro introspection interfaces.
Each phase now only has a single interface, instead of several of them. This
reduces the number of classes dramatically and also reduces the number of
objects actually sent over the wire.

It also means fewer things to name and a less polluted namespace.

Change-Id: Ib84b76ac4c0a04abfac5fd5650a228046b1bf1d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313721
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-07-17 17:28:35 +00:00
Konstantin Shcheglov 57ac271bf1 Verify that 'utf8.encode()' is not used in the analyzer.
To be removed after Dart SDK 3.1 is published, and the analyzer
SDK constraints updated.

See
https://dart-review.googlesource.com/c/sdk/+/254903

Change-Id: I2c3321d991cd3e123f08c5a360487362be16f258
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313920
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-17 17:28:31 +00:00
Konstantin Shcheglov ed776ebbc6 Simplify class and element hierarchy around augmentations.
Change-Id: If03fdad6891581a75cedaab8171c4626c9211ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314001
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-17 16:56:41 +00:00
Danny Tuppeny ea790e901c [analysis_server]/[analyzer] Change package_path alias -> path
Change-Id: Ia4848e6b87433401be95a4e74c7681a1c983c12f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313568
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-07-17 16:48:36 +00:00
Konstantin Shcheglov d1a75901c4 Link augmented methods and augmentations, fill 'augmented.methods'
Change-Id: Ic7e979c46fc646e436bafa18b5c5b01622ab209b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313544
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-14 18:32:10 +00:00
Danny Tuppeny 77799f6d6c [analysis_server] Use current path context for path<->uri conversions
This allows changing the in-process tests to use Windows-style paths on macOS for convenience.

Change-Id: I0e85a4f8e831471925b8308ad348f75b6867a53b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313385
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-14 17:30:30 +00:00
Jake Macdonald 4f8061da63 Add MetadataAnnotation class and metadata fields to relevant objects
Bug: https://github.com/dart-lang/language/issues/1930
Change-Id: I3ba6facd4c0487b0af18108c8d1db21ee6d5a498
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313640
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-07-14 15:55:20 +00:00
Konstantin Shcheglov 1cf1cf3215 Issue 52918. Report -TYPE_PARAMETER_REFERENCED_BY_STATIC for extension.
Bug: https://github.com/dart-lang/sdk/issues/52918
Change-Id: I2c21239c34bf852a1770296491f30d81dd5eb66c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313520
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-13 17:53:38 +00:00
Konstantin Shcheglov b4cdba66e2 Remove support for getters that are instances of macros.
https://github.com/dart-lang/language/issues/1890#issuecomment-1625587927
https://github.com/dart-lang/language/pull/3205

Change-Id: I20a181a01eab4fef9a8bf6e568745eb2b8e86d6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312881
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-13 17:32:49 +00:00
Sam Rawlins dea256c9fc Mark private classes which are annotated with @JS as used
Work towards https://github.com/dart-lang/sdk/issues/52835

Change-Id: I300928dbfcfd819e4a9f20030cb46e2048f504e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313287
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-13 16:06:12 +00:00
Konstantin Shcheglov 150587d2b5 Merge MethodElement(s) into augmented.
Change-Id: I4965554d33f4345053c2b5abc05ba463a362b641
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313301
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-13 05:11:57 +00:00
Samuel Rawlins e718a97882 Revert "Tweaks for mixin inference."
This reverts commit fb9d0e6dc3.

Reason for revert: Performance regression https://github.com/dart-lang/sdk/issues/52922

Original change's description:
> Tweaks for mixin inference.
>
> I started initially with the idea to move 'mixinInferenceCallback'
> to `ClassElementImpl`, but then realized that we do it for enums too.
> So, it should stay in `InterfaceElementImpl`.
>
> I left with code that I think slightly modernized, so decided to
> send it for review.
>
> Change-Id: Ib990392dc4985a71ffba1f4080237872d9a65ad2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312521
> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>

Change-Id: I33098d8509319e9d6e62d7f5174cae2c05977436
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313440
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-12 22:20:27 +00:00
Konstantin Shcheglov c54b4bc5d3 Push class modifiers up to ClassOrAugmentationElement.
Change-Id: If99d9e29ec8ca87677a58cd90a68a5dda5c5af9c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313183
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 18:45:20 +00:00
Konstantin Shcheglov 3e80d29fd6 Use AugmentationExecutableElement, AugmentationMethodElement.
These become a single property of ExecutableElement, MethodElement.
No new visitors, no new nodes and elements.

Change-Id: Ic523e9d51356e5a8d2a6cd62cd508344f561ffb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312960
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 16:19:09 +00:00
Martin Kustermann 81df36216f Make utf8.encode() have Uint8List return type
Right now `utf8.encode()` has a static return type of `List<int>`
due to extending `Encoding` (which extends `Codec<String, List<int>>`).

We cannot easily change `Encoding` to extend `Codec<String, Uint8List>`
because that would also change `utf8.decode()` to require `Uint8List`
which would be a breaking change.

So instead we override `utf8.encode()` to have more precise return type.

Some parts of our SDK are run using the checked-in SDK, so it cannot
rely on the changed return type yet (until checked-in SDK is rolled).

So we use `const Utf8Encoder().convert()` as a temporary change, as
that already has `Uint8List` return type.

Issue https://github.com/dart-lang/sdk/issues/52801

TEST=ci

CoreLibraryReviewExempt: More precise return type for existing API
Change-Id: I2861d1f0eb3d292d8e3ec8437c0d441a2d2bd193
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/254903
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-07-11 08:54:33 +00:00
Konstantin Shcheglov 2c97bd7801 Remove duplicate getters from ClassDeclaration and MixinDeclaration.
Change-Id: I69440dd7b1911db6616dc500d82b7b9c3e996529
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313083
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-11 05:47:30 +00:00
Konstantin Shcheglov 7a258fa43b Add NotAugmentedXyzElementImpl implements AugmentedXyzElement.
So, that we don't have to copy all class members for 99% cases when
there are no augmentaitons.

Change-Id: I5c225905a0460ce5162543553e207a2d4412ecb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313082
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-11 02:22:35 +00:00
Konstantin Shcheglov 3bb4d7d0d4 Parse mixin augmentations, build element model.
Change-Id: Ie1bdb6d47b31c527546f62abf65d19a4a4e50ee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312924
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-10 20:48:32 +00:00
Jake Macdonald 1a13ea6c05 Add a disposeMacro api, with TODOs in the implementations to call it.
Change-Id: I38049ca8b851c2203ddaaa729ef651e7802a1d2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312860
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-10 12:01:49 +00:00
Konstantin Shcheglov 4d4eefa956 Compute 'mixins' and 'interfaces' for ClassElement.augmented
Change-Id: I7514576ada4a5dcd048a2c399d5bfe11169f3394
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312887
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 21:39:41 +00:00
Konstantin Shcheglov 884116a83b Move 'constructors' getter into NamedInstanceOrAugmentationElementMixin.
Remove extra looping detection.

Change-Id: Ifdd7f4729930b3022a8b04f8143d714298acf8dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312884
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-07 20:34:39 +00:00
Konstantin Shcheglov aad361b31e Link augmentations and targets during building.
We walk augmentations in the right order, so can update update
necessary data structures as we go.

Change-Id: Ibf3409658009b82a960caaacd538fcd6c779b007
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312883
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 19:14:25 +00:00
Konstantin Shcheglov 553c804eb5 Don't use LinkedData type parameter.
Change-Id: I2afa126856f05072cb5e796b4f47d64e61284b96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312882
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 18:29:37 +00:00
Konstantin Shcheglov ac0fc3c11c Print augmentation libraries after the defining unit.
So, we can read it more naturally, first the declaration, then its
augmentations.

Change-Id: I21805969bff6874660500d4477b39ce5aba7484a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312880
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-07 17:08:54 +00:00
pq b05282a1e9 @useResult support for pattern variable declarations
Fixes: https://github.com/dart-lang/sdk/issues/52841

Change-Id: I0ce4e8bc7771808fcaacfbfc2b591ab805c74ff4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312711
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2023-07-07 15:56:28 +00:00
Konstantin Shcheglov fc0e656868 Build ClassAugmentationElementImpl, basic linking.
Change-Id: I18bd3d97ad9fe661d14e3d3d006219ffceedcfc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312349
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-07 14:55:38 +00:00
Kallen Tu a2cdf8e96d [analyzer] Refactor const evaluator visitBinaryExpression and tests.
Made more of the tests consistent in `evaluation_test` (slowly, but surely).

Change-Id: I515c4d6d81cedcc1d8d20080e231ac1e0afb5ec7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312200
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-07-06 21:48:07 +00:00
Konstantin Shcheglov ec893a4d8f Rework ElementImpl and AugmentationElementImpl hierarchies to use XyzOrAugmentationElementMixin(s).
Add ClassAugmentationElementImpl, no any tests yet because it
required parsing, AST, etc. And it is also not ready yet.

Change-Id: I601141545e9bf0638771f28bb9498be9de664659
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312345
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 20:03:47 +00:00
Konstantin Shcheglov c4cbc7042f Add ClassAugmentationDeclarationImpl, parse into it.
Change-Id: I2461cffa76f31079e52f9877b9fe35668811191b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312346
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 20:03:37 +00:00
Danny Tuppeny 1c4ad79985 [analyzer] Include trailing commas in display strings for single-positional-field records
See https://github.com/Dart-Code/Dart-Code/issues/4624

Change-Id: Iac2f061c11ffdb95917329465307abc8e92b6ba3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312421
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 18:56:36 +00:00
Konstantin Shcheglov fb9d0e6dc3 Tweaks for mixin inference.
I started initially with the idea to move 'mixinInferenceCallback'
to `ClassElementImpl`, but then realized that we do it for enums too.
So, it should stay in `InterfaceElementImpl`.

I left with code that I think slightly modernized, so decided to
send it for review.

Change-Id: Ib990392dc4985a71ffba1f4080237872d9a65ad2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312521
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-07-05 18:04:37 +00:00
Konstantin Shcheglov 2b36ef12e6 Remove a few ramaining references to TypeName, use NamedType.
Change-Id: I61b6499dd369c24726084d68f1f4abf374209986
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312520
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 17:48:09 +00:00
Kallen Tu 1da821f670 [analyzer] Refactor visitRecordLiteral and visitSetOrMapLiteral in the constant evaluator.
Change-Id: Iabab7f406a5f688c5070a26af12cabc3323ef765
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310970
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 17:43:55 +00:00
Konstantin Shcheglov 4f62032cf9 Fix a few TODOs in DartObjectPrinter, ElementPrinter.
Change-Id: I76aedfffad60095bdca5c09644c983439868f9bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312343
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-07-05 17:37:08 +00:00
Konstantin Shcheglov 2b8b3345aa Use XyzElementImpl in 'declaredElement' in AST impls.
Change-Id: Id1e59db0e706859e9e04132b3058e8885f8cb669
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312344
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-05 15:11:40 +00:00
Sam Rawlins e67a2193da Add jsonEncode for use in unreachable_from_main
Bug: https://github.com/dart-lang/linter/issues/4495
Change-Id: I74b0a6cb516d2850bb922005e463f58f58453b4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312280
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-07-04 03:02:47 +00:00
Konstantin Shcheglov 37003ee3be Add InterfaceElementImpl, move many methods into it.
Change-Id: I7f77e318586b2c05874b3a0d25d2d940869b6a0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312240
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 01:41:38 +00:00
Konstantin Shcheglov d4de535a3a Use identical() instead of == for elements in RuntimeTypeEqualityVisitor.
See https://github.com/dart-lang/mockito/issues/658#issuecomment-1615269018

Change-Id: I5b9e4b1d82ec935bcd2097ec76cf5a8e28c5e29e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312205
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 01:33:12 +00:00
Konstantin Shcheglov 44a94e8400 Remove 'Clients may not extend...', because all these classes are final.
Change-Id: If20d22b0407a67f630aa87debada6dab1d803c71
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/312201
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-07-04 00:17:10 +00:00
Kallen Tu c86af3c39b [analyzer] Refactor visitMethodInvocation in the const evaluator.
Change-Id: I9ae6c17967c98770ed06dead200c8bd87ae7f2a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/309829
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-30 18:32:27 +00:00
Konstantin Shcheglov 8828fee865 Deprecate ExecutableElement.returnType, use returnType2 instead.
Change-Id: Ibd29c3fbec0439236c2cf45c57f820c45427df9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311932
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-06-29 23:16:59 +00:00
Jake Macdonald 34f25c4a28 Add library introspection apis for macros.
Allows you to ask for the types in a library in the declarations phase, and all
the top level declarations in the definitions phase.

Bug: https://github.com/dart-lang/language/issues/2839
Change-Id: If0f8fb777fd8a006d686d457cf5d5ca11fcca9ee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311900
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-06-29 22:05:58 +00:00
Kallen Tu 74adf1626e [analyzer] Refactor visitNamedType and other visitors in const evaluator.
Change-Id: Ia3c22fc87c96d719cfa3617c72f5586badfec183
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310972
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-06-29 21:26:14 +00:00
Konstantin Shcheglov fae9e418ea Deprecate Element.enclosingElement, use enclosingElement2 instead.
Change-Id: I78edb6d433949eb8bd86f397fb873a078edf9fc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311827
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-29 19:45:19 +00:00
Konstantin Shcheglov 8a037770f9 Tweaks for element model documentation comments.
As requested in https://dart-review.googlesource.com/c/sdk/+/311725

Change-Id: I76cd2322f9cca9845f3ec767adfd1e5dca9d7c47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311826
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 20:28:30 +00:00
Konstantin Shcheglov 6f01da06a2 Put aside invalid mixin constructors, quick fix for MIXIN_DECLARES_CONSTRUCTOR.
Change-Id: If1b808bf7746b4f2c2c856d7fb7e72499023759f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/311823
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-06-28 19:49:08 +00:00