| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:barback/barback.dart'; | 6 import 'package:barback/barback.dart'; |
| 7 import 'package:observe/transform.dart'; | 7 import 'package:observe/transform.dart'; |
| 8 import 'package:unittest/compact_vm_config.dart'; | 8 import 'package:unittest/compact_vm_config.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 | 10 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 class A extends ObservableBase { | 153 class A extends ObservableBase { |
| 154 @$annotation int foo; | 154 @$annotation int foo; |
| 155 A(this.foo); | 155 A(this.foo); |
| 156 } | 156 } |
| 157 '''; | 157 '''; |
| 158 | 158 |
| 159 String _sampleObservableOutput(String annotation) => | 159 String _sampleObservableOutput(String annotation) => |
| 160 "library A_foo;\n" | 160 "library A_foo;\n" |
| 161 "import 'package:observe/observe.dart';\n\n" | 161 "import 'package:observe/observe.dart';\n\n" |
| 162 "class A extends ChangeNotifierBase {\n" | 162 "class A extends ChangeNotifierBase {\n" |
| 163 " @$annotation int get foo => __\$foo; int __\$foo; " | 163 " @reflectable @$annotation int get foo => __\$foo; int __\$foo; " |
| 164 "${_makeSetter('int', 'foo')}\n" | 164 "${_makeSetter('int', 'foo')}\n" |
| 165 " A(foo) : __\$foo = foo;\n" | 165 " A(foo) : __\$foo = foo;\n" |
| 166 "}\n"; | 166 "}\n"; |
| 167 | 167 |
| 168 _makeSetter(type, name) => 'set $name($type value) { ' | 168 _makeSetter(type, name) => '@reflectable set $name($type value) { ' |
| 169 '__\$$name = notifyPropertyChange(#$name, __\$$name, value); }'; | 169 '__\$$name = notifyPropertyChange(#$name, __\$$name, value); }'; |
| 170 | 170 |
| 171 String _complexObservable(String annotation) => ''' | 171 String _complexObservable(String annotation) => ''' |
| 172 class Foo extends ObservableBase { | 172 class Foo extends ObservableBase { |
| 173 @$annotation | 173 @$annotation |
| 174 @otherMetadata | 174 @otherMetadata |
| 175 Foo | 175 Foo |
| 176 foo/*D*/= 1, bar =/*A*/2/*B*/, | 176 foo/*D*/= 1, bar =/*A*/2/*B*/, |
| 177 quux/*C*/; | 177 quux/*C*/; |
| 178 | 178 |
| 179 @$annotation var baz; | 179 @$annotation var baz; |
| 180 } | 180 } |
| 181 '''; | 181 '''; |
| 182 | 182 |
| 183 String _complexObservableOutput(String annotation) => | 183 String _complexObservableOutput(String meta) => |
| 184 "class Foo extends ChangeNotifierBase {\n" | 184 "class Foo extends ChangeNotifierBase {\n" |
| 185 " @$annotation\n" | 185 " @reflectable @$meta\n" |
| 186 " @otherMetadata\n" | 186 " @otherMetadata\n" |
| 187 " Foo\n" | 187 " Foo\n" |
| 188 " get foo => __\$foo; Foo __\$foo/*D*/= 1; " | 188 " get foo => __\$foo; Foo __\$foo/*D*/= 1; " |
| 189 "${_makeSetter('Foo', 'foo')} " | 189 "${_makeSetter('Foo', 'foo')} " |
| 190 "@$annotation @otherMetadata Foo get bar => __\$bar; " | 190 "@reflectable @$meta @otherMetadata Foo get bar => __\$bar; " |
| 191 "Foo __\$bar =/*A*/2/*B*/; ${_makeSetter('Foo', 'bar')}\n" | 191 "Foo __\$bar =/*A*/2/*B*/; ${_makeSetter('Foo', 'bar')}\n" |
| 192 " @$annotation @otherMetadata Foo get quux => __\$quux; " | 192 " @reflectable @$meta @otherMetadata Foo get quux => __\$quux; " |
| 193 "Foo __\$quux/*C*/; ${_makeSetter('Foo', 'quux')}\n\n" | 193 "Foo __\$quux/*C*/; ${_makeSetter('Foo', 'quux')}\n\n" |
| 194 " @$annotation dynamic get baz => __\$baz; dynamic __\$baz; " | 194 " @reflectable @$meta dynamic get baz => __\$baz; dynamic __\$baz; " |
| 195 "${_makeSetter('dynamic', 'baz')}\n" | 195 "${_makeSetter('dynamic', 'baz')}\n" |
| 196 "}\n"; | 196 "}\n"; |
| OLD | NEW |