Default to const EmptyReflector()

This commit is contained in:
Tobe O 2018-08-21 10:22:41 -04:00
parent 6822657f26
commit edcbf9f639
8 changed files with 255 additions and 188 deletions

View file

@ -12,7 +12,7 @@
<entry key="angel_container">
<value>
<list>
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.5/lib" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.7/lib" />
</list>
</value>
</entry>
@ -454,7 +454,7 @@
</properties>
<CLASSES>
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/analyzer-0.32.4/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.5/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.7/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_http_exception-1.0.0+3/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_model-1.0.0+1/lib" />
<root url="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-3.0.0/lib" />

View file

@ -4,15 +4,12 @@
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/hooked_service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/hooked_service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/injection.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/injection.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/routable.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/routable.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/request_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/request_context.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/response_context.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/response_context.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/server.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/server.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/core/service.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/core/service.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/http/angel_http.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/angel_http.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/util.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/test/hooked_test.dart" beforeDir="false" afterPath="$PROJECT_DIR$/test/hooked_test.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/src/http/controller.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/src/http/controller.dart" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
@ -62,17 +59,59 @@
<file leaf-file-name="util.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="256">
<caret line="16" column="10" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
<state relative-caret-position="96">
<caret line="6" column="27" selection-start-line="6" selection-start-column="27" selection-end-line="6" selection-end-column="27" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="injection.dart" pinned="false" current-in-tab="true">
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="556">
<caret line="66" column="26" selection-start-line="66" selection-start-column="26" selection-end-line="66" selection-end-column="26" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="injection.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" column="65" selection-start-line="8" selection-start-column="65" selection-end-line="8" selection-end-column="65" />
<state relative-caret-position="25">
<caret line="85" column="36" selection-start-line="85" selection-start-column="36" selection-end-line="85" selection-end-column="36" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="request_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="64">
<caret line="4" column="2" selection-start-line="4" selection-start-column="2" selection-end-line="4" selection-end-column="2" />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="accepts_test.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/accepts_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="261">
<caret line="34" column="5" selection-start-line="34" selection-start-column="5" selection-end-line="34" selection-end-column="5" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -80,8 +119,8 @@
<file leaf-file-name="server.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
<caret line="162" column="17" selection-start-line="162" selection-start-column="17" selection-end-line="162" selection-end-column="17" />
<state relative-caret-position="347">
<caret line="355" column="11" lean-forward="true" selection-start-line="355" selection-start-column="11" selection-end-line="355" selection-end-column="11" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
@ -89,6 +128,18 @@
</provider>
</entry>
</file>
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="66">
<caret line="244" column="53" selection-start-line="244" selection-start-column="53" selection-end-line="244" selection-end-column="53" />
<folding>
<element signature="e#48#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@ -128,9 +179,9 @@
<find>stopw</find>
<find>release</find>
<find>handleRe</find>
<find>mirrors</find>
<find>get container</find>
<find>Parameter</find>
<find>mirrors</find>
</findStrings>
<replaceStrings>
<replace>FutureOr</replace>
@ -217,26 +268,26 @@
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
<option value="$PROJECT_DIR$/test/precontained_test.dart" />
<option value="$PROJECT_DIR$/test/primitives_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http_request_context.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/example/handle_error.dart" />
<option value="$PROJECT_DIR$/test/server_test.dart" />
<option value="$PROJECT_DIR$/example/json.dart" />
<option value="$PROJECT_DIR$/test/routing_test.dart" />
<option value="$PROJECT_DIR$/lib/src/http/http_response_context.dart" />
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
<option value="$PROJECT_DIR$/lib/src/http/angel_http.dart" />
<option value="$PROJECT_DIR$/lib/src/core/hooked_service.dart" />
<option value="$PROJECT_DIR$/test/hooked_test.dart" />
<option value="$PROJECT_DIR$/lib/src/core/service.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
<option value="$PROJECT_DIR$/lib/src/core/routable.dart" />
<option value="$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.3/lib/src/mirrors/reflector.dart" />
<option value="$PROJECT_DIR$/lib/src/util.dart" />
<option value="$PROJECT_DIR$/example/main.dart" />
<option value="$PROJECT_DIR$/lib/src/core/request_context.dart" />
<option value="$PROJECT_DIR$/lib/src/core/injection.dart" />
<option value="$PROJECT_DIR$/lib/src/core/response_context.dart" />
<option value="$PROJECT_DIR$/lib/src/http/controller.dart" />
<option value="$PROJECT_DIR$/lib/src/core/server.dart" />
<option value="$PROJECT_DIR$/CHANGELOG.md" />
</list>
</option>
</component>
@ -256,8 +307,8 @@
<packageJsonPaths />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="64" />
<option name="y" value="41" />
<option name="x" value="80" />
<option name="y" value="23" />
<option name="width" value="1342" />
<option name="height" value="784" />
</component>
@ -314,6 +365,11 @@
<item name="framework" type="cbb8eebc:String" user="framework" />
<item name="performance/hello" type="cbb8eebc:String" user="performance/hello" />
</path>
<path>
<item name="Root" type="cbb8eebc:String" user="Root" />
<item name="framework" type="cbb8eebc:String" user="framework" />
<item name="test" type="cbb8eebc:String" user="test" />
</path>
</expand>
<select />
</subPane>
@ -362,7 +418,7 @@
</list>
</option>
</component>
<component name="RunManager" selected="Dart Test.Controller Tests">
<component name="RunManager" selected="Dart Command Line App.main.dart">
<configuration name="Can serialize function result as JSON in routing_test.dart" type="DartTestRunConfigurationType" factoryName="Dart Test" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/test/routing_test.dart" />
<option name="scope" value="GROUP_OR_TEST_BY_NAME" />
@ -662,14 +718,7 @@
<workItem from="1534009494986" duration="594000" />
<workItem from="1534546784803" duration="353000" />
<workItem from="1534547885788" duration="9908000" />
<workItem from="1534793956753" duration="12414000" />
</task>
<task id="LOCAL-00109" summary="Removed random_string dependency">
<created>1534547132671</created>
<option name="number" value="00109" />
<option name="presentableId" value="LOCAL-00109" />
<option name="project" value="LOCAL" />
<updated>1534547132671</updated>
<workItem from="1534793956753" duration="14213000" />
</task>
<task id="LOCAL-00110" summary="Switch to MediaType">
<created>1534692805087</created>
@ -1007,19 +1056,17 @@
<option name="project" value="LOCAL" />
<updated>1534816646962</updated>
</task>
<option name="localTasksCounter" value="158" />
<task id="LOCAL-00158" summary="ioc uses executeHandler">
<created>1534819472503</created>
<option name="number" value="00158" />
<option name="presentableId" value="LOCAL-00158" />
<option name="project" value="LOCAL" />
<updated>1534819472503</updated>
</task>
<option name="localTasksCounter" value="159" />
<servers />
</component>
<component name="TestHistory">
<history-entry file="All_Tests - 2018.07.09 at 12h 48m 12s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_find_one_test_dart - 2018.07.12 at 11h 13m 12s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_find_one_test_dart - 2018.07.12 at 11h 14m 14s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_find_one_test_dart - 2018.07.12 at 11h 16m 10s.xml">
<configuration name="tests in find_one_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
@ -1041,9 +1088,18 @@
<history-entry file="All_Tests - 2018.08.20 at 22h 14m 22s.xml">
<configuration name="All Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_accepts_test_dart - 2018.08.20 at 22h 44m 02s.xml">
<configuration name="tests in accepts_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="tests_in_anonymous_service_test_dart - 2018.08.20 at 22h 44m 10s.xml">
<configuration name="tests in anonymous_service_test.dart" configurationId="DartTestRunConfigurationType" />
</history-entry>
<history-entry file="Controller_Tests - 2018.08.20 at 22h 44m 19s.xml">
<configuration name="Controller Tests" configurationId="DartTestRunConfigurationType" />
</history-entry>
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="184621000" />
<option name="totallyTimeSpent" value="186420000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -1055,7 +1111,7 @@
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="64" y="41" width="1342" height="784" extended-state="0" />
<frame x="80" y="23" width="1342" height="784" extended-state="0" />
<editor active="true" />
<layout>
<window_info anchor="right" id="Palette" order="3" />
@ -1079,9 +1135,9 @@
<window_info id="Image Layers" order="2" />
<window_info anchor="right" id="Capture Analysis" order="3" />
<window_info anchor="bottom" id="Version Control" order="7" weight="0.32905984" />
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.4964476" visible="true" weight="0.3973799" />
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4964476" weight="0.3973799" />
<window_info anchor="bottom" id="Terminal" order="7" weight="0.44978166" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.27846155" />
<window_info content_ui="combo" id="Project" order="0" weight="0.27846155" />
<window_info anchor="bottom" id="Find" order="1" weight="0.32905984" />
<window_info anchor="right" id="SciView" order="4" />
<window_info anchor="right" id="Theme Preview" order="3" />
@ -1106,7 +1162,6 @@
</component>
<component name="VcsManagerConfiguration">
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
<MESSAGE value="Completely remove RequestContext.io" />
<MESSAGE value="Completely remove ResponseContext.io" />
<MESSAGE value="Rename HTTP request+response impl, drop the &quot;impl&quot;" />
<MESSAGE value="Make lazy parsing the default" />
@ -1131,7 +1186,8 @@
<MESSAGE value="Make LockableBytesBuilder public" />
<MESSAGE value="Remove ResponseContext.dispose" />
<MESSAGE value="Remove releaseCOrrespondingRequest" />
<option name="LAST_COMMIT_MESSAGE" value="Remove releaseCOrrespondingRequest" />
<MESSAGE value="ioc uses executeHandler" />
<option name="LAST_COMMIT_MESSAGE" value="ioc uses executeHandler" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
@ -1139,30 +1195,6 @@
</breakpoint-manager>
</component>
<component name="editorHistoryManager">
<entry file="file:///usr/local/Cellar/dart/2.0.0/libexec/lib/core/list.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="53" column="15" selection-start-line="53" selection-start-column="15" selection-end-line="53" selection-end-column="15" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/general_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="160">
<caret line="15" column="69" selection-start-line="15" selection-start-column="69" selection-end-line="15" selection-end-column="69" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/metadata.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="149">
<caret line="27" column="32" selection-start-line="27" selection-start-column="32" selection-end-line="27" selection-end-column="32" />
<folding>
<element signature="e#40#104#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/serialize_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
@ -1307,16 +1339,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="257">
<caret line="20" column="15" selection-start-line="20" selection-start-column="15" selection-end-line="20" selection-end-column="15" />
<folding>
<element signature="e#47#67#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="80">
@ -1324,16 +1346,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="468">
<caret line="33" column="69" selection-start-line="33" selection-start-column="69" selection-end-line="33" selection-end-column="69" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="99">
@ -1358,16 +1370,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="278" column="3" selection-start-line="278" selection-start-column="3" selection-end-line="278" selection-end-column="3" />
<folding>
<element signature="e#48#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="258">
@ -1429,13 +1431,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="304">
<caret line="45" column="27" selection-start-line="45" selection-start-column="27" selection-end-line="45" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/di_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="176">
@ -1443,16 +1438,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="129">
<caret line="162" column="17" selection-start-line="162" selection-start-column="17" selection-end-line="162" selection-end-column="17" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.2/lib/src/mirrors/reflector.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="220">
@ -1488,13 +1473,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_route-3.0.0/lib/src/router.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="97">
@ -1502,23 +1480,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="86">
<caret line="86" column="8" selection-start-line="86" selection-start-column="8" selection-end-line="86" selection-end-column="8" />
<folding>
<element signature="e#40#60#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="256">
<caret line="16" column="10" selection-start-line="16" selection-start-column="10" selection-end-line="16" selection-end-column="10" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="150">
@ -1529,10 +1490,105 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/request_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="64">
<caret line="4" column="2" selection-start-line="4" selection-start-column="2" selection-end-line="4" selection-end-column="2" />
</state>
</provider>
</entry>
<entry file="file://$USER_HOME$/.pub-cache/hosted/pub.dartlang.org/angel_container-1.0.0-alpha.5/lib/src/reflector.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="430">
<caret line="53" column="7" selection-start-line="53" selection-start-column="7" selection-end-line="53" selection-end-column="7" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/injection.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="128">
<caret line="8" column="65" selection-start-line="8" selection-start-column="65" selection-end-line="8" selection-end-column="65" />
<state relative-caret-position="25">
<caret line="85" column="36" selection-start-line="85" selection-start-column="36" selection-end-line="85" selection-end-column="36" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/response_context.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="66">
<caret line="244" column="53" selection-start-line="244" selection-start-column="53" selection-end-line="244" selection-end-column="53" />
<folding>
<element signature="e#48#68#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/http/controller.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="109">
<caret line="100" column="45" lean-forward="true" selection-start-line="100" selection-start-column="45" selection-end-line="100" selection-end-column="45" />
<folding>
<element signature="e#42#62#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/accepts_test.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="261">
<caret line="34" column="5" selection-start-line="34" selection-start-column="5" selection-end-line="34" selection-end-column="5" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.lock">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="208">
<caret line="13" column="12" selection-start-line="13" selection-start-column="12" selection-end-line="13" selection-end-column="12" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="7" column="20" selection-start-line="7" selection-start-column="20" selection-end-line="7" selection-end-column="20" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/util.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="96">
<caret line="6" column="27" selection-start-line="6" selection-start-column="27" selection-end-line="6" selection-end-column="27" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/routable.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="86">
<caret line="86" column="8" selection-start-line="86" selection-start-column="8" selection-end-line="86" selection-end-column="8" />
<folding>
<element signature="e#40#60#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/src/core/server.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="347">
<caret line="355" column="11" lean-forward="true" selection-start-line="355" selection-start-column="11" selection-end-line="355" selection-end-column="11" />
<folding>
<element signature="e#38#58#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="556">
<caret line="66" column="26" selection-start-line="66" selection-start-column="26" selection-end-line="66" selection-end-column="26" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>

