forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dart-lang#2556. Initial commit for macros tests
- Loading branch information
Showing
3 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 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. | ||
|
||
/// @assertion | ||
/// | ||
/// @description Checks | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
library macro_lib; | ||
|
||
import 'dart:async'; | ||
import 'package:_fe_analyzer_shared/src/macros/api.dart'; | ||
|
||
macro class AddTypeMacro implements LibraryTypesMacro { | ||
final String className; | ||
const AddTypeMacro() : className = "DefaultTypeMacroAddedClass"; | ||
const AddTypeMacro.name(this.className); | ||
|
||
FutureOr<void> buildTypesForLibrary(Library library, TypeBuilder builder) { | ||
//print(library.uri); | ||
DeclarationCode code = DeclarationCode.fromString("class $className {}"); | ||
builder.declareType(className, code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
name: co19_macros | ||
description: co19 tests for macros feature | ||
publish_to: none | ||
|
||
environment: | ||
sdk: '>=3.3.0-279.1.beta <4.0.0' | ||
|
||
dev_dependencies: | ||
args: ^2.3.0 | ||
benchmark_harness: ^2.2.1 | ||
checks: ^0.2.0 | ||
test: ^1.24.0 | ||
dart_style: ^2.2.1 | ||
_fe_analyzer_shared: any | ||
|
||
# Override to the latest version of the in progress api. | ||
dependency_overrides: | ||
_fe_analyzer_shared: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/_fe_analyzer_shared | ||
ref: main | ||
_js_interop_checks: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/_js_interop_checks | ||
ref: main | ||
analyzer: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/analyzer | ||
ref: main | ||
build_integration: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/build_integration | ||
ref: main | ||
compiler: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/compiler | ||
ref: main | ||
dart2js_info: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/dart2js_info | ||
ref: main | ||
dart2wasm: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/dart2wasm | ||
ref: main | ||
dev_compiler: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/dev_compiler | ||
ref: main | ||
front_end: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/front_end | ||
ref: main | ||
frontend_server: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/frontend_server | ||
ref: main | ||
js_ast: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/js_ast | ||
ref: main | ||
js_runtime: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/js_runtime | ||
ref: main | ||
js_shared: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/js_shared | ||
ref: main | ||
kernel: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/kernel | ||
ref: main | ||
mmap: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/mmap | ||
ref: main | ||
vm: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/vm | ||
ref: main | ||
wasm_builder: | ||
git: | ||
url: https://github.com/dart-lang/sdk.git | ||
path: pkg/wasm_builder | ||
ref: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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. | ||
|
||
/// @assertion | ||
/// | ||
/// @description Checks | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
@AddTypeMacro() | ||
library; | ||
|
||
import 'macros_lib.dart'; | ||
|
||
main() { | ||
print(DefaultTypeMacroAddedClass); | ||
} |