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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 push(@andExpression, "${value}->IsNull() || ${value}->IsArray()" ); 2201 push(@andExpression, "${value}->IsNull() || ${value}->IsArray()" );
2202 } else { 2202 } else {
2203 push(@andExpression, "${value}->IsArray()"); 2203 push(@andExpression, "${value}->IsArray()");
2204 } 2204 }
2205 } elsif (IsWrapperType($type)) { 2205 } elsif (IsWrapperType($type)) {
2206 if ($parameter->isNullable) { 2206 if ($parameter->isNullable) {
2207 push(@andExpression, "${value}->IsNull() || V8${type}::hasInstan ce($value, info.GetIsolate(), worldType(info.GetIsolate()))"); 2207 push(@andExpression, "${value}->IsNull() || V8${type}::hasInstan ce($value, info.GetIsolate(), worldType(info.GetIsolate()))");
2208 } else { 2208 } else {
2209 push(@andExpression, "V8${type}::hasInstance($value, info.GetIso late(), worldType(info.GetIsolate()))"); 2209 push(@andExpression, "V8${type}::hasInstance($value, info.GetIso late(), worldType(info.GetIsolate()))");
2210 } 2210 }
2211 } elsif ($nonWrapperTypes{$type}) {
2212 # Non-wrapper types are just objects: we don't distinguish type
2213 # FIXME: If distinguishing non-wrapper type from primitive type,
2214 # the non-wrapper type must appear *first* in the IDL file,
2215 # since we're not adding a !IsObject check to primitive types.
2216 # This can be avoided if compute overloads more sensibly.
2217 if ($parameter->isNullable) {
2218 push(@andExpression, "${value}->IsNull() || ${value}->IsObject() ");
2219 } else {
2220 push(@andExpression, "${value}->IsObject()");
2221 }
2211 } 2222 }
2212 2223
2213 $parameterIndex++; 2224 $parameterIndex++;
2214 } 2225 }
2215 @andExpression = map { "($_)" } @andExpression; 2226 @andExpression = map { "($_)" } @andExpression;
2216 my $res = "(" . join(" && ", @andExpression) . ")"; 2227 my $res = "(" . join(" && ", @andExpression) . ")";
2217 return $res; 2228 return $res;
2218 } 2229 }
2219 2230
2220 # As per Web IDL specification, the length of a function Object is 2231 # As per Web IDL specification, the length of a function Object is
(...skipping 4172 matching lines...) Expand 10 before | Expand all | Expand 10 after
6393 if ($parameter->type eq "SerializedScriptValue") { 6404 if ($parameter->type eq "SerializedScriptValue") {
6394 return 1; 6405 return 1;
6395 } elsif (IsIntegerType($parameter->type)) { 6406 } elsif (IsIntegerType($parameter->type)) {
6396 return 1; 6407 return 1;
6397 } 6408 }
6398 } 6409 }
6399 return 0; 6410 return 0;
6400 } 6411 }
6401 6412
6402 1; 6413 1;
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/idls/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698