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

Unified Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 131973012: Add overload support for non-wrapper type vs. primitive type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaseline IDB tests 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/scripts/code_generator_v8.pm
diff --git a/Source/bindings/scripts/code_generator_v8.pm b/Source/bindings/scripts/code_generator_v8.pm
index 43df75f485c36b565f37b8095369e8c1ed2d568c..b1f70722432945e9b3062a05679bef078ac2640c 100644
--- a/Source/bindings/scripts/code_generator_v8.pm
+++ b/Source/bindings/scripts/code_generator_v8.pm
@@ -2184,17 +2184,29 @@ sub GenerateParametersCheckExpression
my $value = "info[$parameterIndex]";
my $type = $parameter->type;
- # Only DOMString or wrapper types are checked.
+ # Only DOMString, wrapper types, and (to some degree) non-wrapper types
+ # are checked.
+ #
+ # FIXME: If distinguishing non-primitive type from primitive type,
+ # (e.g., sequence<DOMString> from DOMString or Dictionary from double)
+ # the non-primitive type must appear *first* in the IDL file,
+ # since we're not adding a check to primitive types.
+ # This can be avoided if compute overloads for whole overload set at
+ # once, rather than one method at a time, but that requires a complete
+ # rewrite of this algorithm.
+ #
# For DOMString with StrictTypeChecking only Null, Undefined and Object
# are accepted for compatibility. Otherwise, no restrictions are made to
# match the non-overloaded behavior.
+ #
# FIXME: Implement WebIDL overload resolution algorithm.
+ # https://code.google.com/p/chromium/issues/detail?id=293561
if ($type eq "DOMString") {
if ($parameter->extendedAttributes->{"StrictTypeChecking"}) {
push(@andExpression, "isUndefinedOrNull(${value}) || ${value}->IsString() || ${value}->IsObject()");
}
} elsif (IsCallbackInterface($parameter->type)) {
- # For Callbacks only checks if the value is null or object.
+ # For Callbacks only checks if the value is null or function.
push(@andExpression, "${value}->IsNull() || ${value}->IsFunction()");
} elsif (GetArrayOrSequenceType($type)) {
if ($parameter->isNullable) {
@@ -2208,6 +2220,13 @@ sub GenerateParametersCheckExpression
} else {
push(@andExpression, "V8${type}::hasInstance($value, info.GetIsolate(), worldType(info.GetIsolate()))");
}
+ } elsif ($nonWrapperTypes{$type}) {
+ # Non-wrapper types are just objects: we don't distinguish type
+ if ($parameter->isNullable) {
+ push(@andExpression, "${value}->IsNull() || ${value}->IsObject()");
+ } else {
+ push(@andExpression, "${value}->IsObject()");
+ }
}
$parameterIndex++;
« no previous file with comments | « LayoutTests/storage/indexeddb/index-basics-workers-expected.txt ('k') | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698