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 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 os | 10 import os |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
910 def _HasCustomImplementation(self, member_name): | 910 def _HasCustomImplementation(self, member_name): |
911 member_name = '%s.%s' % (self._interface.doc_js_name, member_name) | 911 member_name = '%s.%s' % (self._interface.doc_js_name, member_name) |
912 return member_name in _js_custom_members | 912 return member_name in _js_custom_members |
913 | 913 |
914 def _RenamingAnnotation(self, idl_name, member_name): | 914 def _RenamingAnnotation(self, idl_name, member_name): |
915 if member_name != idl_name: | 915 if member_name != idl_name: |
916 return "@JSName('%s')\n " % idl_name | 916 return "@JSName('%s')\n " % idl_name |
917 return '' | 917 return '' |
918 | 918 |
919 def _Annotations(self, idl_type, idl_member_name): | 919 def _Annotations(self, idl_type, idl_member_name): |
920 out = '' | |
920 annotations = FindDart2JSAnnotations(idl_type, self._interface.id, | 921 annotations = FindDart2JSAnnotations(idl_type, self._interface.id, |
921 idl_member_name) | 922 idl_member_name) |
922 if annotations: | 923 if annotations: |
923 return '%s\n ' % annotations | 924 out += '%s\n ' % annotations |
blois
2013/01/12 01:21:29
out =
Andrei Mouravski
2013/01/14 22:56:46
Done.
| |
924 return_type = self.SecureOutputType(idl_type) | 925 if not AnySpecificAnnotations(idl_type, self._interface.id, idl_member_name) : |
blois
2013/01/12 01:21:29
line length
blois
2013/01/12 01:21:29
Probably rename this to AnyConversionAnnotations a
Andrei Mouravski
2013/01/14 22:56:46
Done.
Andrei Mouravski
2013/01/14 22:56:46
Done.
blois
2013/01/15 22:26:32
Undone?
| |
925 native_type = self._NarrowToImplementationType(idl_type) | 926 return_type = self.SecureOutputType(idl_type) |
926 if native_type != return_type: | 927 native_type = self._NarrowToImplementationType(idl_type) |
927 return "@Returns('%s') @Creates('%s')\n " % (native_type, native_type) | 928 if native_type != return_type: |
928 else: | 929 out += "@Returns('%s') @Creates('%s')\n " % (native_type, native_type) |
929 return '' | 930 return out |
930 | 931 |
931 def CustomJSMembers(self): | 932 def CustomJSMembers(self): |
932 return _js_custom_members | 933 return _js_custom_members |
933 | 934 |
934 def _NarrowToImplementationType(self, type_name): | 935 def _NarrowToImplementationType(self, type_name): |
935 return self._type_registry.TypeInfo(type_name).narrow_dart_type() | 936 return self._type_registry.TypeInfo(type_name).narrow_dart_type() |
936 | 937 |
937 def _NarrowInputType(self, type_name): | 938 def _NarrowInputType(self, type_name): |
938 return self._NarrowToImplementationType(type_name) | 939 return self._NarrowToImplementationType(type_name) |
939 | 940 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1036 for library_name in libraries: | 1037 for library_name in libraries: |
1037 self._libraries[library_name] = DartLibrary( | 1038 self._libraries[library_name] = DartLibrary( |
1038 library_name, template_loader, library_type, output_dir) | 1039 library_name, template_loader, library_type, output_dir) |
1039 | 1040 |
1040 def AddFile(self, basename, library_name, path): | 1041 def AddFile(self, basename, library_name, path): |
1041 self._libraries[library_name].AddFile(path) | 1042 self._libraries[library_name].AddFile(path) |
1042 | 1043 |
1043 def Emit(self, emitter, auxiliary_dir): | 1044 def Emit(self, emitter, auxiliary_dir): |
1044 for lib in self._libraries.values(): | 1045 for lib in self._libraries.values(): |
1045 lib.Emit(emitter, auxiliary_dir) | 1046 lib.Emit(emitter, auxiliary_dir) |
OLD | NEW |