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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 counter[item] += 1 | 465 counter[item] += 1 |
466 return counter | 466 return counter |
467 | 467 |
468 | 468 |
469 ################################################################################ | 469 ################################################################################ |
470 # Constructors | 470 # Constructors |
471 ################################################################################ | 471 ################################################################################ |
472 | 472 |
473 # [Constructor] | 473 # [Constructor] |
474 def generate_constructor(interface, constructor): | 474 def generate_constructor(interface, constructor): |
| 475 generated_arguments = [v8_methods.generate_argument(interface, constructor,
argument, index) |
| 476 for index, argument in enumerate(constructor.argument
s)] |
| 477 |
475 return { | 478 return { |
476 'argument_list': constructor_argument_list(interface, constructor), | 479 'argument_list': constructor_argument_list(interface, constructor), |
477 'arguments': [v8_methods.generate_argument(interface, constructor, argum
ent, index) | 480 'arguments': generated_arguments, |
478 for index, argument in enumerate(constructor.arguments)], | 481 'arguments_need_try_catch': any( |
| 482 v8_methods.argument_needs_try_catch(argument) |
| 483 for argument in generated_arguments), |
479 'cpp_type': cpp_template_type( | 484 'cpp_type': cpp_template_type( |
480 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), | 485 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), |
481 cpp_name(interface)), | 486 cpp_name(interface)), |
482 'has_exception_state': | 487 'has_exception_state': |
483 # [RaisesException=Constructor] | 488 # [RaisesException=Constructor] |
484 interface.extended_attributes.get('RaisesException') == 'Constructor
' or | 489 interface.extended_attributes.get('RaisesException') == 'Constructor
' or |
485 any(argument for argument in constructor.arguments | 490 any(argument for argument in constructor.arguments |
486 if argument.idl_type.name == 'SerializedScriptValue' or | 491 if argument.idl_type.name == 'SerializedScriptValue' or |
487 argument.idl_type.is_integer_type), | 492 argument.idl_type.is_integer_type), |
488 'is_constructor': True, | 493 'is_constructor': True, |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 deleter = next( | 742 deleter = next( |
738 method | 743 method |
739 for method in interface.operations | 744 for method in interface.operations |
740 if ('deleter' in method.specials and | 745 if ('deleter' in method.specials and |
741 len(method.arguments) == 1 and | 746 len(method.arguments) == 1 and |
742 str(method.arguments[0].idl_type) == 'DOMString')) | 747 str(method.arguments[0].idl_type) == 'DOMString')) |
743 except StopIteration: | 748 except StopIteration: |
744 return None | 749 return None |
745 | 750 |
746 return property_deleter(deleter) | 751 return property_deleter(deleter) |
OLD | NEW |