Fixed EmptyReflector

This commit is contained in:
thomashii@dukefirehawk.com 2023-04-15 11:05:33 +08:00
parent 83873d0fb7
commit d034fcebe8
3 changed files with 10 additions and 30 deletions

View file

@ -1,5 +1,10 @@
# Change Log # Change Log
## 7.1.0-beta.2
* Require Dart >= 2.19
* Refactored `EmptyReflector`
## 7.1.0-beta.1 ## 7.1.0-beta.1
* Require Dart >= 2.18 * Require Dart >= 2.18

View file

@ -1,5 +1,4 @@
import '../../angel3_container.dart'; import '../../angel3_container.dart';
import 'package:quiver/core.dart';
final Map<Symbol, String?> _symbolNames = <Symbol, String?>{}; final Map<Symbol, String?> _symbolNames = <Symbol, String?>{};
@ -62,14 +61,6 @@ class _EmptyReflectedClass extends ReflectedClass {
bool isAssignableTo(ReflectedType? other) { bool isAssignableTo(ReflectedType? other) {
return other == this; return other == this;
} }
@override
bool operator ==(other) {
return other is ReflectedClass && other.hashCode == hashCode;
}
@override
int get hashCode => hash2(this, " ");
} }
class _EmptyReflectedType extends ReflectedType { class _EmptyReflectedType extends ReflectedType {
@ -89,28 +80,12 @@ class _EmptyReflectedType extends ReflectedType {
bool isAssignableTo(ReflectedType? other) { bool isAssignableTo(ReflectedType? other) {
return other == this; return other == this;
} }
@override
bool operator ==(other) {
return other is ReflectedType && other.hashCode == hashCode;
}
@override
int get hashCode => hash2(this, " ");
} }
class _EmptyReflectedInstance extends ReflectedInstance { class _EmptyReflectedInstance extends ReflectedInstance {
const _EmptyReflectedInstance() const _EmptyReflectedInstance()
: super(const _EmptyReflectedType(), const _EmptyReflectedClass(), null); : super(const _EmptyReflectedType(), const _EmptyReflectedClass(), null);
@override
bool operator ==(other) {
return other is ReflectedInstance && other.hashCode == hashCode;
}
@override
int get hashCode => hash2(this, " ");
@override @override
ReflectedInstance getField(String name) { ReflectedInstance getField(String name) {
throw UnsupportedError( throw UnsupportedError(

View file

@ -1,13 +1,13 @@
name: angel3_container name: angel3_container
version: 7.1.0-beta.1 version: 7.1.0-beta.2
description: Angel3 hierarchical DI container, and pluggable backends for reflection. description: Angel3 hierarchical DI container, and pluggable backends for reflection.
homepage: https://angel3-framework.web.app/ homepage: https://angel3-framework.web.app/
repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container
environment: environment:
sdk: '>=2.18.0 <3.0.0' sdk: '>=2.19.0 <3.0.0'
dependencies: dependencies:
collection: ^1.15.0 collection: ^1.17.0
quiver: ^3.0.1 quiver: ^3.2.0
dev_dependencies: dev_dependencies:
test: ^1.21.0 test: ^1.24.0
lints: ^2.0.0 lints: ^2.0.0