| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 @reflectable set foo(value) { | 308 @reflectable set foo(value) { |
| 309 setFooCalled.add(value); | 309 setFooCalled.add(value); |
| 310 (this as dynamic).bar = value; | 310 (this as dynamic).bar = value; |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 class NoSuchMethodModel { | 314 class NoSuchMethodModel { |
| 315 var _foo = 42; | 315 var _foo = 42; |
| 316 List log = []; | 316 List log = []; |
| 317 | 317 |
| 318 noSuchMethod(Invocation invocation) { | 318 // TODO(ahe): Remove @reflectable from here (once either of |
| 319 // http://dartbug.com/15408 or http://dartbug.com/15409 are fixed). |
| 320 @reflectable noSuchMethod(Invocation invocation) { |
| 319 final name = invocation.memberName; | 321 final name = invocation.memberName; |
| 320 log.add(name); | 322 log.add(name); |
| 321 if (name == #foo && invocation.isGetter) return _foo; | 323 if (name == #foo && invocation.isGetter) return _foo; |
| 322 if (name == const Symbol('foo=')) { | 324 if (name == const Symbol('foo=')) { |
| 323 _foo = invocation.positionalArguments[0]; | 325 _foo = invocation.positionalArguments[0]; |
| 324 return null; | 326 return null; |
| 325 } | 327 } |
| 326 return super.noSuchMethod(invocation); | 328 return super.noSuchMethod(invocation); |
| 327 } | 329 } |
| 328 } | 330 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 371 |
| 370 class WatcherModel extends Observable { | 372 class WatcherModel extends Observable { |
| 371 // TODO(jmesserly): dart2js does not let these be on the same line: | 373 // TODO(jmesserly): dart2js does not let these be on the same line: |
| 372 // @observable var a, b, c; | 374 // @observable var a, b, c; |
| 373 @observable var a; | 375 @observable var a; |
| 374 @observable var b; | 376 @observable var b; |
| 375 @observable var c; | 377 @observable var c; |
| 376 | 378 |
| 377 WatcherModel(); | 379 WatcherModel(); |
| 378 } | 380 } |
| OLD | NEW |