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

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

Issue 26734004: use symbol literals instead of const ctor in packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months 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/deserialize.dart ('k') | pkg/polymer/lib/src/instance.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 * **Deprecated**: use [Polymer.register] instead. 8 * **Deprecated**: use [Polymer.register] instead.
9 * 9 *
10 * Registers a [PolymerElement]. This is similar to [registerCustomElement] 10 * Registers a [PolymerElement]. This is similar to [registerCustomElement]
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // compile list of attributes to copy to instances 230 // compile list of attributes to copy to instances
231 accumulateInstanceAttributes(); 231 accumulateInstanceAttributes();
232 // parse on-* delegates declared on `this` element 232 // parse on-* delegates declared on `this` element
233 parseHostEvents(); 233 parseHostEvents();
234 // parse on-* delegates declared in templates 234 // parse on-* delegates declared in templates
235 parseLocalEvents(); 235 parseLocalEvents();
236 // install external stylesheets as if they are inline 236 // install external stylesheets as if they are inline
237 installSheets(); 237 installSheets();
238 // TODO(jmesserly): this feels unnatrual in Dart. Since we have convenient 238 // TODO(jmesserly): this feels unnatrual in Dart. Since we have convenient
239 // lazy static initialization, can we get by without it? 239 // lazy static initialization, can we get by without it?
240 var registered = type.methods[const Symbol('registerCallback')]; 240 var registered = type.methods[#registerCallback];
241 if (registered != null && registered.isStatic && 241 if (registered != null && registered.isStatic &&
242 registered.isRegularMethod) { 242 registered.isRegularMethod) {
243 type.invoke(const Symbol('registerCallback'), [this]); 243 type.invoke(#registerCallback, [this]);
244 } 244 }
245 245
246 } 246 }
247 247
248 void registerType(String name) { 248 void registerType(String name) {
249 // TODO(jmesserly): document.register 249 // TODO(jmesserly): document.register
250 registerCustomElement(name, () => 250 registerCustomElement(name, () =>
251 type.newInstance(const Symbol(''), const []).reflectee); 251 type.newInstance(const Symbol(''), const []).reflectee);
252 } 252 }
253 253
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 } 576 }
577 577
578 return props; 578 return props;
579 } 579 }
580 580
581 bool _hasSetter(ClassMirror type, MethodMirror getter) { 581 bool _hasSetter(ClassMirror type, MethodMirror getter) {
582 var setterName = new Symbol('${MirrorSystem.getName(getter.simpleName)}='); 582 var setterName = new Symbol('${MirrorSystem.getName(getter.simpleName)}=');
583 return type.setters.containsKey(setterName); 583 return type.setters.containsKey(setterName);
584 } 584 }
585 585
586 bool _inDartHtml(ClassMirror type) => 586 bool _inDartHtml(ClassMirror type) => type.owner.simpleName == #dart.dom.html;
587 type.owner.simpleName == const Symbol('dart.dom.html');
588 587
589 588
590 /** Attribute prefix used for declarative event handlers. */ 589 /** Attribute prefix used for declarative event handlers. */
591 const _EVENT_PREFIX = 'on-'; 590 const _EVENT_PREFIX = 'on-';
592 591
593 /** Whether an attribute declares an event. */ 592 /** Whether an attribute declares an event. */
594 bool _hasEventPrefix(String attr) => attr.startsWith(_EVENT_PREFIX); 593 bool _hasEventPrefix(String attr) => attr.startsWith(_EVENT_PREFIX);
595 594
596 String _removeEventPrefix(String name) => name.substring(_EVENT_PREFIX.length); 595 String _removeEventPrefix(String name) => name.substring(_EVENT_PREFIX.length);
597 596
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return map; 703 return map;
705 }(); 704 }();
706 705
707 // Dart note: we need this function because we have additional renames JS does 706 // Dart note: we need this function because we have additional renames JS does
708 // not have. The JS renames are simply case differences, whereas we have ones 707 // not have. The JS renames are simply case differences, whereas we have ones
709 // like doubleclick -> dblclick and stripping the webkit prefix. 708 // like doubleclick -> dblclick and stripping the webkit prefix.
710 String _eventNameFromType(String eventType) { 709 String _eventNameFromType(String eventType) {
711 final result = _reverseEventTranslations[eventType]; 710 final result = _reverseEventTranslations[eventType];
712 return result != null ? result : eventType; 711 return result != null ? result : eventType;
713 } 712 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/deserialize.dart ('k') | pkg/polymer/lib/src/instance.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698