Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: require analyzer: ^5.12.0 #934

Merged
merged 4 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mobx_codegen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.4.0

- Require `analyzer: ^5.12.0`
- Support the latest package:analyzer
- Require Dart 3.0

## 2.3.0

- Adds `@alwaysNotify` annotation support for creating always notify observables. [@amondnet](https://github.com/amondnet) in [#907](https://github.com/mobxjs/mobx.dart/pull/907)
Expand Down
2 changes: 2 additions & 0 deletions mobx_codegen/lib/src/template/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ class AsyncMethodChecker {
method.returnType.isDartAsyncFuture ||
(method.isAsynchronous &&
!method.isGenerator &&
// ignore: deprecated_member_use
method.returnType.isDynamic);

bool returnsStream(MethodElement method) =>
_checkStream.isAssignableFromType(method.returnType) ||
(method.isAsynchronous &&
method.isGenerator &&
// ignore: deprecated_member_use
method.returnType.isDynamic);
}

Expand Down
7 changes: 2 additions & 5 deletions mobx_codegen/lib/src/type_names.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class LibraryScopedNameFinder {
// Reverse each import's export namespace so we can map elements to their
// library-local names. Note that the definedNames include a prefix if there
// is one.
// ignore: deprecated_member_use
for (final import in library.libraryImports) {
for (final entry in import.namespace.definedNames.entries) {
_namesByElement[entry.value] = entry.key;
Expand Down Expand Up @@ -75,14 +74,12 @@ class LibraryScopedNameFinder {
///
/// The returned string will include import prefixes on all applicable types.
String _getDartTypeName(DartType type) {
// ignore: deprecated_member_use
var typeElement = type.element2;
var typeElement = type.element;
if (type is FunctionType) {
// If we're dealing with a typedef, we let it undergo the standard name
// lookup. Otherwise, we special case the function naming.
if (type.alias?.element is TypeAliasElement) {
// ignore: deprecated_member_use
typeElement = type.alias!.element.aliasedElement?.enclosingElement3;
typeElement = type.alias!.element.aliasedElement?.enclosingElement;
} else {
return _getFunctionTypeName(type);
}
Expand Down
2 changes: 1 addition & 1 deletion mobx_codegen/lib/version.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Generated via set_version.dart. !!!DO NOT MODIFY BY HAND!!!

/// The current version as per `pubspec.yaml`.
const version = '2.2.0';
const version = '2.4.0';
8 changes: 4 additions & 4 deletions mobx_codegen/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
name: mobx_codegen
description: Code generator for MobX that adds support for annotating your code with @observable, @computed, @action and also creating Store classes.
version: 2.3.0
version: 2.4.0

homepage: https://github.com/mobxjs/mobx.dart
issue_tracker: https://github.com/mobxjs/mobx.dart/issues

environment:
sdk: ">=2.13.0 <3.0.0"
sdk: ^3.0.0

dependencies:
analyzer: ">=4.4.0 <6.0.0"
analyzer: ">=5.12.0 <7.0.0"
build: ^2.2.1
build_resolvers: ^2.0.6
meta: ^1.3.0
Expand All @@ -23,5 +23,5 @@ dev_dependencies:
coverage: ^1.0.4
lints: ^2.0.0
logging: ^1.0.2
mocktail: ^0.3.0
mocktail: ^1.0.0
test: ^1.20.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mobx_codegen/test/util_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ MockMethod mockFutureMethod({
bool isGenerator = false,
}) {
final returnType = MockType();
// ignore: deprecated_member_use
when(() => returnType.isDynamic).thenReturn(returnsDynamic);
when(() => returnType.isDartAsyncFuture).thenReturn(returnsFuture);
when(() => returnType.isDartAsyncFutureOr).thenReturn(returnsFutureOr);
Expand All @@ -37,6 +38,7 @@ MockMethod mockStreamMethod({
bool returnsDynamic = false,
}) {
final returnType = MockType();
// ignore: deprecated_member_use
when(() => returnType.isDynamic).thenReturn(returnsDynamic);

final method = MockMethod();
Expand Down