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

Unified Diff: Source/bindings/templates/methods.cpp

Issue 808373002: IDL: Simplify [TypeChecking=Interface] code generation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index 3403080dc766585bc54ddbc65b7324b1a50fa160..de06d08418e1541beb685ada9123514d1064175f 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -109,17 +109,6 @@ if (UNLIKELY(info.Length() <= {{argument.index}})) {
return;
}
{% endif %}
-{% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_type %}
-{# Type checking for wrapper interface types (if interface not implemented,
- throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface
- Note: for variadic arguments, the type checking is done for each matched
- argument instead; see argument.is_variadic_wrapper_type code-path below. #}
-if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefinedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasInstance(info[{{argument.index}}], info.GetIsolate())) {
- {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' %
- (argument.index + 1, argument.idl_type)) | indent}}
- return;
-}
-{% endif %}{# argument.has_type_checking_interface #}
{% if argument.is_callback_interface %}
{# FIXME: remove EventListener special case #}
{% if argument.idl_type == 'EventListener' %}
@@ -187,6 +176,16 @@ if (!std::isfinite({{argument.name}})) {
(argument.idl_type, argument.index + 1)) | indent}}
return;
}
+{% elif argument.has_type_checking_interface and not argument.is_variadic_wrapper_type %}
+{# Type checking for wrapper interface types (if interface not implemented,
+ throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface
+ Note: for variadic arguments, the type checking is done for each matched
+ argument instead; see argument.is_variadic_wrapper_type code-path above. #}
+if (!{{argument.name}}{% if argument.is_nullable %} && !isUndefinedOrNull(info[{{argument.index}}]){% endif %}) {
+ {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' %
+ (argument.index + 1, argument.idl_type)) | indent}}
+ return;
+}
{% elif argument.enum_validation_expression %}
{# Invalid enum values: http://www.w3.org/TR/WebIDL/#idl-enums #}
String string = {{argument.name}};

Powered by Google App Engine
This is Rietveld 408576698