OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:observe/observe.dart'; | 5 import 'package:observe/observe.dart'; |
6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
7 import 'observe_test_utils.dart'; | 7 import 'observe_test_utils.dart'; |
8 | 8 |
9 // This file contains code ported from: | 9 // This file contains code ported from: |
10 // https://github.com/rafaelw/ChangeSummary/blob/master/tests/test.js | 10 // https://github.com/rafaelw/ChangeSummary/blob/master/tests/test.js |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 @reflectable get foo { | 276 @reflectable get foo { |
277 getFooCalled++; | 277 getFooCalled++; |
278 (this as dynamic).bar; | 278 (this as dynamic).bar; |
279 } | 279 } |
280 @reflectable set foo(value) { | 280 @reflectable set foo(value) { |
281 setFooCalled.add(value); | 281 setFooCalled.add(value); |
282 (this as dynamic).bar = value; | 282 (this as dynamic).bar = value; |
283 } | 283 } |
284 } | 284 } |
285 | 285 |
| 286 @reflectable |
286 class NoSuchMethodModel { | 287 class NoSuchMethodModel { |
287 var _foo = 42; | 288 var _foo = 42; |
288 List log = []; | 289 List log = []; |
289 | 290 |
290 noSuchMethod(Invocation invocation) { | 291 noSuchMethod(Invocation invocation) { |
291 final name = invocation.memberName; | 292 final name = invocation.memberName; |
292 log.add(name); | 293 log.add(name); |
293 if (name == #foo && invocation.isGetter) return _foo; | 294 if (name == #foo && invocation.isGetter) return _foo; |
294 if (name == const Symbol('foo=')) { | 295 if (name == const Symbol('foo=')) { |
295 _foo = invocation.positionalArguments[0]; | 296 _foo = invocation.positionalArguments[0]; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 342 |
342 class WatcherModel extends Observable { | 343 class WatcherModel extends Observable { |
343 // TODO(jmesserly): dart2js does not let these be on the same line: | 344 // TODO(jmesserly): dart2js does not let these be on the same line: |
344 // @observable var a, b, c; | 345 // @observable var a, b, c; |
345 @observable var a; | 346 @observable var a; |
346 @observable var b; | 347 @observable var b; |
347 @observable var c; | 348 @observable var c; |
348 | 349 |
349 WatcherModel(); | 350 WatcherModel(); |
350 } | 351 } |
OLD | NEW |