View file

@ -62,3 +62,6 @@ as in many cases it is unnecessary and slows down response time.
* Removed `ResponseContext.dispose`.
* Removed the now-obsolete `ResponseContext.end`.
* Removed the now-obsolete `ResponseContext.releaseCorrespondingRequest`.
* `preInject` now takes a `Reflector` as its second argument.
* `Angel.reflector` defaults to `const EmptyReflector()`, disabling
reflection out-of-the-box.

View file

@ -8,10 +8,16 @@ const List<Type> _primitiveTypes = [String, int, num, double, Null];
///
/// Calling [ioc] also auto-serializes the result of a [handler].
RequestHandler ioc(Function handler, {Iterable<String> optional: const []}) {
var injection = preInject(handler);
injection.optional.addAll(optional ?? []);
var contained = handleContained(handler, injection);
InjectionRequest injection;
RequestHandler contained;
return (req, res) {
if (injection == null) {
injection = preInject(handler, req.app.container.reflector);
injection.optional.addAll(optional ?? []);
contained = handleContained(handler, injection);
}
return req.app.executeHandler(contained, req, res);
};
}
@ -127,22 +133,22 @@ class InjectionRequest {
parameters = {};
}
final TypeMirror _Parameter = reflectType(Parameter);
/// Predetermines what needs to be injected for a handler to run.
InjectionRequest preInject(Function handler) {
InjectionRequest preInject(Function handler, Reflector reflector) {
var injection = new InjectionRequest();
ClosureMirror closureMirror = reflect(handler);
var closureMirror = reflector.reflectFunction(handler);
if (closureMirror.function.parameters.isEmpty) return injection;
if (closureMirror.parameters.isEmpty) return injection;
// Load parameters
for (var parameter in closureMirror.function.parameters) {
var name = MirrorSystem.getName(parameter.simpleName);
for (var parameter in closureMirror.parameters) {
var name = parameter.name;
var type = parameter.type.reflectedType;
var p = parameter.metadata
var _Parameter = reflector.reflectType(Parameter);
var p = parameter.annotations
.firstWhere((m) => m.type.isAssignableTo(_Parameter),
orElse: () => null)
?.reflectee as Parameter;
@ -160,7 +166,7 @@ InjectionRequest preInject(Function handler) {
}
if (!parameter.isNamed) {
if (parameter.isOptional) injection.optional.add(name);
if (!parameter.isRequired) injection.optional.add(name);
if (type == RequestContext || type == ResponseContext) {
injection.required.add(type);

View file

@ -2,7 +2,7 @@ library angel_framework.http.request_context;
import 'dart:async';
import 'dart:io' show Cookie, HttpHeaders, HttpSession, InternetAddress;
import 'dart:mirrors';
//import 'dart:mirrors';
import 'package:angel_container/angel_container.dart';
import 'package:body_parser/body_parser.dart';

View file

@ -242,7 +242,7 @@ abstract class ResponseContext<RawResponse>
"Controller '${split[0]}' does not contain any action named '${split[1]}'");
final head =
controller.findExpose().path.toString().replaceAll(_straySlashes, '');
controller.findExpose(app.container.reflector).path.toString().replaceAll(_straySlashes, '');
final tail = matched
.makeUri(params.keys.fold<Map<String, dynamic>>({}, (out, k) {
return out..[k.toString()] = params[k];

View file

@ -10,7 +10,6 @@ import 'package:angel_http_exception/angel_http_exception.dart';
import 'package:angel_route/angel_route.dart';
import 'package:combinator/combinator.dart';
import 'package:logging/logging.dart';
import 'package:meta/meta.dart';
import 'package:tuple/tuple.dart';
import '../http/http.dart';
@ -299,7 +298,7 @@ class Angel extends Routable {
_isProduction = true;
_add(v) {
if (v is Function && !_preContained.containsKey(v)) {
_preContained[v] = preInject(v);
_preContained[v] = preInject(v, container.reflector);
}
}
@ -336,8 +335,10 @@ class Angel extends Routable {
/// Runs with DI, and *always* reflects. Prefer [runContained].
Future runReflected(
Function handler, RequestContext req, ResponseContext res) {
var h =
handleContained(handler, _preContained[handler] = preInject(handler));
var h = handleContained(
handler,
_preContained[handler] =
preInject(handler, req.app.container.reflector));
return new Future.sync(() => h(req, res));
// return closureMirror.apply(args).reflectee;
}
@ -359,7 +360,7 @@ class Angel extends Routable {
}
Angel(
{@required Reflector reflector,
{Reflector reflector: const EmptyReflector(),
this.logger,
this.eagerParseRequestBodies: false,
this.allowMethodOverrides: true,

View file

@ -1,8 +1,7 @@
library angel_framework.http.controller;
import 'dart:async';
import 'dart:mirrors';
import 'package:angel_container/angel_container.dart';
import 'package:angel_route/angel_route.dart';
import 'package:meta/meta.dart';
@ -35,8 +34,8 @@ class Controller {
}
// Load global expose decl
ClassMirror classMirror = reflectClass(this.runtimeType);
Expose exposeDecl = findExpose();
var classMirror = app.container.reflector.reflectClass(this.runtimeType);
Expose exposeDecl = findExpose(app.container.reflector);
if (exposeDecl == null) {
throw new Exception(
@ -45,36 +44,37 @@ class Controller {
var routable = new Routable();
app.mount(exposeDecl.path, routable);
TypeMirror typeMirror = reflectType(this.runtimeType);
var typeMirror = app.container.reflector.reflectType(this.runtimeType);
String name = exposeDecl.as?.isNotEmpty == true
? exposeDecl.as
: MirrorSystem.getName(typeMirror.simpleName);
: typeMirror.name;
app.controllers[name] = this;
// Pre-reflect methods
InstanceMirror instanceMirror = reflect(this);
var instanceMirror = app.container.reflector.reflectInstance(this);
final handlers = <RequestHandler>[]
..addAll(exposeDecl.middleware)
..addAll(middleware);
final routeBuilder = _routeBuilder(instanceMirror, routable, handlers);
classMirror.instanceMembers.forEach(routeBuilder);
classMirror.declarations.forEach(routeBuilder);
configureRoutes(routable);
return new Future.value();
}
void Function(Symbol, MethodMirror) _routeBuilder(
InstanceMirror instanceMirror,
void Function(ReflectedDeclaration) _routeBuilder(
ReflectedInstance instanceMirror,
Routable routable,
Iterable<RequestHandler> handlers) {
return (Symbol methodName, MethodMirror method) {
if (method.isRegularMethod &&
methodName != #toString &&
methodName != #noSuchMethod &&
methodName != #call &&
methodName != #equals &&
methodName != #==) {
Expose exposeDecl = method.metadata
return (ReflectedDeclaration decl) {
var methodName = decl.name;
if (methodName != 'toString' &&
methodName != 'noSuchMethod' &&
methodName != 'call' &&
methodName != 'equals' &&
methodName != '==') {
Expose exposeDecl = decl.function.annotations
.map((m) => m.reflectee)
.firstWhere((r) => r is Expose, orElse: () => null);
@ -87,9 +87,10 @@ class Controller {
..addAll(exposeDecl.middleware);
String name = exposeDecl.as?.isNotEmpty == true
? exposeDecl.as
: MirrorSystem.getName(methodName);
: methodName;
// Check if normal
var method = decl.function;
if (method.parameters.length == 2 &&
method.parameters[0].type.reflectedType == RequestContext &&
method.parameters[1].type.reflectedType == ResponseContext) {
@ -103,7 +104,7 @@ class Controller {
return;
}
var injection = preInject(reflectedMethod);
var injection = preInject(reflectedMethod, app.container.reflector);
if (exposeDecl?.allowNull?.isNotEmpty == true)
injection.optional?.addAll(exposeDecl.allowNull);
@ -119,8 +120,8 @@ class Controller {
void configureRoutes(Routable routable) {}
/// Finds the [Expose] declaration for this class.
Expose findExpose() => reflectClass(runtimeType)
.metadata
Expose findExpose(Reflector reflector) => reflector.reflectClass(runtimeType)
.annotations
.map((m) => m.reflectee)
.firstWhere((r) => r is Expose, orElse: () => null) as Expose;
}