Removed dependency on mirror
This commit is contained in:
parent
8469a05ff0
commit
6d2be10536
3 changed files with 17 additions and 9 deletions
|
@ -1,15 +1,18 @@
|
|||
name: angel3_container_generator
|
||||
version: 3.0.1
|
||||
version: 6.0.0
|
||||
description: Codegen support for using pkg:reflectable with pkg:angel3_container.
|
||||
homepage: https://angel3-framework.web.app/
|
||||
repository: https://github.com/dukefirehawk/angel/tree/master/packages/container/angel_container_generator
|
||||
environment:
|
||||
sdk: '>=2.12.0 <3.0.0'
|
||||
sdk: '>=2.15.0 <3.0.0'
|
||||
dependencies:
|
||||
angel3_container: ^3.1.0
|
||||
angel3_container: ^6.0.0
|
||||
reflectable: ^3.0.4
|
||||
dev_dependencies:
|
||||
build_runner: ^2.1.2
|
||||
build_test: ^2.1.3
|
||||
test: ^1.17.5
|
||||
lints: ^1.0.1
|
||||
dependency_overrides:
|
||||
angel3_container:
|
||||
path: ../angel_container
|
||||
|
|
|
@ -101,7 +101,9 @@ RequestHandler handleContained(Function handler, InjectionRequest injection,
|
|||
return (RequestContext req, ResponseContext res) async {
|
||||
if (injection.parameters.isNotEmpty &&
|
||||
injection.parameters.values.any((p) => p.match != null) &&
|
||||
!suitableForInjection(req, res, injection)) return Future.value(true);
|
||||
!suitableForInjection(req, res, injection)) {
|
||||
return Future.value(true);
|
||||
}
|
||||
|
||||
var args = [];
|
||||
|
||||
|
@ -167,10 +169,10 @@ InjectionRequest preInject(Function handler, Reflector reflector) {
|
|||
var name = parameter.name;
|
||||
var type = parameter.type.reflectedType;
|
||||
|
||||
var _Parameter = reflector.reflectType(Parameter);
|
||||
var _parameter = reflector.reflectType(Parameter);
|
||||
|
||||
var p = parameter.annotations
|
||||
.firstWhereOrNull((m) => m.type.isAssignableTo(_Parameter))
|
||||
.firstWhereOrNull((m) => m.type.isAssignableTo(_parameter))
|
||||
?.reflectee as Parameter?;
|
||||
//print(p);
|
||||
if (p != null) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import 'dart:async';
|
|||
import 'dart:collection' show HashMap;
|
||||
import 'dart:convert';
|
||||
import 'package:angel3_container/angel3_container.dart';
|
||||
import 'package:angel3_container/mirrors.dart';
|
||||
import 'package:angel3_http_exception/angel3_http_exception.dart';
|
||||
import 'package:angel3_route/angel3_route.dart';
|
||||
import 'package:belatuk_combinator/belatuk_combinator.dart';
|
||||
|
@ -322,7 +321,7 @@ class Angel extends Routable {
|
|||
/// the execution will be faster, as the injection requirements were stored beforehand.
|
||||
Future runContained(Function handler, RequestContext req, ResponseContext res,
|
||||
[Container? container]) {
|
||||
container ??= Container(MirrorsReflector());
|
||||
container ??= Container(EmptyReflector());
|
||||
return Future.sync(() {
|
||||
if (_preContained.containsKey(handler)) {
|
||||
return handleContained(handler, _preContained[handler]!, container)(
|
||||
|
@ -337,7 +336,11 @@ class Angel extends Routable {
|
|||
Future runReflected(Function handler, RequestContext req, ResponseContext res,
|
||||
[Container? container]) {
|
||||
container ??=
|
||||
req.container ?? res.app?.container ?? Container(ThrowingReflector());
|
||||
req.container ?? res.app?.container ?? Container(EmptyReflector());
|
||||
|
||||
if (container.reflector is EmptyReflector) {
|
||||
throw ArgumentError("No `reflector` passed");
|
||||
}
|
||||
var h = handleContained(
|
||||
handler,
|
||||
_preContained[handler] = preInject(handler, container.reflector),
|
||||
|
|
Loading…
Reference in a new issue