Chromium Code Reviews| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 446 | 446 |
| 447 | 447 |
| 448 ################################################################################ | 448 ################################################################################ |
| 449 # Constructors | 449 # Constructors |
| 450 ################################################################################ | 450 ################################################################################ |
| 451 | 451 |
| 452 # [Constructor] | 452 # [Constructor] |
| 453 def generate_constructor(interface, constructor): | 453 def generate_constructor(interface, constructor): |
| 454 return { | 454 return { |
| 455 'argument_list': constructor_argument_list(interface, constructor), | 455 'argument_list': constructor_argument_list(interface, constructor), |
| 456 'arguments': [constructor_argument(argument, index) | 456 'arguments': [constructor_argument(interface, constructor, argument, ind ex) |
| 457 for index, argument in enumerate(constructor.arguments)], | 457 for index, argument in enumerate(constructor.arguments)], |
| 458 'has_exception_state': | 458 'has_exception_state': |
| 459 # [RaisesException=Constructor] | 459 # [RaisesException=Constructor] |
| 460 interface.extended_attributes.get('RaisesException') == 'Constructor ' or | 460 interface.extended_attributes.get('RaisesException') == 'Constructor ' or |
| 461 any(argument for argument in constructor.arguments | 461 any(argument for argument in constructor.arguments |
| 462 if argument.idl_type.name == 'SerializedScriptValue' or | 462 if argument.idl_type.name == 'SerializedScriptValue' or |
| 463 argument.idl_type.is_integer_type), | 463 argument.idl_type.is_integer_type), |
| 464 'is_constructor': True, | 464 'is_constructor': True, |
| 465 'is_variadic': False, # Required for overload resolution | 465 'is_variadic': False, # Required for overload resolution |
| 466 'number_of_required_arguments': | 466 'number_of_required_arguments': |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 479 | 479 |
| 480 arguments.extend([argument.name for argument in constructor.arguments]) | 480 arguments.extend([argument.name for argument in constructor.arguments]) |
| 481 | 481 |
| 482 # [RaisesException=Constructor] | 482 # [RaisesException=Constructor] |
| 483 if interface.extended_attributes.get('RaisesException') == 'Constructor': | 483 if interface.extended_attributes.get('RaisesException') == 'Constructor': |
| 484 arguments.append('exceptionState') | 484 arguments.append('exceptionState') |
| 485 | 485 |
| 486 return arguments | 486 return arguments |
| 487 | 487 |
| 488 | 488 |
| 489 def constructor_argument(argument, index): | 489 def constructor_argument(interface, constructor, argument, index): |
| 490 idl_type = argument.idl_type | 490 idl_type = argument.idl_type |
| 491 this_cpp_value = v8_methods.cpp_value(interface, constructor, index, for_con structor=True) | |
|
Nils Barth (inactive)
2014/04/09 02:00:27
Could you inline this expression, as it's not bein
sof
2014/04/09 07:31:59
Done + sorted the fields.
| |
| 491 return { | 492 return { |
| 493 'cpp_value': this_cpp_value, | |
| 492 'has_default': 'Default' in argument.extended_attributes, | 494 'has_default': 'Default' in argument.extended_attributes, |
| 493 'idl_type_object': idl_type, | 495 'idl_type_object': idl_type, |
| 494 # Dictionary is special-cased, but arrays and sequences shouldn't be | 496 # Dictionary is special-cased, but arrays and sequences shouldn't be |
| 495 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, | 497 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, |
| 496 'index': index, | 498 'index': index, |
| 497 'is_optional': argument.is_optional, | 499 'is_optional': argument.is_optional, |
| 498 'is_strict_type_checking': False, # Required for overload resolution | 500 'is_strict_type_checking': False, # Required for overload resolution |
| 499 'name': argument.name, | 501 'name': argument.name, |
| 500 'v8_value_to_local_cpp_value': | 502 'v8_value_to_local_cpp_value': |
| 501 v8_methods.v8_value_to_local_cpp_value(argument, index), | 503 v8_methods.v8_value_to_local_cpp_value(argument, index), |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 725 deleter = next( | 727 deleter = next( |
| 726 method | 728 method |
| 727 for method in interface.operations | 729 for method in interface.operations |
| 728 if ('deleter' in method.specials and | 730 if ('deleter' in method.specials and |
| 729 len(method.arguments) == 1 and | 731 len(method.arguments) == 1 and |
| 730 str(method.arguments[0].idl_type) == 'DOMString')) | 732 str(method.arguments[0].idl_type) == 'DOMString')) |
| 731 except StopIteration: | 733 except StopIteration: |
| 732 return None | 734 return None |
| 733 | 735 |
| 734 return property_deleter(deleter) | 736 return property_deleter(deleter) |
| OLD | NEW |