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

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

Issue 12087112: Can now correctly add documentation to constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 ], 819 ],
820 } 820 }
821 821
822 def GetComments(interface_name, member_name=None, library_name=None): 822 def GetComments(interface_name, member_name=None, library_name=None):
823 """ Finds all comments for the interface or member and returns a list. """ 823 """ Finds all comments for the interface or member and returns a list. """
824 824
825 # Add documentation from JSON. 825 # Add documentation from JSON.
826 comments = [] 826 comments = []
827 827
828 if library_name in _dom_json and interface_name in _dom_json[library_name]: 828 if library_name in _dom_json and interface_name in _dom_json[library_name]:
829 if member_name and (member_name in 829 if (member_name and 'members' in _dom_json[library_name][interface_name] and
830 _dom_json[library_name][interface_name]['members']): 830 (member_name in _dom_json[library_name][interface_name]['members'])):
831 comments = _dom_json[library_name][interface_name]['members'][member_name] 831 comments = _dom_json[library_name][interface_name]['members'][member_name]
832 elif 'comment' in _dom_json[library_name][interface_name]: 832 elif 'comment' in _dom_json[library_name][interface_name]:
833 comments = _dom_json[library_name][interface_name]['comment'] 833 comments = _dom_json[library_name][interface_name]['comment']
834 834
835 if (len(comments)): 835 if (len(comments)):
836 comments = ['\n'.join(comments)] 836 comments = ['\n'.join(comments)]
837 837
838 return comments 838 return comments
839 839
840 def GetAnnotationsAndComments(interface_name, member_name=None, 840 def GetAnnotationsAndComments(interface_name, member_name=None,
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 self) 1444 self)
1445 1445
1446 if type_data.clazz == 'SVGTearOff': 1446 if type_data.clazz == 'SVGTearOff':
1447 dart_interface_name = self._renamer.RenameInterface( 1447 dart_interface_name = self._renamer.RenameInterface(
1448 self._database.GetInterface(type_name)) 1448 self._database.GetInterface(type_name))
1449 return SVGTearOffIDLTypeInfo( 1449 return SVGTearOffIDLTypeInfo(
1450 type_name, type_data, dart_interface_name, self) 1450 type_name, type_data, dart_interface_name, self)
1451 1451
1452 class_name = '%sIDLTypeInfo' % type_data.clazz 1452 class_name = '%sIDLTypeInfo' % type_data.clazz
1453 return globals()[class_name](type_name, type_data) 1453 return globals()[class_name](type_name, type_data)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698