| 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, renamed_html_members | 13 from htmlrenamer import html_interface_renames |
| 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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 annotations = ["@DomName('" + key + "')"] | 885 annotations = ["@DomName('" + key + "')"] |
| 886 | 886 |
| 887 # Only add this for members, so we don't add DocsEditable to templated classes | 887 # Only add this for members, so we don't add DocsEditable to templated classes |
| 888 # (they get it from the default class template) | 888 # (they get it from the default class template) |
| 889 if member_name: | 889 if member_name: |
| 890 annotations.append('@DocsEditable'); | 890 annotations.append('@DocsEditable'); |
| 891 | 891 |
| 892 if (dart_annotations.get(key) != None): | 892 if (dart_annotations.get(key) != None): |
| 893 annotations.extend(dart_annotations.get(key)) | 893 annotations.extend(dart_annotations.get(key)) |
| 894 | 894 |
| 895 if (member_name and member_name.startswith('webkit') and | |
| 896 key not in renamed_html_members): | |
| 897 annotations.extend(_webkit_experimental_annotations) | |
| 898 | |
| 899 return annotations | 895 return annotations |
| 900 | 896 |
| 901 def FindDart2JSAnnotationsAndComments(idl_type, library_name, interface_name, | 897 def FindDart2JSAnnotationsAndComments(idl_type, library_name, interface_name, |
| 902 member_name,): | 898 member_name,): |
| 903 """ Finds all annotations for Dart2JS members- including annotations for | 899 """ Finds all annotations for Dart2JS members- including annotations for |
| 904 both dart2js and dartium. | 900 both dart2js and dartium. |
| 905 """ | 901 """ |
| 906 annotations = GetAnnotationsAndComments(library_name, interface_name, member_n
ame) | 902 annotations = GetAnnotationsAndComments(library_name, interface_name, member_n
ame) |
| 907 | 903 |
| 908 ann2 = _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name) | 904 ann2 = _FindDart2JSSpecificAnnotations(idl_type, interface_name, member_name) |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 self) | 1475 self) |
| 1480 | 1476 |
| 1481 if type_data.clazz == 'SVGTearOff': | 1477 if type_data.clazz == 'SVGTearOff': |
| 1482 dart_interface_name = self._renamer.RenameInterface( | 1478 dart_interface_name = self._renamer.RenameInterface( |
| 1483 self._database.GetInterface(type_name)) | 1479 self._database.GetInterface(type_name)) |
| 1484 return SVGTearOffIDLTypeInfo( | 1480 return SVGTearOffIDLTypeInfo( |
| 1485 type_name, type_data, dart_interface_name, self) | 1481 type_name, type_data, dart_interface_name, self) |
| 1486 | 1482 |
| 1487 class_name = '%sIDLTypeInfo' % type_data.clazz | 1483 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1488 return globals()[class_name](type_name, type_data) | 1484 return globals()[class_name](type_name, type_data) |
| OLD | NEW |