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

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

Issue 11968047: Fixing formatting of dart:html's dart2js annotations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: CR feedback. 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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 # Generate to Dart conversion of C++ value. 747 # Generate to Dart conversion of C++ value.
748 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se lf._interface.id, ext_attrs) 748 to_dart_conversion = return_type_info.to_dart_conversion(function_call, se lf._interface.id, ext_attrs)
749 invocation_emitter.Emit( 749 invocation_emitter.Emit(
750 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n' 750 ' Dart_Handle returnValue = $TO_DART_CONVERSION;\n'
751 ' if (returnValue)\n' 751 ' if (returnValue)\n'
752 ' Dart_SetReturnValue(args, returnValue);\n', 752 ' Dart_SetReturnValue(args, returnValue);\n',
753 TO_DART_CONVERSION=to_dart_conversion) 753 TO_DART_CONVERSION=to_dart_conversion)
754 754
755 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, 755 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
756 native_suffix, is_custom): 756 native_suffix, is_custom):
757 annotations = FindCommonAnnotations(self._interface.id, idl_name) 757 annotations = FormatAnnotations(
758 if annotations: 758 FindCommonAnnotations(self._interface.id, idl_name), ' ')
759 annotation_str = '\n ' + '\n '.join(annotations)
760 else:
761 annotation_str = ''
762 759
763 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) 760 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix)
764 self._members_emitter.Emit( 761 self._members_emitter.Emit(
765 '$ANNOTATIONS' 762 '\n'
766 '\n $DART_DECLARATION native "$NATIVE_BINDING";\n', 763 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n',
767 DOMINTERFACE=self._interface.id, 764 DOMINTERFACE=self._interface.id,
768 ANNOTATIONS=annotation_str, 765 ANNOTATIONS=annotations,
769 DART_DECLARATION=dart_declaration, 766 DART_DECLARATION=dart_declaration,
770 NATIVE_BINDING=native_binding) 767 NATIVE_BINDING=native_binding)
771 768
772 cpp_callback_name = '%s%s' % (idl_name, native_suffix) 769 cpp_callback_name = '%s%s' % (idl_name, native_suffix)
773 self._cpp_resolver_emitter.Emit( 770 self._cpp_resolver_emitter.Emit(
774 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n' 771 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n'
775 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n', 772 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n',
776 ARGC=argument_count, 773 ARGC=argument_count,
777 NATIVE_BINDING=native_binding, 774 NATIVE_BINDING=native_binding,
778 INTERFACE_NAME=self._interface.id, 775 INTERFACE_NAME=self._interface.id,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 LIBRARY_NAME=library_name) 873 LIBRARY_NAME=library_name)
877 874
878 headers = self._library_headers[library_name] 875 headers = self._library_headers[library_name]
879 for header_file in headers: 876 for header_file in headers:
880 path = os.path.relpath(header_file, output_dir) 877 path = os.path.relpath(header_file, output_dir)
881 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 878 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
882 body_emitter.Emit( 879 body_emitter.Emit(
883 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 880 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
884 ' return func;\n', 881 ' return func;\n',
885 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 882 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