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

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

Issue 180273004: Fixes in smoke, which in turn should fix todomvc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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
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 * **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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 ..text = cssText 448 ..text = cssText
449 ..attributes[_STYLE_SCOPE_ATTRIBUTE] = '$name-$scopeDescriptor'; 449 ..attributes[_STYLE_SCOPE_ATTRIBUTE] = '$name-$scopeDescriptor';
450 } 450 }
451 451
452 /** 452 /**
453 * Fetch a list of all *Changed methods so we can observe the associated 453 * Fetch a list of all *Changed methods so we can observe the associated
454 * properties. 454 * properties.
455 */ 455 */
456 void inferObservers() { 456 void inferObservers() {
457 var options = const smoke.QueryOptions(includeFields: false, 457 var options = const smoke.QueryOptions(includeFields: false,
458 includeProperties: false, includeMethods: true, includeInherited: true); 458 includeProperties: false, includeMethods: true, includeInherited: true,
459 includeUpTo: HtmlElement);
Siggi Cherem (dart-lang) 2014/02/25 23:23:23 this API change was not needed to fix things, but
Jennifer Messerly 2014/02/25 23:50:09 Very nice!
459 for (var decl in smoke.query(_type, options)) { 460 for (var decl in smoke.query(_type, options)) {
460 String name = smoke.symbolToName(decl.name); 461 String name = smoke.symbolToName(decl.name);
461 if (name.endsWith(_OBSERVE_SUFFIX) && name != 'attributeChanged') { 462 if (name.endsWith(_OBSERVE_SUFFIX) && name != 'attributeChanged') {
462 // TODO(jmesserly): now that we have a better system, should we 463 // TODO(jmesserly): now that we have a better system, should we
463 // deprecate *Changed methods? 464 // deprecate *Changed methods?
464 if (_observe == null) _observe = new HashMap(); 465 if (_observe == null) _observe = new HashMap();
465 name = name.substring(0, name.length - 7); 466 name = name.substring(0, name.length - 7);
466 _observe[new PropertyPath(name)] = [decl.name]; 467 _observe[new PropertyPath(name)] = [decl.name];
467 } 468 }
468 } 469 }
469 } 470 }
470 471
471 /** 472 /**
472 * Fetch a list of all methods annotated with [ObserveProperty] so we can 473 * Fetch a list of all methods annotated with [ObserveProperty] so we can
473 * observe the associated properties. 474 * observe the associated properties.
474 */ 475 */
475 void explodeObservers() { 476 void explodeObservers() {
476 var options = const smoke.QueryOptions(includeFields: false, 477 var options = const smoke.QueryOptions(includeFields: false,
477 includeProperties: false, includeMethods: true, includeInherited: true, 478 includeProperties: false, includeMethods: true, includeInherited: true,
478 withAnnotations: const [ObserveProperty]); 479 includeUpTo: HtmlElement, withAnnotations: const [ObserveProperty]);
479 for (var decl in smoke.query(_type, options)) { 480 for (var decl in smoke.query(_type, options)) {
480 for (var meta in decl.annotations) { 481 for (var meta in decl.annotations) {
481 if (meta is! ObserveProperty) continue; 482 if (meta is! ObserveProperty) continue;
482 if (_observe == null) _observe = new HashMap(); 483 if (_observe == null) _observe = new HashMap();
483 for (String name in meta.names) { 484 for (String name in meta.names) {
484 _observe.putIfAbsent(new PropertyPath(name), () => []).add(decl.name); 485 _observe.putIfAbsent(new PropertyPath(name), () => []).add(decl.name);
485 } 486 }
486 } 487 }
487 } 488 }
488 } 489 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 529
529 /// track document.register'ed tag names and their declarations 530 /// track document.register'ed tag names and their declarations
530 final Map _declarations = new Map<String, PolymerDeclaration>(); 531 final Map _declarations = new Map<String, PolymerDeclaration>();
531 532
532 bool _isRegistered(String name) => _declarations.containsKey(name); 533 bool _isRegistered(String name) => _declarations.containsKey(name);
533 PolymerDeclaration _getDeclaration(String name) => _declarations[name]; 534 PolymerDeclaration _getDeclaration(String name) => _declarations[name];
534 535
535 Map<PropertyPath, smoke.Declaration> _getPublishedProperties( 536 Map<PropertyPath, smoke.Declaration> _getPublishedProperties(
536 Type type, Map<PropertyPath, smoke.Declaration> props) { 537 Type type, Map<PropertyPath, smoke.Declaration> props) {
537 var options = const smoke.QueryOptions(includeInherited: true, 538 var options = const smoke.QueryOptions(includeInherited: true,
538 withAnnotations: const [PublishedProperty]); 539 includeUpTo: HtmlElement, withAnnotations: const [PublishedProperty]);
539 for (var decl in smoke.query(type, options)) { 540 for (var decl in smoke.query(type, options)) {
540 if (decl.isFinal) continue; 541 if (decl.isFinal) continue;
541 if (props == null) props = {}; 542 if (props == null) props = {};
542 props[new PropertyPath([decl.name])] = decl; 543 props[new PropertyPath([decl.name])] = decl;
543 } 544 }
544 return props; 545 return props;
545 } 546 }
546 547
547 /** Attribute prefix used for declarative event handlers. */ 548 /** Attribute prefix used for declarative event handlers. */
548 const _EVENT_PREFIX = 'on-'; 549 const _EVENT_PREFIX = 'on-';
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 645
645 // Dart note: we need this function because we have additional renames JS does 646 // Dart note: we need this function because we have additional renames JS does
646 // not have. The JS renames are simply case differences, whereas we have ones 647 // not have. The JS renames are simply case differences, whereas we have ones
647 // like doubleclick -> dblclick and stripping the webkit prefix. 648 // like doubleclick -> dblclick and stripping the webkit prefix.
648 String _eventNameFromType(String eventType) { 649 String _eventNameFromType(String eventType) {
649 final result = _reverseEventTranslations[eventType]; 650 final result = _reverseEventTranslations[eventType];
650 return result != null ? result : eventType; 651 return result != null ? result : eventType;
651 } 652 }
652 653
653 final _ATTRIBUTES_REGEX = new RegExp(r'\s|,'); 654 final _ATTRIBUTES_REGEX = new RegExp(r'\s|,');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698