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

Unified Diff: Source/bindings/scripts/v8_methods.py

Issue 482713002: IDL: Improve "argument needs v8::TryCatch" logic slightly (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_methods.py
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py
index ccb8a964642102f1efa0bc11a9af290c9c3b4cf3..76be0ed41c5617d14a7038f32bb86ca8e65b3a98 100644
--- a/Source/bindings/scripts/v8_methods.py
+++ b/Source/bindings/scripts/v8_methods.py
@@ -52,11 +52,12 @@ CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([
])
-def argument_needs_try_catch(argument, return_promise):
+def argument_needs_try_catch(method, argument):
+ return_promise = method.idl_type and method.idl_type.name == 'Promise'
idl_type = argument.idl_type
base_type = idl_type.base_type
- return not (
+ return not(
# These cases are handled by separate code paths in the
# generate_argument() macro in Source/bindings/templates/methods.cpp.
idl_type.is_callback_interface or
@@ -65,7 +66,8 @@ def argument_needs_try_catch(argument, return_promise):
# String and enumeration arguments converted using one of the
# TOSTRING_* macros except for _PROMISE variants in
# Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch.
- (base_type == 'DOMString' and not argument.is_variadic and
+ ((base_type == 'DOMString' or idl_type.is_enum) and
+ not argument.is_variadic and
not return_promise))
@@ -85,7 +87,6 @@ def method_context(interface, method):
idl_type = method.idl_type
is_static = method.is_static
name = method.name
- return_promise = idl_type.name == 'Promise'
idl_type.add_includes_for_type()
this_cpp_value = cpp_value(interface, method, len(arguments))
@@ -126,7 +127,7 @@ def method_context(interface, method):
is_raises_exception = 'RaisesException' in extended_attributes
arguments_need_try_catch = (
- any(argument_needs_try_catch(argument, return_promise)
+ any(argument_needs_try_catch(method, argument)
for argument in arguments))
return {
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698