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

Side by Side Diff: lib/dom/scripts/systemhtml.py

Issue 9997003: Add back @domName annotations to dart:html (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated dom and html after sync Created 8 years, 8 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 | « lib/dom/frog/dom_frog.dart ('k') | lib/html/dartium/html_dartium.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 #!/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 shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 from systemfrog import * 9 from systemfrog import *
10 from systeminterface import * 10 from systeminterface import *
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 664
665 emit_events, events = self._shared.GetEventAttributes(self._interface) 665 emit_events, events = self._shared.GetEventAttributes(self._interface)
666 if not emit_events: 666 if not emit_events:
667 return 667 return
668 elif events: 668 elif events:
669 self.AddEventAttributes(events) 669 self.AddEventAttributes(events)
670 else: 670 else:
671 self._EmitEventGetter(self._shared.GetParentEventsClass(self._interface)) 671 self._EmitEventGetter(self._shared.GetParentEventsClass(self._interface))
672 672
673 def AddAttribute(self, getter, setter): 673 def AddAttribute(self, getter, setter):
674 dom_name = DartDomNameOfAttribute(getter)
674 html_getter_name = self._shared.RenameInHtmlLibrary( 675 html_getter_name = self._shared.RenameInHtmlLibrary(
675 self._interface, DartDomNameOfAttribute(getter), 'get:') 676 self._interface, dom_name, 'get:')
676 html_setter_name = self._shared.RenameInHtmlLibrary( 677 html_setter_name = self._shared.RenameInHtmlLibrary(
677 self._interface, DartDomNameOfAttribute(getter), 'set:') 678 self._interface, dom_name, 'set:')
678 679
679 if not html_getter_name or self._shared.IsPrivate(html_getter_name): 680 if not html_getter_name or self._shared.IsPrivate(html_getter_name):
680 getter = None 681 getter = None
681 if not html_setter_name or self._shared.IsPrivate(html_setter_name): 682 if not html_setter_name or self._shared.IsPrivate(html_setter_name):
682 setter = None 683 setter = None
683 if not getter and not setter: 684 if not getter and not setter:
684 return 685 return
685 686
686 # We don't yet handle inconsistent renames of the getter and setter yet. 687 # We don't yet handle inconsistent renames of the getter and setter yet.
687 if html_getter_name and html_setter_name: 688 if html_getter_name and html_setter_name:
688 assert html_getter_name == html_setter_name 689 assert html_getter_name == html_setter_name
690 if html_getter_name != dom_name:
691 self._members_emitter.Emit('\n /** @domName $DOMNAME */',
692 DOMNAME = dom_name)
689 if (getter and setter and 693 if (getter and setter and
690 DartType(getter.type.id) == DartType(setter.type.id)): 694 DartType(getter.type.id) == DartType(setter.type.id)):
691 self._members_emitter.Emit('\n $TYPE $NAME;\n', 695 self._members_emitter.Emit('\n $TYPE $NAME;\n',
692 NAME=html_getter_name, 696 NAME=html_getter_name,
693 TYPE=DartType(getter.type.id)); 697 TYPE=DartType(getter.type.id));
694 return 698 return
695 if getter and not setter: 699 if getter and not setter:
696 self._members_emitter.Emit('\n final $TYPE $NAME;\n', 700 self._members_emitter.Emit('\n final $TYPE $NAME;\n',
697 NAME=html_getter_name, 701 NAME=html_getter_name,
698 TYPE=DartType(getter.type.id)); 702 TYPE=DartType(getter.type.id));
699 return 703 return
700 raise Exception('Unexpected getter/setter combination %s %s' % 704 raise Exception('Unexpected getter/setter combination %s %s' %
701 (getter, setter)) 705 (getter, setter))
702 706
703 def AddOperation(self, info): 707 def AddOperation(self, info):
704 """ 708 """
705 Arguments: 709 Arguments:
706 operations - contains the overloads, one or more operations with the same 710 operations - contains the overloads, one or more operations with the same
707 name. 711 name.
708 """ 712 """
709 html_name = self._shared.RenameInHtmlLibrary( 713 html_name = self._shared.RenameInHtmlLibrary(
710 self._interface, info.name) 714 self._interface, info.name)
711 if html_name and not self._shared.IsPrivate(html_name): 715 if html_name and not self._shared.IsPrivate(html_name):
716 if html_name != info.name:
717 self._members_emitter.Emit('\n /** @domName $DOMNAME */',
718 DOMNAME = info.name)
719
712 self._members_emitter.Emit('\n' 720 self._members_emitter.Emit('\n'
713 ' $TYPE $NAME($PARAMS);\n', 721 ' $TYPE $NAME($PARAMS);\n',
714 TYPE=info.type_name, 722 TYPE=info.type_name,
715 NAME=html_name, 723 NAME=html_name,
716 PARAMS=info.ParametersInterfaceDeclaration()) 724 PARAMS=info.ParametersInterfaceDeclaration())
717 725
718 def FinishInterface(self): 726 def FinishInterface(self):
719 pass 727 pass
720 728
721 def AddConstant(self, constant): 729 def AddConstant(self, constant):
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee 1645 # dispatch has removed f(X), leaving only f(Y), but there is no guarantee
1638 # that Y = Z-X, so we need to check for Y. 1646 # that Y = Z-X, so we need to check for Y.
1639 true_code = emitter.Emit( 1647 true_code = emitter.Emit(
1640 '$(INDENT)if ($COND) {\n' 1648 '$(INDENT)if ($COND) {\n'
1641 '$!TRUE' 1649 '$!TRUE'
1642 '$(INDENT)}\n', 1650 '$(INDENT)}\n',
1643 COND=test, INDENT=indent) 1651 COND=test, INDENT=indent)
1644 self.GenerateDispatch( 1652 self.GenerateDispatch(
1645 true_code, info, indent + ' ', position + 1, positive) 1653 true_code, info, indent + ' ', position + 1, positive)
1646 return True 1654 return True
OLDNEW
« no previous file with comments | « lib/dom/frog/dom_frog.dart ('k') | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698