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

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

Issue 11962049: Revert "Fixing formatting of dart:html's dart2js annotations." (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 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 = FormatAnnotations( 757 annotations = FindCommonAnnotations(self._interface.id, idl_name)
758 FindCommonAnnotations(self._interface.id, idl_name), ' ') 758 if annotations:
759 annotation_str = '\n ' + '\n '.join(annotations)
760 else:
761 annotation_str = ''
759 762
760 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) 763 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix)
761 self._members_emitter.Emit( 764 self._members_emitter.Emit(
762 '\n' 765 '$ANNOTATIONS'
763 ' $ANNOTATIONS$DART_DECLARATION native "$NATIVE_BINDING";\n', 766 '\n $DART_DECLARATION native "$NATIVE_BINDING";\n',
764 DOMINTERFACE=self._interface.id, 767 DOMINTERFACE=self._interface.id,
765 ANNOTATIONS=annotations, 768 ANNOTATIONS=annotation_str,
766 DART_DECLARATION=dart_declaration, 769 DART_DECLARATION=dart_declaration,
767 NATIVE_BINDING=native_binding) 770 NATIVE_BINDING=native_binding)
768 771
769 cpp_callback_name = '%s%s' % (idl_name, native_suffix) 772 cpp_callback_name = '%s%s' % (idl_name, native_suffix)
770 self._cpp_resolver_emitter.Emit( 773 self._cpp_resolver_emitter.Emit(
771 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n' 774 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n'
772 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n', 775 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n',
773 ARGC=argument_count, 776 ARGC=argument_count,
774 NATIVE_BINDING=native_binding, 777 NATIVE_BINDING=native_binding,
775 INTERFACE_NAME=self._interface.id, 778 INTERFACE_NAME=self._interface.id,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 LIBRARY_NAME=library_name) 876 LIBRARY_NAME=library_name)
874 877
875 headers = self._library_headers[library_name] 878 headers = self._library_headers[library_name]
876 for header_file in headers: 879 for header_file in headers:
877 path = os.path.relpath(header_file, output_dir) 880 path = os.path.relpath(header_file, output_dir)
878 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 881 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
879 body_emitter.Emit( 882 body_emitter.Emit(
880 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 883 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n'
881 ' return func;\n', 884 ' return func;\n',
882 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 885 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