Skip to content

Commit e321961

Browse files
committed
Fixes for analyzer 8.
1 parent 3bd5846 commit e321961

23 files changed

+50
-2
lines changed

example/lib/src/multiplier_generator.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped.
6+
57
import 'package:analyzer/dart/element/element2.dart';
68
import 'package:build/build.dart';
79
import 'package:source_gen/source_gen.dart';

example/lib/src/property_product_generator.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class PropertyProductGenerator extends Generator {
1212
String generate(LibraryReader library, BuildStep buildStep) {
1313
final productNames = topLevelNumVariables(
1414
library,
15+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
1516
).map((element) => element.name3).join(' * ');
1617

1718
return '''

example/lib/src/property_sum_generator.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class PropertySumGenerator extends Generator {
1212
String generate(LibraryReader library, BuildStep buildStep) {
1313
final sumNames = topLevelNumVariables(
1414
library,
15+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
1516
).map((element) => element.name3).join(' + ');
1617

1718
return '''

example/lib/src/utils.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped.
6+
57
import 'package:analyzer/dart/element/element2.dart';
68
import 'package:source_gen/source_gen.dart';
79

source_gen/lib/src/builder.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:convert';
66

77
import 'package:analyzer/dart/ast/ast.dart';
8+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
89
import 'package:analyzer/dart/element/element2.dart';
910
import 'package:build/build.dart';
1011
import 'package:dart_style/dart_style.dart';
@@ -109,6 +110,7 @@ class _Builder extends Builder {
109110
}
110111

111112
Future<void> _generateForLibrary(
113+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
112114
LibraryElement2 library,
113115
BuildStep buildStep,
114116
) async {
@@ -355,6 +357,7 @@ class LibraryBuilder extends _Builder {
355357
}
356358

357359
Stream<GeneratedOutput> _generate(
360+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
358361
LibraryElement2 library,
359362
List<Generator> generators,
360363
BuildStep buildStep,
@@ -440,6 +443,7 @@ const partIdRegExpLiteral = r'[A-Za-z_\d-]+';
440443

441444
final _partIdRegExp = RegExp('^$partIdRegExpLiteral\$');
442445

446+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
443447
String languageOverrideForLibrary(LibraryElement2 library) {
444448
final override = library.languageVersion.override;
445449
return override == null

source_gen/lib/src/constants/reader.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:analyzer/dart/constant/value.dart';
6+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
67
import 'package:analyzer/dart/element/element2.dart';
78
import 'package:analyzer/dart/element/type.dart';
89

@@ -268,6 +269,7 @@ class _DartObjectConstant extends ConstantReader {
268269
ConstantReader read(String field) {
269270
final reader = peek(field);
270271
if (reader == null) {
272+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
271273
assertHasField(objectValue.type!.element3 as InterfaceElement2, field);
272274
return const _NullConstant();
273275
}

source_gen/lib/src/constants/utils.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped.
6+
57
import 'package:analyzer/dart/constant/value.dart';
68
import 'package:analyzer/dart/element/element2.dart';
79

source_gen/lib/src/generator.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:async';
66

77
import 'package:analyzer/dart/ast/ast.dart';
8+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
89
import 'package:analyzer/dart/element/element2.dart';
910
import 'package:build/build.dart';
1011
import 'package:source_span/source_span.dart';
@@ -46,7 +47,8 @@ class InvalidGenerationSource implements Exception {
4647
/// May be an empty string if unknown.
4748
final String todo;
4849

49-
/// The [Element2] associated with this error, if any.
50+
/// The `Element2` associated with this error, if any.
51+
/// ignore: deprecated_member_use until analyzer 7 support is dropped.
5052
final Element2? element;
5153

5254
/// The [ElementDirective] associated with this error, if any.
@@ -62,12 +64,14 @@ class InvalidGenerationSource implements Exception {
6264
this.message, {
6365
Annotatable? annotatable,
6466
this.todo = '',
67+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
6568
Element2? element,
6669
ElementDirective? elementDirective,
6770
Fragment? fragment,
6871
this.node,
6972
}) : element =
7073
element ??
74+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
7175
(annotatable is Element2 ? annotatable : null) as Element2?,
7276
elementDirective =
7377
elementDirective ??

source_gen/lib/src/generator_for_annotation.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'dart:async';
66

7+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
78
import 'package:analyzer/dart/element/element2.dart';
89
import 'package:build/build.dart';
910

@@ -38,7 +39,7 @@ import 'type_checker.dart';
3839
/// Elements which are not at the top level, such as the members of a class or
3940
/// extension, are not searched for annotations. To operate on, for instance,
4041
/// annotated fields of a class ensure that the class itself is annotated with
41-
/// [T] and use the [Element2] to iterate over fields. The [TypeChecker] utility
42+
/// [T] and use the `Element2` to iterate over fields. The [TypeChecker] utility
4243
/// may be helpful to check which elements have a given annotation.
4344
abstract class GeneratorForAnnotation<T> extends Generator {
4445
final bool throwOnUnresolved;
@@ -126,6 +127,7 @@ abstract class GeneratorForAnnotation<T> extends Generator {
126127
/// Implementations should return `null` when no content is generated. Empty
127128
/// or whitespace-only [String] instances are also ignored.
128129
dynamic generateForAnnotatedElement(
130+
// ignore: deprecated_member_use until analyzer 7 support is dropped.
129131
Element2 element,
130132
ConstantReader annotation,
131133
BuildStep buildStep,

source_gen/lib/src/library.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// ignore_for_file: deprecated_member_use until analyzer 7 support is dropped.
6+
57
import 'package:analyzer/dart/element/element2.dart';
68
import 'package:build/build.dart';
79
import 'package:path/path.dart' as p;

0 commit comments

Comments
 (0)