OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 else: | 223 else: |
224 base_name = v8_utilities.cpp_name(method) | 224 base_name = v8_utilities.cpp_name(method) |
225 | 225 |
226 cpp_method_name = v8_utilities.scoped_name(interface, method, base_name) | 226 cpp_method_name = v8_utilities.scoped_name(interface, method, base_name) |
227 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) | 227 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) |
228 | 228 |
229 | 229 |
230 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False)
: | 230 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False)
: |
231 idl_type = method.idl_type | 231 idl_type = method.idl_type |
232 extended_attributes = method.extended_attributes | 232 extended_attributes = method.extended_attributes |
233 if idl_type.name == 'void': | 233 if not idl_type or idl_type.name == 'void': |
| 234 # Constructors and void methods don't have a return type |
234 return None | 235 return None |
235 | 236 |
236 release = False | 237 release = False |
237 # [CallWith=ScriptState], [RaisesException] | 238 # [CallWith=ScriptState], [RaisesException] |
238 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or | 239 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or |
239 'RaisesException' in extended_attributes or | 240 'RaisesException' in extended_attributes or |
240 idl_type.is_union_type): | 241 idl_type.is_union_type): |
241 cpp_value = 'result' # use local variable for value | 242 cpp_value = 'result' # use local variable for value |
242 release = idl_type.release | 243 release = idl_type.release |
243 | 244 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 283 |
283 | 284 |
284 def union_arguments(idl_type): | 285 def union_arguments(idl_type): |
285 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 286 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
286 return [arg | 287 return [arg |
287 for i in range(len(idl_type.member_types)) | 288 for i in range(len(idl_type.member_types)) |
288 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 289 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
289 | 290 |
290 IdlType.union_arguments = property(lambda self: None) | 291 IdlType.union_arguments = property(lambda self: None) |
291 IdlUnionType.union_arguments = property(union_arguments) | 292 IdlUnionType.union_arguments = property(union_arguments) |
OLD | NEW |