Files
sdk/tests/language/macros/augment
Konstantin Shcheglov 36c0788137 add package:_macros (SDK vendored) and package:macros (pub published)
add sdk_packages.yaml file (describes SDK vendored package locations)

delete old macro code in _fe_analyzer_shared, move tests/benchmarks

adds a top level `pkg` directory to the Dart SDK, which is where vendored packages live

BUG: https://github.com/dart-lang/sdk/issues/54976
Change-Id: Ib3503a27fb5644fa8a39ab5a3e5b568df330cfd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359040
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
2024-03-26 18:40:00 +00:00
..

Macro "Augment" Tests

These tests (will) cover the "write" half of the macro API, the augmentation of code of every supported type in every supported place.

See: package:_fe_analyzer_shared/lib/src/macros/api/macros.dart

For every macro interface, a file impl/<macro_interface_name>.dart defines one macro for each augmentation method on that macro interface's builder type. Arguments to the macro match that builder method, and are passed through.

For example, for ClassDeclarationsMacro#declareInType, the macro ClassDeclarationsDeclareInType is defined in impl/class_declarations_macro.dart.

Identifier arguments are passed as String, and will be resolved in the current library. Code arguments are also passed as String, in these strings Identifiers to resolve must be enclosed in backticks. They will be resolved in dart:core so that you can refer to, for example, int.

The tests are likewise named by the macro interface they test, for example class_declarations_macro_test.dart.