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

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

Issue 12024002: Fixing cleanup of dart:html annotation generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/dart2js_impl.darttemplate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 the systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 # Generate to Dart conversion of C++ value. 742 # Generate to Dart conversion of C++ value.
743 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se lf._interface.id, ext_attrs) 743 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se lf._interface.id, ext_attrs)
744 invocation_emitter.Emit( 744 invocation_emitter.Emit(
745 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n' 745 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n'
746 ' if (returnValue)\n' 746 ' if (returnValue)\n'
747 ' Dart_SetReturnValue(args, returnValue);\n', 747 ' Dart_SetReturnValue(args, returnValue);\n',
748 TO_DART_CONVERSION=to_dart_conversion) 748 TO_DART_CONVERSION=to_dart_conversion)
749 749
750 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, 750 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
751 native_suffix, is_custom): 751 native_suffix, is_custom):
752 annotations = FindCommonAnnotations(self._interface.id, idl_name) 752 annotations = FormatAnnotations(
753 if annotations: 753 FindCommonAnnotations(self._interface.id, idl_name), ' ')
754 annotation_str = '\n ' + '\n '.join(annotations)
755 else:
756 annotation_str = ''
757 754
758 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) 755 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix)
759 self._members_emitter.Emit( 756 self._members_emitter.Emit(
760 '$ANNOTATIONS' 757 '\n'
761 '\n $DART_DECLARATION native "$NATIVE_BINDING";\n', 758 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n',
762 DOMINTERFACE=self._interface.id, 759 DOMINTERFACE=self._interface.id,
763 ANNOTATIONS=annotation_str, 760 ANNOTATIONS=annotations,
764 DART_DECLARATION=dart_declaration, 761 DART_DECLARATION=dart_declaration,
765 NATIVE_BINDING=native_binding) 762 NATIVE_BINDING=native_binding)
766 763
767 cpp_callback_name = '%s%s' % (idl_name, native_suffix) 764 cpp_callback_name = '%s%s' % (idl_name, native_suffix)
768 self._cpp_resolver_emitter.Emit( 765 self._cpp_resolver_emitter.Emit(
769 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n' 766 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n'
770 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n', 767 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n',
771 ARGC=argument_count, 768 ARGC=argument_count,
772 NATIVE_BINDING=native_binding, 769 NATIVE_BINDING=native_binding,
773 INTERFACE_NAME=self._interface.id, 770 INTERFACE_NAME=self._interface.id,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 LIBRARY_NAME=library_name) 868 LIBRARY_NAME=library_name)
872 869
873 headers = self._library_headers[library_name] 870 headers = self._library_headers[library_name]
874 for header_file in headers: 871 for header_file in headers:
875 path = os.path.relpath(header_file, output_dir) 872 path = os.path.relpath(header_file, output_dir)
876 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 873 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
877 body_emitter.Emit( 874 body_emitter.Emit(
878 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 875 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
879 ' return func;\n', 876 ' return func;\n',
880 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 877 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
OLDNEW
« no previous file with comments | « tools/dom/scripts/systemhtml.py ('k') | tools/dom/templates/dart2js_impl.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698