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

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

Issue 11970019: Change /// @docsEditable to @DocsEditable annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Template removal stuff. 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/htmleventgenerator.py ('k') | tools/dom/templates/dart2js_impl.darttemplate » ('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 import emitter 9 import emitter
10 import os 10 import os
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 # conversion code. 644 # conversion code.
645 if (self._OutputConversion(attribute.type.id, attribute.id) or 645 if (self._OutputConversion(attribute.type.id, attribute.id) or
646 self._InputConversion(attribute.type.id, attribute.id)): 646 self._InputConversion(attribute.type.id, attribute.id)):
647 self._AddAttributeUsingProperties(attribute, html_name, read_only) 647 self._AddAttributeUsingProperties(attribute, html_name, read_only)
648 return 648 return
649 649
650 output_type = self.SecureOutputType(attribute.type.id) 650 output_type = self.SecureOutputType(attribute.type.id)
651 input_type = self._NarrowInputType(attribute.type.id) 651 input_type = self._NarrowInputType(attribute.type.id)
652 annotations = self._Annotations(attribute.type.id, attribute.id) 652 annotations = self._Annotations(attribute.type.id, attribute.id)
653 rename = self._RenamingAnnotation(attribute.id, html_name) 653 rename = self._RenamingAnnotation(attribute.id, html_name)
654 self.EmitAttributeDocumentation(attribute)
655 if not read_only: 654 if not read_only:
656 self._members_emitter.Emit( 655 self._members_emitter.Emit(
657 '\n $RENAME$ANNOTATIONS$TYPE $NAME;' 656 '\n $RENAME$ANNOTATIONS$TYPE $NAME;'
658 '\n', 657 '\n',
659 RENAME=rename, 658 RENAME=rename,
660 ANNOTATIONS=annotations, 659 ANNOTATIONS=annotations,
661 NAME=html_name, 660 NAME=html_name,
662 TYPE=output_type) 661 TYPE=output_type)
663 else: 662 else:
664 template = '\n $RENAME$(ANNOTATIONS)final $TYPE $NAME;\n' 663 template = '\n $RENAME$(ANNOTATIONS)final $TYPE $NAME;\n'
(...skipping 15 matching lines...) Expand all
680 self._AddRenamingSetter(attribute, html_name) 679 self._AddRenamingSetter(attribute, html_name)
681 680
682 def _AddInterfaceAttribute(self, attribute, html_name): 681 def _AddInterfaceAttribute(self, attribute, html_name):
683 self._members_emitter.Emit( 682 self._members_emitter.Emit(
684 '\n $TYPE $NAME;' 683 '\n $TYPE $NAME;'
685 '\n', 684 '\n',
686 NAME=html_name, 685 NAME=html_name,
687 TYPE=self.SecureOutputType(attribute.type.id)) 686 TYPE=self.SecureOutputType(attribute.type.id))
688 687
689 def _AddRenamingGetter(self, attr, html_name): 688 def _AddRenamingGetter(self, attr, html_name):
690 self.EmitAttributeDocumentation(attr)
691 689
692 conversion = self._OutputConversion(attr.type.id, attr.id) 690 conversion = self._OutputConversion(attr.type.id, attr.id)
693 if conversion: 691 if conversion:
694 return self._AddConvertingGetter(attr, html_name, conversion) 692 return self._AddConvertingGetter(attr, html_name, conversion)
695 return_type = self.SecureOutputType(attr.type.id) 693 return_type = self.SecureOutputType(attr.type.id)
696 native_type = self._NarrowToImplementationType(attr.type.id) 694 native_type = self._NarrowToImplementationType(attr.type.id)
697 self._members_emitter.Emit( 695 self._members_emitter.Emit(
698 # TODO(sra): Use metadata to provide native name. 696 # TODO(sra): Use metadata to provide native name.
699 '\n $TYPE get $HTML_NAME => JS("$NATIVE_TYPE", "#.$NAME", this);' 697 '\n $TYPE get $HTML_NAME => JS("$NATIVE_TYPE", "#.$NAME", this);'
700 '\n', 698 '\n',
701 HTML_NAME=html_name, 699 HTML_NAME=html_name,
702 NAME=attr.id, 700 NAME=attr.id,
703 TYPE=return_type, 701 TYPE=return_type,
704 NATIVE_TYPE=native_type) 702 NATIVE_TYPE=native_type)
705 703
706 def _AddRenamingSetter(self, attr, html_name): 704 def _AddRenamingSetter(self, attr, html_name):
707 self.EmitAttributeDocumentation(attr)
708 705
709 conversion = self._InputConversion(attr.type.id, attr.id) 706 conversion = self._InputConversion(attr.type.id, attr.id)
710 if conversion: 707 if conversion:
711 return self._AddConvertingSetter(attr, html_name, conversion) 708 return self._AddConvertingSetter(attr, html_name, conversion)
712 self._members_emitter.Emit( 709 self._members_emitter.Emit(
713 # TODO(sra): Use metadata to provide native name. 710 # TODO(sra): Use metadata to provide native name.
714 '\n void set $HTML_NAME($TYPE value) {' 711 '\n void set $HTML_NAME($TYPE value) {'
715 '\n JS("void", "#.$NAME = #", this, value);' 712 '\n JS("void", "#.$NAME = #", this, value);'
716 '\n }' 713 '\n }'
717 '\n', 714 '\n',
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 pass 749 pass
753 750
754 def EmitOperation(self, info, html_name): 751 def EmitOperation(self, info, html_name):
755 """ 752 """
756 Arguments: 753 Arguments:
757 info: An OperationInfo object. 754 info: An OperationInfo object.
758 """ 755 """
759 if self._HasCustomImplementation(info.name): 756 if self._HasCustomImplementation(info.name):
760 return 757 return
761 758
762 self.EmitOperationDocumentation(info)
763
764 if IsPureInterface(self._interface.id): 759 if IsPureInterface(self._interface.id):
765 self._AddInterfaceOperation(info, html_name) 760 self._AddInterfaceOperation(info, html_name)
766 elif any(self._OperationRequiresConversions(op) for op in info.overloads): 761 elif any(self._OperationRequiresConversions(op) for op in info.overloads):
767 # Any conversions needed? 762 # Any conversions needed?
768 self._AddOperationWithConversions(info, html_name) 763 self._AddOperationWithConversions(info, html_name)
769 else: 764 else:
770 self._AddDirectNativeOperation(info, html_name) 765 self._AddDirectNativeOperation(info, html_name)
771 766
772 def _AddDirectNativeOperation(self, info, html_name): 767 def _AddDirectNativeOperation(self, info, html_name):
773 self._members_emitter.Emit( 768 self._members_emitter.Emit(
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 for library_name in libraries: 1048 for library_name in libraries:
1054 self._libraries[library_name] = DartLibrary( 1049 self._libraries[library_name] = DartLibrary(
1055 library_name, template_loader, library_type, output_dir) 1050 library_name, template_loader, library_type, output_dir)
1056 1051
1057 def AddFile(self, basename, library_name, path): 1052 def AddFile(self, basename, library_name, path):
1058 self._libraries[library_name].AddFile(path) 1053 self._libraries[library_name].AddFile(path)
1059 1054
1060 def Emit(self, emitter, auxiliary_dir): 1055 def Emit(self, emitter, auxiliary_dir):
1061 for lib in self._libraries.values(): 1056 for lib in self._libraries.values():
1062 lib.Emit(emitter, auxiliary_dir) 1057 lib.Emit(emitter, auxiliary_dir)
OLDNEW
« no previous file with comments | « tools/dom/scripts/htmleventgenerator.py ('k') | tools/dom/templates/dart2js_impl.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698