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

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

Issue 10584031: Proper support for IDL arrays in generators. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration Created 8 years, 6 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
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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 ' DartApiScope dartApiScope;\n' 935 ' DartApiScope dartApiScope;\n'
936 '$BODY' 936 '$BODY'
937 '}\n', 937 '}\n',
938 CALLBACK_NAME=callback_name, 938 CALLBACK_NAME=callback_name,
939 BODY=body) 939 BODY=body)
940 940
941 def _GenerateToNative(self, emitter, idl_node, index, 941 def _GenerateToNative(self, emitter, idl_node, index,
942 argument_name=None): 942 argument_name=None):
943 """idl_node is IDLArgument or IDLAttribute.""" 943 """idl_node is IDLArgument or IDLAttribute."""
944 type_info = GetIDLTypeInfo(idl_node.type.id) 944 type_info = GetIDLTypeInfo(idl_node.type.id)
945 if not IsPrimitiveType(idl_node.type.id): 945 self._cpp_impl_includes |= set(type_info.to_native_includes())
946 self._cpp_impl_includes.add('"Dart%s.h"' % type_info.idl_type())
947 argument_name = argument_name or idl_node.id 946 argument_name = argument_name or idl_node.id
948 handle = 'Dart_GetNativeArgument(args, %i)' % index 947 handle = 'Dart_GetNativeArgument(args, %i)' % index
949 return type_info.emit_to_native(emitter, idl_node, argument_name, handle, se lf._interface.id) 948 return type_info.emit_to_native(emitter, idl_node, argument_name, handle, se lf._interface.id)
950 949
951 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration, 950 def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
952 native_suffix, is_custom): 951 native_suffix, is_custom):
953 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix) 952 native_binding = '%s_%s_%s' % (self._interface.id, idl_name, native_suffix)
954 self._members_emitter.Emit( 953 self._members_emitter.Emit(
955 '\n' 954 '\n'
956 ' $DART_DECLARATION native "$NATIVE_BINDING";\n', 955 ' $DART_DECLARATION native "$NATIVE_BINDING";\n',
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 continue 1049 continue
1051 parent_interface = database.GetInterface(parent.type.id) 1050 parent_interface = database.GetInterface(parent.type.id)
1052 if callback(parent_interface): 1051 if callback(parent_interface):
1053 return parent_interface 1052 return parent_interface
1054 parent_interface = _FindParent(parent_interface, database, callback) 1053 parent_interface = _FindParent(parent_interface, database, callback)
1055 if parent_interface: 1054 if parent_interface:
1056 return parent_interface 1055 return parent_interface
1057 1056
1058 def _IsArgumentOptionalInWebCore(argument): 1057 def _IsArgumentOptionalInWebCore(argument):
1059 return IsOptional(argument) and not 'Callback' in argument.ext_attrs 1058 return IsOptional(argument) and not 'Callback' in argument.ext_attrs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698