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

Side by Side Diff: tools/dom/scripts/htmleventgenerator.py

Issue 12047054: Deprecating old DOM event APIs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides functionality to generate dart:html event classes.""" 6 """This module provides functionality to generate dart:html event classes."""
7 7
8 import logging 8 import logging
9 from generator import FindCommonAnnotations, FormatAnnotations 9 from generator import FindCommonAnnotations, FormatAnnotations
10 10
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 events_class_name = html_interface_name + 'Events' 533 events_class_name = html_interface_name + 'Events'
534 parent_events_class_name = self._GetParentEventsClassName(interface) 534 parent_events_class_name = self._GetParentEventsClassName(interface)
535 535
536 if not event_names: 536 if not event_names:
537 return parent_events_class_name 537 return parent_events_class_name
538 538
539 template_file = 'impl_%s.darttemplate' % events_class_name 539 template_file = 'impl_%s.darttemplate' % events_class_name
540 template = (self._template_loader.TryLoad(template_file) or 540 template = (self._template_loader.TryLoad(template_file) or
541 '\n' 541 '\n'
542 '@DocsEditable\n' 542 '@DocsEditable\n'
543 '@deprecated\n'
543 'class $CLASSNAME extends $SUPER {\n' 544 'class $CLASSNAME extends $SUPER {\n'
544 ' @DocsEditable\n' 545 ' @DocsEditable\n'
545 ' $CLASSNAME(EventTarget _ptr) : super(_ptr);\n' 546 ' $CLASSNAME(EventTarget _ptr) : super(_ptr);\n'
546 '$!MEMBERS}\n') 547 '$!MEMBERS}\n')
547 548
548 # TODO(jacobr): specify the type of _ptr as EventTarget 549 # TODO(jacobr): specify the type of _ptr as EventTarget
549 implementation_events_members = events_implementation_emitter.Emit( 550 implementation_events_members = events_implementation_emitter.Emit(
550 template, 551 template,
551 CLASSNAME=events_class_name, 552 CLASSNAME=events_class_name,
552 SUPER='%s' % parent_events_class_name) 553 SUPER='%s' % parent_events_class_name)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 parent_events_class_name = 'Events' 586 parent_events_class_name = 'Events'
586 interfaces_with_events = set() 587 interfaces_with_events = set()
587 for parent in self._database.Hierarchy(interface): 588 for parent in self._database.Hierarchy(interface):
588 if parent != interface and parent.id in self._event_classes: 589 if parent != interface and parent.id in self._event_classes:
589 parent_name = self._renamer.RenameInterface(parent) 590 parent_name = self._renamer.RenameInterface(parent)
590 parent_events_class_name = parent_name + 'Events' 591 parent_events_class_name = parent_name + 'Events'
591 interfaces_with_events.add(parent) 592 interfaces_with_events.add(parent)
592 if len(interfaces_with_events) > 1: 593 if len(interfaces_with_events) > 1:
593 raise Exception('Only one parent event class allowed ' + interface.id) 594 raise Exception('Only one parent event class allowed ' + interface.id)
594 return parent_events_class_name 595 return parent_events_class_name
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmldartgenerator.py ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698