mirror of
https://github.com/pese-git/cherrypick.git
synced 2026-03-25 21:40:24 +00:00
feat: migrate to analyzer 9.0.0 API
- Replace Element2 API with Element API - Update imports from element2.dart to element.dart - Replace .firstFragment.name2 with .name - Replace .firstFragment.metadata2.annotations with .metadata.annotations - Replace .fields2 with .fields - Replace .methods2 with .methods - Remove duplicate imports in annotation_validator.dart and generated_class.dart - Update test mocks to use Element instead of Element2 All generators now work correctly with analyzer 9.0.0: - melos analyze: SUCCESS (0 issues) - melos codegen: SUCCESS (13 outputs generated) - melos bootstrap: SUCCESS (8 packages)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import 'package:analyzer/dart/element/element2.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:build/build.dart';
|
||||
import 'package:source_gen/source_gen.dart';
|
||||
import 'package:cherrypick_annotations/cherrypick_annotations.dart' as ann;
|
||||
@@ -80,11 +80,11 @@ class ModuleGenerator extends GeneratorForAnnotation<ann.module> {
|
||||
/// See file-level docs for usage and generated output example.
|
||||
@override
|
||||
dynamic generateForAnnotatedElement(
|
||||
Element2 element,
|
||||
Element element,
|
||||
ConstantReader annotation,
|
||||
BuildStep buildStep,
|
||||
) {
|
||||
if (element is! ClassElement2) {
|
||||
if (element is! ClassElement) {
|
||||
throw InvalidGenerationSourceError(
|
||||
'@module() can only be applied to classes.',
|
||||
element: element,
|
||||
|
||||
Reference in New Issue
Block a user