| 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 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1213 ################################################################################ | 1213 ################################################################################ |
| 1214 # Constructors | 1214 # Constructors |
| 1215 ################################################################################ | 1215 ################################################################################ |
| 1216 | 1216 |
| 1217 # [Constructor] | 1217 # [Constructor] |
| 1218 def constructor_context(interface, constructor): | 1218 def constructor_context(interface, constructor): |
| 1219 # [RaisesException=Constructor] | 1219 # [RaisesException=Constructor] |
| 1220 is_constructor_raises_exception = \ | 1220 is_constructor_raises_exception = \ |
| 1221 interface.extended_attributes.get('RaisesException') == 'Constructor' | 1221 interface.extended_attributes.get('RaisesException') == 'Constructor' |
| 1222 | 1222 |
| 1223 argument_contexts = [ |
| 1224 v8_methods.argument_context(interface, constructor, argument, index) |
| 1225 for index, argument in enumerate(constructor.arguments)] |
| 1226 |
| 1223 return { | 1227 return { |
| 1224 'arguments': [v8_methods.argument_context(interface, constructor, argume
nt, index) | 1228 'arguments': argument_contexts, |
| 1225 for index, argument in enumerate(constructor.arguments)], | |
| 1226 'cpp_type': cpp_template_type( | 1229 'cpp_type': cpp_template_type( |
| 1227 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), | 1230 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), |
| 1228 cpp_name(interface)), | 1231 cpp_name(interface)), |
| 1229 'cpp_value': v8_methods.cpp_value( | 1232 'cpp_value': v8_methods.cpp_value( |
| 1230 interface, constructor, len(constructor.arguments)), | 1233 interface, constructor, len(constructor.arguments)), |
| 1231 'has_exception_state': | 1234 'has_exception_state': |
| 1232 is_constructor_raises_exception or | 1235 is_constructor_raises_exception or |
| 1233 any(argument for argument in constructor.arguments | 1236 any(argument for argument in constructor.arguments |
| 1234 if argument.idl_type.name == 'SerializedScriptValue' or | 1237 if argument.idl_type.name == 'SerializedScriptValue' or |
| 1235 argument.idl_type.v8_conversion_needs_exception_state), | 1238 argument.idl_type.v8_conversion_needs_exception_state), |
| 1239 'has_optional_argument_without_default_value': |
| 1240 any(True for argument_context in argument_contexts |
| 1241 if argument_context['is_optional_without_default_value']), |
| 1236 'is_call_with_document': | 1242 'is_call_with_document': |
| 1237 # [ConstructorCallWith=Document] | 1243 # [ConstructorCallWith=Document] |
| 1238 has_extended_attribute_value(interface, | 1244 has_extended_attribute_value(interface, |
| 1239 'ConstructorCallWith', 'Document'), | 1245 'ConstructorCallWith', 'Document'), |
| 1240 'is_call_with_execution_context': | 1246 'is_call_with_execution_context': |
| 1241 # [ConstructorCallWith=ExecutionContext] | 1247 # [ConstructorCallWith=ExecutionContext] |
| 1242 has_extended_attribute_value(interface, | 1248 has_extended_attribute_value(interface, |
| 1243 'ConstructorCallWith', 'ExecutionContext'), | 1249 'ConstructorCallWith', 'ExecutionContext'), |
| 1244 'is_call_with_script_state': | 1250 'is_call_with_script_state': |
| 1245 # [ConstructorCallWith=ScriptState] | 1251 # [ConstructorCallWith=ScriptState] |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1381 | 1387 |
| 1382 extended_attributes = deleter.extended_attributes | 1388 extended_attributes = deleter.extended_attributes |
| 1383 idl_type = deleter.idl_type | 1389 idl_type = deleter.idl_type |
| 1384 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') | 1390 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete
r, 'CallWith', 'ScriptState') |
| 1385 return { | 1391 return { |
| 1386 'is_call_with_script_state': is_call_with_script_state, | 1392 'is_call_with_script_state': is_call_with_script_state, |
| 1387 'is_custom': 'Custom' in extended_attributes, | 1393 'is_custom': 'Custom' in extended_attributes, |
| 1388 'is_raises_exception': 'RaisesException' in extended_attributes, | 1394 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1389 'name': cpp_name(deleter), | 1395 'name': cpp_name(deleter), |
| 1390 } | 1396 } |
| OLD | NEW |