Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: pkg/polymer/lib/src/instance.dart

Issue 79353003: [polymer.dart] fix *Changed observers inheriting (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/lib/src/declaration.dart ('k') | pkg/polymer/test/event_handlers_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Use this annotation to publish a field as an attribute. For example: 8 * Use this annotation to publish a field as an attribute. For example:
9 * 9 *
10 * class MyPlaybackElement extends PolymerElement { 10 * class MyPlaybackElement extends PolymerElement {
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 /** Call [methodName] method on this object with [args]. */ 787 /** Call [methodName] method on this object with [args]. */
788 invokeMethod(Symbol methodName, List args) => 788 invokeMethod(Symbol methodName, List args) =>
789 _invokeMethod(this, methodName, args); 789 _invokeMethod(this, methodName, args);
790 790
791 /** Call [methodName] method on [receiver] with [args]. */ 791 /** Call [methodName] method on [receiver] with [args]. */
792 static _invokeMethod(receiver, Symbol methodName, List args) { 792 static _invokeMethod(receiver, Symbol methodName, List args) {
793 // TODO(sigmund): consider making callbacks list all arguments 793 // TODO(sigmund): consider making callbacks list all arguments
794 // explicitly. Unless VM mirrors are optimized first, this will be expensive 794 // explicitly. Unless VM mirrors are optimized first, this will be expensive
795 // once custom elements extend directly from Element (see issue 11108). 795 // once custom elements extend directly from Element (see issue 11108).
796 var receiverMirror = reflect(receiver); 796 var receiverMirror = reflect(receiver);
797 var method = receiverMirror.type.declarations[methodName]; 797 var method = _findMethod(receiverMirror.type, methodName);
798 if (method != null && method is MethodMirror) { 798 if (method != null) {
799 // This will either truncate the argument list or extend it with extra 799 // This will either truncate the argument list or extend it with extra
800 // null arguments, so it will match the signature. 800 // null arguments, so it will match the signature.
801 // TODO(sigmund): consider accepting optional arguments when we can tell 801 // TODO(sigmund): consider accepting optional arguments when we can tell
802 // them appart from named arguments (see http://dartbug.com/11334) 802 // them appart from named arguments (see http://dartbug.com/11334)
803 args.length = method.parameters.where((p) => !p.isOptional).length; 803 args.length = method.parameters.where((p) => !p.isOptional).length;
804 } 804 }
805 return receiverMirror.invoke(methodName, args).reflectee; 805 return receiverMirror.invoke(methodName, args).reflectee;
806 } 806 }
807 807
808 static MethodMirror _findMethod(ClassMirror type, Symbol name) {
809 do {
810 var member = type.declarations[name];
811 if (member is MethodMirror) return member;
812 type = type.superclass;
813 } while (type != null);
814 }
815
808 /** 816 /**
809 * Invokes a function asynchronously. 817 * Invokes a function asynchronously.
810 * This will call `Platform.flush()` and then return a `new Timer` 818 * This will call `Platform.flush()` and then return a `new Timer`
811 * with the provided [method] and [timeout]. 819 * with the provided [method] and [timeout].
812 * 820 *
813 * If you would prefer to run the callback using 821 * If you would prefer to run the callback using
814 * [window.requestAnimationFrame], see the [async] method. 822 * [window.requestAnimationFrame], see the [async] method.
815 */ 823 */
816 // Dart note: "async" is split into 2 methods so it can have a sensible type 824 // Dart note: "async" is split into 2 methods so it can have a sensible type
817 // signatures. Also removed the various features that don't make sense in a 825 // signatures. Also removed the various features that don't make sense in a
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 1081
1074 class _PropertyValue { 1082 class _PropertyValue {
1075 Object oldValue, newValue; 1083 Object oldValue, newValue;
1076 _PropertyValue(this.oldValue); 1084 _PropertyValue(this.oldValue);
1077 } 1085 }
1078 1086
1079 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions { 1087 class _PolymerExpressionsWithEventDelegate extends PolymerExpressions {
1080 prepareBinding(String path, name, node) => 1088 prepareBinding(String path, name, node) =>
1081 Polymer.prepareBinding(path, name, node, super.prepareBinding); 1089 Polymer.prepareBinding(path, name, node, super.prepareBinding);
1082 } 1090 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/src/declaration.dart ('k') | pkg/polymer/test/event_handlers_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698