blob: ab6a143e59e7b3977a1d6bbe5e784802737f2c64 [file] [log] [blame]
# Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
# Incremental compiler scenario coped from the tests in
# tests/language/macros/nesting/
# where macro_impl_uses_macro1_test.dart becomes
# macro_impl_uses_macro2_test.dart.
type: newworld
worlds:
- entry: main.dart
experiments: macros
sources:
.dart_tool/package_config.json: |
{
"configVersion": 2,
"packages": [
{
"name": "macros",
"rootUri": "holePunch:pkg/macros",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "_macros",
"rootUri": "holePunch:pkg/_macros",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "meta",
"rootUri": "holePunch:pkg/meta",
"packageUri": "lib/"
}
]
}
main.dart: |
import 'impl/declare_count1_macro.dart';
@DeclareCount1()
@override
class A {}
void main() {
print(A().count);
}
impl/declare_count2_macro.dart: |
import 'package:macros/macros.dart';
import 'declare_count1_macro.dart';
@DeclareCount1()
macro class DeclareCount2 implements ClassDeclarationsMacro {
const DeclareCount2();
@override
Future<void> buildDeclarationsForClass(
ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
builder.declareInType(DeclarationCode.fromString('int get count => ${count + 1};'));
}
}
impl/declare_count1_macro.dart: |
import 'package:macros/macros.dart';
import 'declare_count0_macro.dart';
@DeclareCount0()
macro class DeclareCount1 implements ClassDeclarationsMacro {
const DeclareCount1();
@override
Future<void> buildDeclarationsForClass(
ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
builder.declareInType(DeclarationCode.fromString('int get count => ${count + 1};'));
}
}
impl/declare_count0_macro.dart: |
import 'package:macros/macros.dart';
macro class DeclareCount0 implements ClassDeclarationsMacro {
const DeclareCount0();
@override
Future<void> buildDeclarationsForClass(
ClassDeclaration clazz, MemberDeclarationBuilder builder) async {
builder.declareInType(DeclarationCode.fromString('int get count => 0;'));
}
}
expectedLibraryCount: 5
- entry: main.dart
worldType: updated
expectInitializeFromDill: false
experiments: macros
invalidate:
- main.dart
sources:
main.dart: |
import 'impl/declare_count2_macro.dart';
@DeclareCount2()
@override
class A {}
void main() {
print(A().count);
}
expectedLibraryCount: 6
advancedInvalidation: outlineChange