Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: Source/bindings/scripts/unstable/v8_methods.py

Issue 137593005: IDL compiler: [RaisesException] for non-void methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 cpp_arguments.extend(cpp_argument(argument) for argument in arguments) 169 cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
170 if 'RaisesException' in method.extended_attributes: 170 if 'RaisesException' in method.extended_attributes:
171 cpp_arguments.append('exceptionState') 171 cpp_arguments.append('exceptionState')
172 172
173 cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.c pp_name(method)) 173 cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.c pp_name(method))
174 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) 174 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
175 175
176 176
177 def v8_set_return_value(interface_name, method, cpp_value): 177 def v8_set_return_value(interface_name, method, cpp_value):
178 idl_type = method.idl_type 178 idl_type = method.idl_type
179 extended_attributes = method.extended_attributes
179 if idl_type == 'void': 180 if idl_type == 'void':
180 return None 181 return None
181 # [CallWith=ScriptState] 182 # [CallWith=ScriptState], [RaisesException]
182 if has_extended_attribute_value(method, 'CallWith', 'ScriptState'): 183 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or
184 'RaisesException' in extended_attributes):
183 cpp_value = 'result' # use local variable for value 185 cpp_value = 'result' # use local variable for value
184 script_wrappable = 'imp' if v8_types.inherits_interface(interface_name, 'Nod e') else '' 186 script_wrappable = 'imp' if v8_types.inherits_interface(interface_name, 'Nod e') else ''
185 return v8_types.v8_set_return_value(idl_type, cpp_value, method.extended_att ributes, script_wrappable=script_wrappable) 187 return v8_types.v8_set_return_value(idl_type, cpp_value, extended_attributes , script_wrappable=script_wrappable)
186 188
187 189
188 # [NotEnumerable] 190 # [NotEnumerable]
189 def property_attributes(method): 191 def property_attributes(method):
190 extended_attributes = method.extended_attributes 192 extended_attributes = method.extended_attributes
191 property_attributes_list = [] 193 property_attributes_list = []
192 if 'NotEnumerable' in extended_attributes: 194 if 'NotEnumerable' in extended_attributes:
193 property_attributes_list.append('v8::DontEnum') 195 property_attributes_list.append('v8::DontEnum')
194 if 'ReadOnly' in extended_attributes: 196 if 'ReadOnly' in extended_attributes:
195 property_attributes_list.append('v8::ReadOnly') 197 property_attributes_list.append('v8::ReadOnly')
(...skipping 10 matching lines...) Expand all
206 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format( 208 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format(
207 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index) 209 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index)
208 # [Default=NullString] 210 # [Default=NullString]
209 if (argument.is_optional and idl_type == 'DOMString' and 211 if (argument.is_optional and idl_type == 'DOMString' and
210 extended_attributes.get('Default') == 'NullString'): 212 extended_attributes.get('Default') == 'NullString'):
211 v8_value = 'argumentOrNull(info, %s)' % index 213 v8_value = 'argumentOrNull(info, %s)' % index
212 else: 214 else:
213 v8_value = 'info[%s]' % index 215 v8_value = 'info[%s]' % index
214 return v8_types.v8_value_to_local_cpp_value( 216 return v8_types.v8_value_to_local_cpp_value(
215 idl_type, argument.extended_attributes, v8_value, name, index=index) 217 idl_type, argument.extended_attributes, v8_value, name, index=index)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698