This repository was archived by the owner on Feb 22, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Expand file tree Collapse file tree 3 files changed +39
-2
lines changed Original file line number Diff line number Diff line change @@ -161,10 +161,11 @@ getterChild(value, childKey) {
161
161
162
162
InstanceMirror instanceMirror = reflect (value);
163
163
Symbol curSym = new Symbol (childKey);
164
+
164
165
try {
165
166
// maybe it is a member field?
166
167
return [true , instanceMirror.getField (curSym).reflectee];
167
- } catch (e) {
168
+ } on NoSuchMethodError catch (e) {
168
169
// maybe it is a member method?
169
170
if (instanceMirror.type.members.containsKey (curSym)) {
170
171
MethodMirror methodMirror = instanceMirror.type.members[curSym];
@@ -178,10 +179,16 @@ getterChild(value, childKey) {
178
179
})];
179
180
}
180
181
return [false , null ];
182
+ } catch (e) {
183
+ throw ;
181
184
}
182
185
}
183
186
184
187
getter (scope, locals, path) {
188
+ if (scope == null ) {
189
+ return null ;
190
+ }
191
+
185
192
List <String > pathKeys = path.split ('.' );
186
193
var pathKeysLength = pathKeys.length;
187
194
Original file line number Diff line number Diff line change @@ -315,7 +315,7 @@ main() {
315
315
expect (() {
316
316
var element = $('<tab local><pane></pane><pane local></pane></tab>' );
317
317
$compile (element)(injector, element);
318
- }, throwsA ( contains ( 'No provider found for LocalAttrDirective! (resolving LocalAttrDirective)' )) );
318
+ }). toThrow ( 'No provider found for LocalAttrDirective! (resolving LocalAttrDirective)' );
319
319
}));
320
320
321
321
it ('should publish component controller into the scope' , async (inject ((Scope $rootScope) {
Original file line number Diff line number Diff line change @@ -690,6 +690,32 @@ main() {
690
690
Parser .parse ('{}()' )({});
691
691
}).toThrow ('{} is not a function' );
692
692
});
693
+
694
+ it ('should let null be null' , () {
695
+ scope['map' ] = {};
696
+
697
+ expect (eval ('null' )).toBe (null );
698
+ expect (eval ('map.null' )).toBe (null );
699
+ });
700
+
701
+
702
+ it ('should behave gracefully with a null scope' , () {
703
+ expect (Parser .parse ('null' )(null )).toBe (null );
704
+ });
705
+
706
+
707
+ it ('should pass exceptions through getters' , () {
708
+ expect (() {
709
+ Parser .parse ('boo' )(new ScopeWithErrors ());
710
+ }).toThrow ('boo to you' );
711
+ });
712
+
713
+
714
+ it ('should pass exceptions through methods' , () {
715
+ expect (() {
716
+ Parser .parse ('foo()' )(new ScopeWithErrors ());
717
+ }).toThrow ('foo to you' );
718
+ });
693
719
});
694
720
695
721
describe ('assignable' , () {
@@ -714,5 +740,9 @@ main() {
714
740
expect (Parser .parse ('a.b' )({'a' : {'b' : 5 }}, {'a' : null })).toEqual (null );
715
741
});
716
742
});
743
+ }
717
744
745
+ class ScopeWithErrors {
746
+ String get boo { dump ("got a boo" ); throw "boo to you" ; }
747
+ String foo () { dump ("got a foo" ); throw "foo to you" ; }
718
748
}
You can’t perform that action at this time.
0 commit comments