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

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

Issue 140903003: Making readonly fields on interfaces be readonly (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 | « sdk/lib/svg/dart2js/svg_dart2js.dart ('k') | no next file » | 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 logging 10 import logging
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 ' }\n', 797 ' }\n',
798 TYPE=self._NarrowInputType(element_type)) 798 TYPE=self._NarrowInputType(element_type))
799 799
800 self.EmitListMixin(self._DartType(element_type)) 800 self.EmitListMixin(self._DartType(element_type))
801 801
802 def EmitAttribute(self, attribute, html_name, read_only): 802 def EmitAttribute(self, attribute, html_name, read_only):
803 if self._HasCustomImplementation(attribute.id): 803 if self._HasCustomImplementation(attribute.id):
804 return 804 return
805 805
806 if IsPureInterface(self._interface.id): 806 if IsPureInterface(self._interface.id):
807 self._AddInterfaceAttribute(attribute, html_name) 807 self._AddInterfaceAttribute(attribute, html_name, read_only)
808 return 808 return
809 809
810 # If the attribute is shadowing, we can't generate a shadowing 810 # If the attribute is shadowing, we can't generate a shadowing
811 # field (Issue 1633). 811 # field (Issue 1633).
812 # TODO(sra): _FindShadowedAttribute does not take into account the html 812 # TODO(sra): _FindShadowedAttribute does not take into account the html
813 # renaming. we should be looking for another attribute that has the same 813 # renaming. we should be looking for another attribute that has the same
814 # html_name. Two attributes with the same IDL name might not match if one 814 # html_name. Two attributes with the same IDL name might not match if one
815 # is renamed. 815 # is renamed.
816 (super_attribute, super_attribute_interface) = self._FindShadowedAttribute( 816 (super_attribute, super_attribute_interface) = self._FindShadowedAttribute(
817 attribute) 817 attribute)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 RENAME=rename, 863 RENAME=rename,
864 ANNOTATIONS=metadata, 864 ANNOTATIONS=metadata,
865 NAME=html_name, 865 NAME=html_name,
866 TYPE=output_type) 866 TYPE=output_type)
867 867
868 def _AddAttributeUsingProperties(self, attribute, html_name, read_only): 868 def _AddAttributeUsingProperties(self, attribute, html_name, read_only):
869 self._AddRenamingGetter(attribute, html_name) 869 self._AddRenamingGetter(attribute, html_name)
870 if not read_only: 870 if not read_only:
871 self._AddRenamingSetter(attribute, html_name) 871 self._AddRenamingSetter(attribute, html_name)
872 872
873 def _AddInterfaceAttribute(self, attribute, html_name): 873 def _AddInterfaceAttribute(self, attribute, html_name, read_only):
874 self._members_emitter.Emit( 874 self._members_emitter.Emit(
875 '\n $TYPE $NAME;' 875 '\n $QUALIFIER$TYPE $NAME;'
876 '\n', 876 '\n',
877 QUALIFIER='final ' if read_only else '',
877 NAME=html_name, 878 NAME=html_name,
878 TYPE=self.SecureOutputType(attribute.type.id)) 879 TYPE=self.SecureOutputType(attribute.type.id))
879 880
880 def _AddRenamingGetter(self, attr, html_name): 881 def _AddRenamingGetter(self, attr, html_name):
881 882
882 conversion = self._OutputConversion(attr.type.id, attr.id) 883 conversion = self._OutputConversion(attr.type.id, attr.id)
883 if conversion: 884 if conversion:
884 return self._AddConvertingGetter(attr, html_name, conversion) 885 return self._AddConvertingGetter(attr, html_name, conversion)
885 return_type = self.SecureOutputType(attr.type.id) 886 return_type = self.SecureOutputType(attr.type.id)
886 native_type = self._NarrowToImplementationType(attr.type.id) 887 native_type = self._NarrowToImplementationType(attr.type.id)
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 for library_name in libraries: 1239 for library_name in libraries:
1239 self._libraries[library_name] = DartLibrary( 1240 self._libraries[library_name] = DartLibrary(
1240 library_name, template_loader, library_type, output_dir) 1241 library_name, template_loader, library_type, output_dir)
1241 1242
1242 def AddFile(self, basename, library_name, path): 1243 def AddFile(self, basename, library_name, path):
1243 self._libraries[library_name].AddFile(path) 1244 self._libraries[library_name].AddFile(path)
1244 1245
1245 def Emit(self, emitter, auxiliary_dir): 1246 def Emit(self, emitter, auxiliary_dir):
1246 for lib in self._libraries.values(): 1247 for lib in self._libraries.values():
1247 lib.Emit(emitter, auxiliary_dir) 1248 lib.Emit(emitter, auxiliary_dir)
OLDNEW
« no previous file with comments | « sdk/lib/svg/dart2js/svg_dart2js.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698