| 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 part of polymer; | 5 part of polymer; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * **Warning**: this class is experiental and subject to change. | 8 * **Warning**: this class is experiental and subject to change. |
| 9 * | 9 * |
| 10 * The implementation for the `polymer-element` element. | 10 * The implementation for the `polymer-element` element. |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 } | 524 } |
| 525 | 525 |
| 526 DeclarationMirror _getProperty(ClassMirror cls, Symbol property) { | 526 DeclarationMirror _getProperty(ClassMirror cls, Symbol property) { |
| 527 do { | 527 do { |
| 528 var mirror = cls.declarations[property]; | 528 var mirror = cls.declarations[property]; |
| 529 if (mirror is MethodMirror && mirror.isGetter && _hasSetter(cls, mirror) | 529 if (mirror is MethodMirror && mirror.isGetter && _hasSetter(cls, mirror) |
| 530 || mirror is VariableMirror) { | 530 || mirror is VariableMirror) { |
| 531 return mirror; | 531 return mirror; |
| 532 } | 532 } |
| 533 cls = cls.superclass; | 533 cls = cls.superclass; |
| 534 } while (cls != null); | 534 |
| 535 // It's generally a good idea to stop at Object, since we know it doesn't |
| 536 // have what we want. |
| 537 // TODO(jmesserly): This is also a workaround for what appears to be a V8 |
| 538 // bug introduced between Chrome 31 and 32. After 32 |
| 539 // JsClassMirror.declarations on Object calls |
| 540 // JsClassMirror.typeVariables, which tries to get the _jsConstructor's |
| 541 // .prototype["<>"]. This ends up getting the "" property instead, maybe |
| 542 // because "<>" doesn't exist, and gets ";" which then blows up because |
| 543 // the code later on expects a List of ints. |
| 544 } while (cls != _objectType); |
| 535 return null; | 545 return null; |
| 536 } | 546 } |
| 537 | 547 |
| 538 bool _hasSetter(ClassMirror cls, MethodMirror getter) { | 548 bool _hasSetter(ClassMirror cls, MethodMirror getter) { |
| 539 var setterName = new Symbol('${MirrorSystem.getName(getter.simpleName)}='); | 549 var setterName = new Symbol('${MirrorSystem.getName(getter.simpleName)}='); |
| 540 var mirror = cls.declarations[setterName]; | 550 var mirror = cls.declarations[setterName]; |
| 541 return mirror is MethodMirror && mirror.isSetter; | 551 return mirror is MethodMirror && mirror.isSetter; |
| 542 } | 552 } |
| 543 | 553 |
| 544 | 554 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 return map; | 650 return map; |
| 641 }(); | 651 }(); |
| 642 | 652 |
| 643 // Dart note: we need this function because we have additional renames JS does | 653 // Dart note: we need this function because we have additional renames JS does |
| 644 // not have. The JS renames are simply case differences, whereas we have ones | 654 // not have. The JS renames are simply case differences, whereas we have ones |
| 645 // like doubleclick -> dblclick and stripping the webkit prefix. | 655 // like doubleclick -> dblclick and stripping the webkit prefix. |
| 646 String _eventNameFromType(String eventType) { | 656 String _eventNameFromType(String eventType) { |
| 647 final result = _reverseEventTranslations[eventType]; | 657 final result = _reverseEventTranslations[eventType]; |
| 648 return result != null ? result : eventType; | 658 return result != null ? result : eventType; |
| 649 } | 659 } |
| OLD | NEW |