| OLD | NEW |
| 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 |
| 11 import os | 11 import os |
| 12 import re | 12 import re |
| 13 from htmlrenamer import html_interface_renames | 13 from htmlrenamer import html_interface_renames, renamed_html_members |
| 14 | 14 |
| 15 # Set up json file for retrieving comments. | 15 # Set up json file for retrieving comments. |
| 16 _current_dir = os.path.dirname(__file__) | 16 _current_dir = os.path.dirname(__file__) |
| 17 _json_path = os.path.join(_current_dir, '..', 'docs', 'docs.json') | 17 _json_path = os.path.join(_current_dir, '..', 'docs', 'docs.json') |
| 18 _dom_json = json.load(open(_json_path)) | 18 _dom_json = json.load(open(_json_path)) |
| 19 | 19 |
| 20 _pure_interfaces = set([ | 20 _pure_interfaces = set([ |
| 21 # TODO(sra): DOMStringMap should be a class implementing Map<String,String>. | 21 # TODO(sra): DOMStringMap should be a class implementing Map<String,String>. |
| 22 'DOMStringMap', | 22 'DOMStringMap', |
| 23 'ElementTimeControl', | 23 'ElementTimeControl', |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 annotations = ["@DomName('" + key + "')"] | 890 annotations = ["@DomName('" + key + "')"] |
| 891 | 891 |
| 892 # Only add this for members, so we don't add DocsEditable to templated classes | 892 # Only add this for members, so we don't add DocsEditable to templated classes |
| 893 # (they get it from the default class template) | 893 # (they get it from the default class template) |
| 894 if member_name: | 894 if member_name: |
| 895 annotations.append('@DocsEditable'); | 895 annotations.append('@DocsEditable'); |
| 896 | 896 |
| 897 if (dart_annotations.get(key) != None): | 897 if (dart_annotations.get(key) != None): |
| 898 annotations.extend(dart_annotations.get(key)) | 898 annotations.extend(dart_annotations.get(key)) |
| 899 | 899 |
| 900 if (member_name and member_name.startswith('webkit') and |
| 901 key not in renamed_html_members): |
| 902 annotations.extend(_webkit_experimental_annotations) |
| 903 |
| 900 return annotations | 904 return annotations |
| 901 | 905 |
| 902 def FindDart2JSAnnotationsAndComments(idl_type, library_name, interface_name, | 906 def FindDart2JSAnnotationsAndComments(idl_type, library_name, interface_name, |
| 903 member_name,): | 907 member_name,): |
| 904 """ Finds all annotations for Dart2JS members- including annotations for | 908 """ Finds all annotations for Dart2JS members- including annotations for |
| 905 both dart2js and dartium. | 909 both dart2js and dartium. |
| 906 """ | 910 """ |
| 907 annotations = GetAnnotationsAndComments(library_name, interface_name, member_n
ame) | 911 annotations = GetAnnotationsAndComments(library_name, interface_name, member_n
ame) |
| 908 | 912 |
| 909 ann2 = _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name) | 913 ann2 = _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name) |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 self) | 1484 self) |
| 1481 | 1485 |
| 1482 if type_data.clazz == 'SVGTearOff': | 1486 if type_data.clazz == 'SVGTearOff': |
| 1483 dart_interface_name = self._renamer.RenameInterface( | 1487 dart_interface_name = self._renamer.RenameInterface( |
| 1484 self._database.GetInterface(type_name)) | 1488 self._database.GetInterface(type_name)) |
| 1485 return SVGTearOffIDLTypeInfo( | 1489 return SVGTearOffIDLTypeInfo( |
| 1486 type_name, type_data, dart_interface_name, self) | 1490 type_name, type_data, dart_interface_name, self) |
| 1487 | 1491 |
| 1488 class_name = '%sIDLTypeInfo' % type_data.clazz | 1492 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1489 return globals()[class_name](type_name, type_data) | 1493 return globals()[class_name](type_name, type_data) |
| OLD | NEW |