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

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

Issue 12094003: Readded some more HTML docs! (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: This should be good. Created 7 years, 10 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 #!/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 systems to generate 6 """This module provides shared functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import copy 9 import copy
10 import json 10 import json
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 _dom_json[library_name][interface_name]['members']): 835 _dom_json[library_name][interface_name]['members']):
836 comments = _dom_json[library_name][interface_name]['members'][member_name] 836 comments = _dom_json[library_name][interface_name]['members'][member_name]
837 elif 'comment' in _dom_json[library_name][interface_name]: 837 elif 'comment' in _dom_json[library_name][interface_name]:
838 comments = _dom_json[library_name][interface_name]['comment'] 838 comments = _dom_json[library_name][interface_name]['comment']
839 839
840 return comments 840 return comments
841 841
842 def GetAnnotationsAndComments(interface_name, member_name=None, 842 def GetAnnotationsAndComments(interface_name, member_name=None,
843 library_name=None): 843 library_name=None):
844 annotations = GetComments(interface_name, member_name, library_name) 844 annotations = GetComments(interface_name, member_name, library_name)
845 annotations.extend(FindCommonAnnotations(interface_name, member_name, 845 annotations = annotations + (FindCommonAnnotations(interface_name,
846 library_name)) 846 member_name,
847 library_name))
848
847 return annotations 849 return annotations
848 850
849 def FindCommonAnnotations(interface_name, member_name=None, library_name=None): 851 def FindCommonAnnotations(interface_name, member_name=None, library_name=None):
850 """ Finds annotations common between dart2js and dartium. 852 """ Finds annotations common between dart2js and dartium.
851 """ 853 """
852 if member_name: 854 if member_name:
853 key = '%s.%s' % (interface_name, member_name) 855 key = '%s.%s' % (interface_name, member_name)
854 else: 856 else:
855 key = interface_name 857 key = interface_name
856 858
(...skipping 27 matching lines...) Expand all
884 886
885 def AnyConversionAnnotations(idl_type, interface_name, member_name): 887 def AnyConversionAnnotations(idl_type, interface_name, member_name):
886 if (dart_annotations.get('%s.%s' % (interface_name, member_name)) or 888 if (dart_annotations.get('%s.%s' % (interface_name, member_name)) or
887 _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name)): 889 _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name)):
888 return True 890 return True
889 else: 891 else:
890 return False 892 return False
891 893
892 def FormatAnnotationsAndComments(annotations, indentation): 894 def FormatAnnotationsAndComments(annotations, indentation):
893 if annotations: 895 if annotations:
896
894 newline = '\n%s' % indentation 897 newline = '\n%s' % indentation
895 result = newline.join(annotations) + newline 898 result = newline.join(annotations) + newline
896 return result 899 return result
897 return '' 900 return ''
898 901
899 def _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name): 902 def _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name):
900 """ Finds dart2js-specific annotations. This does not include ones shared with 903 """ Finds dart2js-specific annotations. This does not include ones shared with
901 dartium. 904 dartium.
902 """ 905 """
903 ann1 = dart2js_annotations.get("%s.%s" % (interface_name, member_name)) 906 ann1 = dart2js_annotations.get("%s.%s" % (interface_name, member_name))
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 self) 1446 self)
1444 1447
1445 if type_data.clazz == 'SVGTearOff': 1448 if type_data.clazz == 'SVGTearOff':
1446 dart_interface_name = self._renamer.RenameInterface( 1449 dart_interface_name = self._renamer.RenameInterface(
1447 self._database.GetInterface(type_name)) 1450 self._database.GetInterface(type_name))
1448 return SVGTearOffIDLTypeInfo( 1451 return SVGTearOffIDLTypeInfo(
1449 type_name, type_data, dart_interface_name, self) 1452 type_name, type_data, dart_interface_name, self)
1450 1453
1451 class_name = '%sIDLTypeInfo' % type_data.clazz 1454 class_name = '%sIDLTypeInfo' % type_data.clazz
1452 return globals()[class_name](type_name, type_data) 1455 return globals()[class_name](type_name, type_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698