| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 | 174 |
| 175 def generate_argument(interface, method, argument, index): | 175 def generate_argument(interface, method, argument, index): |
| 176 extended_attributes = argument.extended_attributes | 176 extended_attributes = argument.extended_attributes |
| 177 idl_type = argument.idl_type | 177 idl_type = argument.idl_type |
| 178 this_cpp_value = cpp_value(interface, method, index) | 178 this_cpp_value = cpp_value(interface, method, index) |
| 179 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 179 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
| 180 | 180 |
| 181 return { | 181 return { |
| 182 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut
es, | 182 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut
es, |
| 183 used_as_argument=True, | 183 used_as_raw_type=True, |
| 184 used_as_variadic_argument=argument.is
_variadic), | 184 used_as_variadic_argument=argument.is
_variadic), |
| 185 'cpp_value': this_cpp_value, | 185 'cpp_value': this_cpp_value, |
| 186 # FIXME: check that the default value's type is compatible with the argu
ment's | 186 # FIXME: check that the default value's type is compatible with the argu
ment's |
| 187 'default_value': str(argument.default_value) if argument.default_value e
lse None, | 187 'default_value': str(argument.default_value) if argument.default_value e
lse None, |
| 188 'enum_validation_expression': idl_type.enum_validation_expression, | 188 'enum_validation_expression': idl_type.enum_validation_expression, |
| 189 # FIXME: remove once [Default] removed and just use argument.default_val
ue | 189 # FIXME: remove once [Default] removed and just use argument.default_val
ue |
| 190 'has_default': 'Default' in extended_attributes or argument.default_valu
e, | 190 'has_default': 'Default' in extended_attributes or argument.default_valu
e, |
| 191 'has_event_listener_argument': any( | 191 'has_event_listener_argument': any( |
| 192 argument_so_far for argument_so_far in method.arguments[:index] | 192 argument_so_far for argument_so_far in method.arguments[:index] |
| 193 if argument_so_far.idl_type.name == 'EventListener'), | 193 if argument_so_far.idl_type.name == 'EventListener'), |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 | 340 |
| 341 | 341 |
| 342 def union_arguments(idl_type): | 342 def union_arguments(idl_type): |
| 343 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 343 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
| 344 return [arg | 344 return [arg |
| 345 for i in range(len(idl_type.member_types)) | 345 for i in range(len(idl_type.member_types)) |
| 346 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 346 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
| 347 | 347 |
| 348 IdlType.union_arguments = property(lambda self: None) | 348 IdlType.union_arguments = property(lambda self: None) |
| 349 IdlUnionType.union_arguments = property(union_arguments) | 349 IdlUnionType.union_arguments = property(union_arguments) |
| OLD | NEW |