@@ -8,6 +8,7 @@ import 'package:meta/meta.dart';
88
99import 'events.dart' ;
1010import 'mutable_recording.dart' ;
11+ import 'proxy.dart' ;
1112import 'result_reference.dart' ;
1213
1314/// Mixin that enables recording of property accesses, property mutations, and
@@ -34,7 +35,7 @@ import 'result_reference.dart';
3435/// int sampleProperty;
3536/// }
3637///
37- /// class RecordingFoo extends Object with _RecordingProxyMixin implements Foo {
38+ /// class RecordingFoo extends Object with RecordingProxyMixin implements Foo {
3839/// final Foo delegate;
3940///
4041/// RecordingFoo(this.delegate) {
@@ -59,7 +60,7 @@ import 'result_reference.dart';
5960/// Methods that return [Stream] s will be recorded immediately, but their
6061/// return values will be recorded as a [List] that will grow as the stream
6162/// produces data.
62- abstract class RecordingProxyMixin {
63+ abstract class RecordingProxyMixin implements ProxyObject {
6364 /// Maps method names to delegate functions.
6465 ///
6566 /// Invocations of methods listed in this map will be recorded after
@@ -107,7 +108,7 @@ abstract class RecordingProxyMixin {
107108 // a getter on a method, in which case we return a method proxy that,
108109 // when invoked, will perform the desired recording.
109110 return invocation.isGetter && methods[name] != null
110- ? new _MethodProxy (this , name)
111+ ? new MethodProxy (this , name)
111112 : super .noSuchMethod (invocation);
112113 }
113114
@@ -144,55 +145,3 @@ abstract class RecordingProxyMixin {
144145 return result;
145146 }
146147}
147-
148- /// A function reference that, when invoked, will record the invocation.
149- class _MethodProxy extends Object implements Function {
150- /// The object on which the method was originally invoked.
151- final RecordingProxyMixin object;
152-
153- /// The name of the method that was originally invoked.
154- final Symbol methodName;
155-
156- _MethodProxy (this .object, this .methodName);
157-
158- @override
159- dynamic noSuchMethod (Invocation invocation) {
160- if (invocation.isMethod && invocation.memberName == #call) {
161- // The method is being invoked. Capture the arguments, and invoke the
162- // method on the object. We have to synthesize an invocation, since our
163- // current `invocation` object represents the invocation of `call()`.
164- return object.noSuchMethod (new _MethodInvocationProxy (
165- methodName,
166- invocation.positionalArguments,
167- invocation.namedArguments,
168- ));
169- }
170- return super .noSuchMethod (invocation);
171- }
172- }
173-
174- class _MethodInvocationProxy extends Invocation {
175- _MethodInvocationProxy (
176- this .memberName,
177- this .positionalArguments,
178- this .namedArguments,
179- );
180-
181- @override
182- final Symbol memberName;
183-
184- @override
185- final List <dynamic > positionalArguments;
186-
187- @override
188- final Map <Symbol , dynamic > namedArguments;
189-
190- @override
191- final bool isMethod = true ;
192-
193- @override
194- final bool isGetter = false ;
195-
196- @override
197- final bool isSetter = false ;
198- }
0 commit comments