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

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

Issue 289843006: Avoid extra arity and type check on distinguishing argument (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: additional test Created 6 years, 7 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
Index: Source/bindings/templates/methods.cpp
diff --git a/Source/bindings/templates/methods.cpp b/Source/bindings/templates/methods.cpp
index fef73d8f73bad922c0d5f64c9f79ae08713ea9be..8ff7b23615683a5de03f43e33ee78260fc3353aa 100644
--- a/Source/bindings/templates/methods.cpp
+++ b/Source/bindings/templates/methods.cpp
@@ -92,9 +92,11 @@ if (UNLIKELY(info.Length() <= {{argument.index}})) {
return;
}
{% endif %}
-{% if argument.has_type_checking_interface %}
+{% if argument.has_type_checking_interface and argument.index != method.distinguishing_argument_index %}
{# Type checking for wrapper interface types (if interface not implemented,
- throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
+ throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface
+ If the argument is the distinguishing argument for an overloaded method,
+ the type is checked as part of overload resolution instead. #}
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}}

Powered by Google App Engine
This is Rietveld 408576698