OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library polymer.src.micro.properties; | 4 library polymer.src.micro.properties; |
5 | 5 |
6 import 'dart:js'; | 6 import 'dart:js'; |
7 import 'package:reflectable/reflectable.dart'; | 7 import 'package:reflectable/reflectable.dart'; |
8 import 'behavior.dart'; | 8 import 'behavior.dart'; |
9 import 'declarations.dart'; | 9 import 'declarations.dart'; |
10 import 'js_proxy.dart'; | 10 import 'js_proxy.dart'; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 _throwInvalidMixinOrder(type, clazz); | 235 _throwInvalidMixinOrder(type, clazz); |
236 } | 236 } |
237 }); | 237 }); |
238 } | 238 } |
239 checkAndRemoveSuperInterfaces(behavior); | 239 checkAndRemoveSuperInterfaces(behavior); |
240 | 240 |
241 // Get the js object for the behavior from the annotation, and add it. | 241 // Get the js object for the behavior from the annotation, and add it. |
242 finalBehaviors.add(behavior); | 242 finalBehaviors.add(behavior); |
243 } | 243 } |
244 | 244 |
245 return finalBehaviors.map((ClassMirror behavior) { | 245 return <JsObject>[_polymerDart['Behavior']] |
Siggi Cherem (dart-lang)
2015/09/17 21:11:59
maybe we should rename Polymer.Dart.Behavior to so
jakemac
2015/09/23 17:37:08
Changed to InteropBehavior
| |
246 BehaviorAnnotation meta = behavior.metadata.firstWhere(_isBehavior); | 246 ..addAll(finalBehaviors.map((ClassMirror behavior) { |
247 return meta.getBehavior(behavior.reflectedType); | 247 BehaviorAnnotation meta = behavior.metadata.firstWhere(_isBehavior); |
248 }); | 248 return meta.getBehavior(behavior.reflectedType); |
249 })); | |
249 } | 250 } |
250 | 251 |
251 // Throws an error about expected mixins that must precede the [clazz] mixin. | 252 // Throws an error about expected mixins that must precede the [clazz] mixin. |
252 void _throwInvalidMixinOrder(Type type, ClassMirror mixin) { | 253 void _throwInvalidMixinOrder(Type type, ClassMirror mixin) { |
253 var expected = mixin.superinterfaces | 254 var expected = mixin.superinterfaces |
254 .where(_hasBehaviorMeta) | 255 .where(_hasBehaviorMeta) |
255 .map((clazz) => clazz.simpleName) | 256 .map((clazz) => clazz.simpleName) |
256 .join(', '); | 257 .join(', '); |
257 throw 'Unexpected mixin ordering on type $type. The ${mixin.simpleName} mixin ' | 258 throw 'Unexpected mixin ordering on type $type. The ${mixin.simpleName} mixin ' |
258 'must be immediately preceded by the following mixins, in this order: ' | 259 'must be immediately preceded by the following mixins, in this order: ' |
(...skipping 22 matching lines...) Expand all Loading... | |
281 case 'String': | 282 case 'String': |
282 return context['String']; | 283 return context['String']; |
283 case 'Map': | 284 case 'Map': |
284 case 'JsObject': | 285 case 'JsObject': |
285 return context['Object']; | 286 return context['Object']; |
286 default: | 287 default: |
287 // Just return the Dart type | 288 // Just return the Dart type |
288 return type; | 289 return type; |
289 } | 290 } |
290 } | 291 } |
OLD | NEW |