| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 895 l.sort(key=key) | 895 l.sort(key=key) |
| 896 return ((k, list(g)) for k, g in itertools.groupby(l, key)) | 896 return ((k, list(g)) for k, g in itertools.groupby(l, key)) |
| 897 | 897 |
| 898 | 898 |
| 899 ################################################################################ | 899 ################################################################################ |
| 900 # Constructors | 900 # Constructors |
| 901 ################################################################################ | 901 ################################################################################ |
| 902 | 902 |
| 903 # [Constructor] | 903 # [Constructor] |
| 904 def constructor_context(interface, constructor): | 904 def constructor_context(interface, constructor): |
| 905 arguments_need_try_catch = any(v8_methods.argument_needs_try_catch(construct
or, argument) | |
| 906 for argument in constructor.arguments) | |
| 907 | |
| 908 # [RaisesException=Constructor] | 905 # [RaisesException=Constructor] |
| 909 is_constructor_raises_exception = \ | 906 is_constructor_raises_exception = \ |
| 910 interface.extended_attributes.get('RaisesException') == 'Constructor' | 907 interface.extended_attributes.get('RaisesException') == 'Constructor' |
| 911 | 908 |
| 912 return { | 909 return { |
| 913 'arguments': [v8_methods.argument_context(interface, constructor, argume
nt, index) | 910 'arguments': [v8_methods.argument_context(interface, constructor, argume
nt, index) |
| 914 for index, argument in enumerate(constructor.arguments)], | 911 for index, argument in enumerate(constructor.arguments)], |
| 915 'arguments_need_try_catch': arguments_need_try_catch, | |
| 916 'cpp_type': cpp_template_type( | 912 'cpp_type': cpp_template_type( |
| 917 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), | 913 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), |
| 918 cpp_name(interface)), | 914 cpp_name(interface)), |
| 919 'cpp_value': v8_methods.cpp_value( | 915 'cpp_value': v8_methods.cpp_value( |
| 920 interface, constructor, len(constructor.arguments)), | 916 interface, constructor, len(constructor.arguments)), |
| 921 'has_exception_state': | 917 'has_exception_state': |
| 922 is_constructor_raises_exception or | 918 is_constructor_raises_exception or |
| 923 any(argument for argument in constructor.arguments | 919 any(argument for argument in constructor.arguments |
| 924 if argument.idl_type.name == 'SerializedScriptValue' or | 920 if argument.idl_type.name == 'SerializedScriptValue' or |
| 925 argument.idl_type.v8_conversion_needs_exception_state), | 921 argument.idl_type.v8_conversion_needs_exception_state), |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1157 deleter = next( | 1153 deleter = next( |
| 1158 method | 1154 method |
| 1159 for method in interface.operations | 1155 for method in interface.operations |
| 1160 if ('deleter' in method.specials and | 1156 if ('deleter' in method.specials and |
| 1161 len(method.arguments) == 1 and | 1157 len(method.arguments) == 1 and |
| 1162 str(method.arguments[0].idl_type) == 'DOMString')) | 1158 str(method.arguments[0].idl_type) == 'DOMString')) |
| 1163 except StopIteration: | 1159 except StopIteration: |
| 1164 return None | 1160 return None |
| 1165 | 1161 |
| 1166 return property_deleter(deleter) | 1162 return property_deleter(deleter) |
| OLD | NEW |