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

Side by Side Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 38063003: Improve TypeError messages from failed array conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve TypeError messages from failed array conversions. Created 7 years, 1 month 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
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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 } 1901 }
1902 } 1902 }
1903 1903
1904 my $nativeType = GetNativeType($attribute->type, $attribute->extendedAttribu tes, "parameter"); 1904 my $nativeType = GetNativeType($attribute->type, $attribute->extendedAttribu tes, "parameter");
1905 if ($attribute->type eq "EventHandler") { 1905 if ($attribute->type eq "EventHandler") {
1906 if ($interface->name eq "Window") { 1906 if ($interface->name eq "Window") {
1907 $code .= " if (!imp->document())\n"; 1907 $code .= " if (!imp->document())\n";
1908 $code .= " return;\n"; 1908 $code .= " return;\n";
1909 } 1909 }
1910 } else { 1910 } else {
1911 $code .= JSValueToNativeStatement($attribute->type, $attribute->extended Attributes, "jsValue", "cppValue", " ", "info.GetIsolate()"); 1911 my $asSetterValue = 0;
1912 $code .= JSValueToNativeStatement($attribute->type, $attribute->extended Attributes, $asSetterValue, "jsValue", "cppValue", " ", "info.GetIsolate()");
1912 } 1913 }
1913 1914
1914 if (IsEnumType($attrType)) { 1915 if (IsEnumType($attrType)) {
1915 # setter ignores invalid enumeration values 1916 # setter ignores invalid enumeration values
1916 my @enumValues = ValidEnumValues($attrType); 1917 my @enumValues = ValidEnumValues($attrType);
1917 my @validEqualities = (); 1918 my @validEqualities = ();
1918 foreach my $enumValue (@enumValues) { 1919 foreach my $enumValue (@enumValues) {
1919 push(@validEqualities, "string == \"$enumValue\""); 1920 push(@validEqualities, "string == \"$enumValue\"");
1920 } 1921 }
1921 my $enumValidationExpression = join(" || ", @validEqualities); 1922 my $enumValidationExpression = join(" || ", @validEqualities);
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 } 2497 }
2497 } elsif ($nativeType =~ /^V8StringResource/) { 2498 } elsif ($nativeType =~ /^V8StringResource/) {
2498 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; 2499 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : "";
2499 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(args, $paramIndex)" : "args[$paramIndex]"; 2500 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(args, $paramIndex)" : "args[$paramIndex]";
2500 my $stringResourceParameterName = $parameterName; 2501 my $stringResourceParameterName = $parameterName;
2501 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter- >type); 2502 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter- >type);
2502 if ($isNullable) { 2503 if ($isNullable) {
2503 $parameterCheckString .= " bool ${parameterName}IsNull = $jsV alue->IsNull();\n"; 2504 $parameterCheckString .= " bool ${parameterName}IsNull = $jsV alue->IsNull();\n";
2504 $stringResourceParameterName .= "StringResource"; 2505 $stringResourceParameterName .= "StringResource";
2505 } 2506 }
2506 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $jsValue, $stringResourceParameterName, " ", "args.GetIsolate()"); 2507 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $stringResourcePa rameterName, " ", "args.GetIsolate()");
2507 $parameterCheckString .= " String $parameterName = $stringResourc eParameterName;\n" if $isNullable; 2508 $parameterCheckString .= " String $parameterName = $stringResourc eParameterName;\n" if $isNullable;
2508 if (IsEnumType($parameter->type)) { 2509 if (IsEnumType($parameter->type)) {
2509 my @enumValues = ValidEnumValues($parameter->type); 2510 my @enumValues = ValidEnumValues($parameter->type);
2510 my @validEqualities = (); 2511 my @validEqualities = ();
2511 foreach my $enumValue (@enumValues) { 2512 foreach my $enumValue (@enumValues) {
2512 push(@validEqualities, "string == \"$enumValue\""); 2513 push(@validEqualities, "string == \"$enumValue\"");
2513 } 2514 }
2514 my $enumValidationExpression = join(" || ", @validEqualities); 2515 my $enumValidationExpression = join(" || ", @validEqualities);
2515 $parameterCheckString .= " String string = $parameterName;\n "; 2516 $parameterCheckString .= " String string = $parameterName;\n ";
2516 $parameterCheckString .= " if (!($enumValidationExpression)) {\n"; 2517 $parameterCheckString .= " if (!($enumValidationExpression)) {\n";
(...skipping 15 matching lines...) Expand all
2532 $parameterCheckString .= " if (args.Length() > $paramInde x && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue, args .GetIsolate(), worldType(args.GetIsolate()))) {\n"; 2533 $parameterCheckString .= " if (args.Length() > $paramInde x && !isUndefinedOrNull($argValue) && !V8${argType}::HasInstance($argValue, args .GetIsolate(), worldType(args.GetIsolate()))) {\n";
2533 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma nFriendlyIndex is not of type \'$argType\'.\"), args.GetIsolate());\n"; 2534 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter $huma nFriendlyIndex is not of type \'$argType\'.\"), args.GetIsolate());\n";
2534 $parameterCheckString .= " return;\n"; 2535 $parameterCheckString .= " return;\n";
2535 $parameterCheckString .= " }\n"; 2536 $parameterCheckString .= " }\n";
2536 } 2537 }
2537 } 2538 }
2538 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : ""; 2539 my $default = defined $parameter->extendedAttributes->{"Default"} ? $parameter->extendedAttributes->{"Default"} : "";
2539 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(args, $paramIndex)" : "args[$paramIndex]"; 2540 my $jsValue = $parameter->isOptional && $default eq "NullString" ? " argumentOrNull(args, $paramIndex)" : "args[$paramIndex]";
2540 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter- >type); 2541 my $isNullable = $parameter->isNullable && !IsRefPtrType($parameter- >type);
2541 $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue ->IsNull();\n" if $isNullable; 2542 $parameterCheckString .= " bool ${parameterName}IsNull = $jsValue ->IsNull();\n" if $isNullable;
2542 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $jsValue, $parameterName, " ", "args.GetIsola te()"); 2543 $parameterCheckString .= JSValueToNativeStatement($parameter->type, $parameter->extendedAttributes, $humanFriendlyIndex, $jsValue, $parameterName, " ", "args.GetIsolate()");
2543 if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') { 2544 if ($nativeType eq 'Dictionary' or $nativeType eq 'ScriptPromise') {
2544 $parameterCheckString .= " if (!$parameterName.isUndefinedOrN ull() && !$parameterName.isObject()) {\n"; 2545 $parameterCheckString .= " if (!$parameterName.isUndefinedOrN ull() && !$parameterName.isObject()) {\n";
2545 if ($functionName eq "Constructor") { 2546 if ($functionName eq "Constructor") {
2546 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToConstruct(\"$interfaceName\", \"parameter ${humanFriendlyIndex} ('${parameterName}') is not an object.\"), args.GetIsolate());\n"; 2547 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToConstruct(\"$interfaceName\", \"parameter ${humanFriendlyIndex} ('${parameterName}') is not an object.\"), args.GetIsolate());\n";
2547 } else { 2548 } else {
2548 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter ${hum anFriendlyIndex} ('${parameterName}') is not an object.\"), args.GetIsolate());\ n"; 2549 $parameterCheckString .= " throwTypeError(ExceptionMe ssages::failedToExecute(\"$functionName\", \"$interfaceName\", \"parameter ${hum anFriendlyIndex} ('${parameterName}') is not an object.\"), args.GetIsolate());\ n";
2549 } 2550 }
2550 $parameterCheckString .= " return;\n"; 2551 $parameterCheckString .= " return;\n";
2551 $parameterCheckString .= " }\n"; 2552 $parameterCheckString .= " }\n";
2552 } 2553 }
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
3492 my $interface = shift; 3493 my $interface = shift;
3493 my $indexedSetterFunction = shift; 3494 my $indexedSetterFunction = shift;
3494 my $implClassName = GetImplName($interface); 3495 my $implClassName = GetImplName($interface);
3495 my $v8ClassName = GetV8ClassName($interface); 3496 my $v8ClassName = GetV8ClassName($interface);
3496 my $methodName = GetImplName($indexedSetterFunction); 3497 my $methodName = GetImplName($indexedSetterFunction);
3497 3498
3498 my $type = $indexedSetterFunction->parameters->[1]->type; 3499 my $type = $indexedSetterFunction->parameters->[1]->type;
3499 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE xception"}; 3500 my $raisesExceptions = $indexedSetterFunction->extendedAttributes->{"RaisesE xception"};
3500 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute s->{"TreatNullAs"}; 3501 my $treatNullAs = $indexedSetterFunction->parameters->[1]->extendedAttribute s->{"TreatNullAs"};
3501 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr ibutes->{"TreatUndefinedAs"}; 3502 my $treatUndefinedAs = $indexedSetterFunction->parameters->[1]->extendedAttr ibutes->{"TreatUndefinedAs"};
3503 my $asSetterValue = 0;
3504
3502 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8:: Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; 3505 my $code = "static void indexedPropertySetter(uint32_t index, v8::Local<v8:: Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n";
3503 $code .= "{\n"; 3506 $code .= "{\n";
3504 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n"; 3507 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n";
3505 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t ype, $indexedSetterFunction->extendedAttributes, "jsValue", "propertyValue", " ", "info.GetIsolate()"); 3508 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro pertyValue", " ", "info.GetIsolate()");
3506 3509
3507 my $extraArguments = ""; 3510 my $extraArguments = "";
3508 if ($raisesExceptions) { 3511 if ($raisesExceptions) {
3509 $code .= " ExceptionState es(info.GetIsolate());\n"; 3512 $code .= " ExceptionState es(info.GetIsolate());\n";
3510 $extraArguments = ", es"; 3513 $extraArguments = ", es";
3511 } 3514 }
3512 my @conditions = (); 3515 my @conditions = ();
3513 my @statements = (); 3516 my @statements = ();
3514 if ($treatNullAs && $treatNullAs ne "NullString") { 3517 if ($treatNullAs && $treatNullAs ne "NullString") {
3515 push @conditions, "jsValue->IsNull()"; 3518 push @conditions, "jsValue->IsNull()";
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
3794 { 3797 {
3795 my $interface = shift; 3798 my $interface = shift;
3796 my $namedSetterFunction = shift; 3799 my $namedSetterFunction = shift;
3797 my $implClassName = GetImplName($interface); 3800 my $implClassName = GetImplName($interface);
3798 my $v8ClassName = GetV8ClassName($interface); 3801 my $v8ClassName = GetV8ClassName($interface);
3799 my $methodName = GetImplName($namedSetterFunction); 3802 my $methodName = GetImplName($namedSetterFunction);
3800 3803
3801 my $raisesExceptions = $namedSetterFunction->extendedAttributes->{"RaisesExc eption"}; 3804 my $raisesExceptions = $namedSetterFunction->extendedAttributes->{"RaisesExc eption"};
3802 my $treatNullAs = $namedSetterFunction->parameters->[1]->extendedAttributes- >{"TreatNullAs"}; 3805 my $treatNullAs = $namedSetterFunction->parameters->[1]->extendedAttributes- >{"TreatNullAs"};
3803 my $treatUndefinedAs = $namedSetterFunction->parameters->[1]->extendedAttrib utes->{"TreatUndefinedAs"}; 3806 my $treatUndefinedAs = $namedSetterFunction->parameters->[1]->extendedAttrib utes->{"TreatUndefinedAs"};
3807 my $asSetterValue = 0;
3804 3808
3805 my $code = "static void namedPropertySetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n"; 3809 my $code = "static void namedPropertySetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<v8::Value>& info)\n";
3806 $code .= "{\n"; 3810 $code .= "{\n";
3807 if (!$namedSetterFunction->extendedAttributes->{"OverrideBuiltins"}) { 3811 if (!$namedSetterFunction->extendedAttributes->{"OverrideBuiltins"}) {
3808 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n ame).IsEmpty())\n"; 3812 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n ame).IsEmpty())\n";
3809 $code .= " return;\n"; 3813 $code .= " return;\n";
3810 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; 3814 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n";
3811 $code .= " return;\n"; 3815 $code .= " return;\n";
3812 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n"; 3816 $code .= " if (info.Holder()->HasRealNamedProperty(name))\n";
3813 $code .= " return;\n"; 3817 $code .= " return;\n";
3814 } 3818 }
3815 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n"; 3819 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H older());\n";
3816 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ e, $namedSetterFunction->extendedAttributes, "name", "propertyName", " ", "in fo.GetIsolate()"); 3820 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa me", " ", "info.GetIsolate()");
3817 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ e, $namedSetterFunction->extendedAttributes, "jsValue", "propertyValue", " ", "info.GetIsolate()"); 3821 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert yValue", " ", "info.GetIsolate()");
3818 my $extraArguments = ""; 3822 my $extraArguments = "";
3819 if ($raisesExceptions) { 3823 if ($raisesExceptions) {
3820 $code .= " ExceptionState es(info.GetIsolate());\n"; 3824 $code .= " ExceptionState es(info.GetIsolate());\n";
3821 $extraArguments = ", es"; 3825 $extraArguments = ", es";
3822 } 3826 }
3823 3827
3824 my @conditions = (); 3828 my @conditions = ();
3825 my @statements = (); 3829 my @statements = ();
3826 if ($treatNullAs && $treatNullAs ne "NullString") { 3830 if ($treatNullAs && $treatNullAs ne "NullString") {
3827 push @conditions, "jsValue->IsNull()"; 3831 push @conditions, "jsValue->IsNull()";
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
5239 # Callbacks use raw pointers, so pass isParameter = 1 5243 # Callbacks use raw pointers, so pass isParameter = 1
5240 my $nativeType = GetNativeType($type, {}, "parameter"); 5244 my $nativeType = GetNativeType($type, {}, "parameter");
5241 return "const $nativeType&" if $nativeType =~ /^Vector/; 5245 return "const $nativeType&" if $nativeType =~ /^Vector/;
5242 return $nativeType; 5246 return $nativeType;
5243 } 5247 }
5244 5248
5245 sub JSValueToNativeStatement 5249 sub JSValueToNativeStatement
5246 { 5250 {
5247 my $type = shift; 5251 my $type = shift;
5248 my $extendedAttributes = shift; 5252 my $extendedAttributes = shift;
5253 my $argIndexOrZero = shift;
5249 my $jsValue = shift; 5254 my $jsValue = shift;
5250 my $variableName = shift; 5255 my $variableName = shift;
5251 my $indent = shift; 5256 my $indent = shift;
5252 my $getIsolate = shift; 5257 my $getIsolate = shift;
5253 5258
5254 my $nativeType = GetNativeType($type, $extendedAttributes, "parameter"); 5259 my $nativeType = GetNativeType($type, $extendedAttributes, "parameter");
5255 my $native_value = JSValueToNative($type, $extendedAttributes, $jsValue, $ge tIsolate); 5260 my $native_value = JSValueToNative($type, $extendedAttributes, $argIndexOrZe ro, $jsValue, $getIsolate);
5256 my $code = ""; 5261 my $code = "";
5257 if ($type eq "DOMString" || IsEnumType($type)) { 5262 if ($type eq "DOMString" || IsEnumType($type)) {
5258 die "Wrong native type passed: $nativeType" unless $nativeType =~ /^V8St ringResource/; 5263 die "Wrong native type passed: $nativeType" unless $nativeType =~ /^V8St ringResource/;
5259 if ($type eq "DOMString" or IsEnumType($type)) { 5264 if ($type eq "DOMString" or IsEnumType($type)) {
5260 $code .= $indent . "V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID($nativeType , $variableName, $native_value);\n" 5265 $code .= $indent . "V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID($nativeType , $variableName, $native_value);\n"
5261 } else { 5266 } else {
5262 $code .= $indent . "$nativeType $variableName($native_value, true);\ n"; 5267 $code .= $indent . "$nativeType $variableName($native_value, true);\ n";
5263 } 5268 }
5264 } elsif ($extendedAttributes->{"EnforceRange"}) { 5269 } elsif ($extendedAttributes->{"EnforceRange"}) {
5265 $code .= $indent . "V8TRYCATCH_WITH_TYPECHECK_VOID($nativeType, $variabl eName, $native_value, $getIsolate);\n"; 5270 $code .= $indent . "V8TRYCATCH_WITH_TYPECHECK_VOID($nativeType, $variabl eName, $native_value, $getIsolate);\n";
5266 } else { 5271 } else {
5267 $code .= $indent . "V8TRYCATCH_VOID($nativeType, $variableName, $native_ value);\n"; 5272 $code .= $indent . "V8TRYCATCH_VOID($nativeType, $variableName, $native_ value);\n";
5268 } 5273 }
5269 return $code; 5274 return $code;
5270 } 5275 }
5271 5276
5272 5277
5273 sub JSValueToNative 5278 sub JSValueToNative
5274 { 5279 {
5275 my $type = shift; 5280 my $type = shift;
5276 my $extendedAttributes = shift; 5281 my $extendedAttributes = shift;
5282 # Argument position (1-indexed) or 0 if for a setter's value.
5283 my $argIndexOrZero = shift;
5277 my $value = shift; 5284 my $value = shift;
5278 my $getIsolate = shift; 5285 my $getIsolate = shift;
5279 5286
5280 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion"; 5287 my $intConversion = $extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
5281 5288
5282 return "$value->BooleanValue()" if $type eq "boolean"; 5289 return "$value->BooleanValue()" if $type eq "boolean";
5283 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double"; 5290 return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $t ype eq "double";
5284 5291
5285 if ($intConversion ne "NormalConversion") { 5292 if ($intConversion ne "NormalConversion") {
5286 return "toInt8($value, $intConversion, ok)" if $type eq "byte"; 5293 return "toInt8($value, $intConversion, ok)" if $type eq "byte";
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
5345 5352
5346 if ($type eq "XPathNSResolver") { 5353 if ($type eq "XPathNSResolver") {
5347 return "toXPathNSResolver($value, $getIsolate)"; 5354 return "toXPathNSResolver($value, $getIsolate)";
5348 } 5355 }
5349 5356
5350 my $arrayOrSequenceType = GetArrayOrSequenceType($type); 5357 my $arrayOrSequenceType = GetArrayOrSequenceType($type);
5351 5358
5352 if ($arrayOrSequenceType) { 5359 if ($arrayOrSequenceType) {
5353 if (IsRefPtrType($arrayOrSequenceType)) { 5360 if (IsRefPtrType($arrayOrSequenceType)) {
5354 AddToImplIncludes("V8${arrayOrSequenceType}.h"); 5361 AddToImplIncludes("V8${arrayOrSequenceType}.h");
5355 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $getIsolate))"; 5362 return "(toRefPtrNativeArray<${arrayOrSequenceType}, V8${arrayOrSequ enceType}>($value, $argIndexOrZero, $getIsolate))";
5356 } 5363 }
5357 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $getIsolate)"; 5364 return "toNativeArray<" . GetNativeType($arrayOrSequenceType) . ">($valu e, $argIndexOrZero, $getIsolate)";
5358 } 5365 }
5359 5366
5360 AddIncludesForType($type); 5367 AddIncludesForType($type);
5361 5368
5362 AddToImplIncludes("V8${type}.h"); 5369 AddToImplIncludes("V8${type}.h");
5363 return "V8${type}::HasInstance($value, $getIsolate, worldType($getIsolate)) ? V8${type}::toNative(v8::Handle<v8::Object>::Cast($value)) : 0"; 5370 return "V8${type}::HasInstance($value, $getIsolate, worldType($getIsolate)) ? V8${type}::toNative(v8::Handle<v8::Object>::Cast($value)) : 0";
5364 } 5371 }
5365 5372
5366 sub CreateCustomSignature 5373 sub CreateCustomSignature
5367 { 5374 {
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
6196 my $interface = shift; 6203 my $interface = shift;
6197 6204
6198 return 1 if $interface->extendedAttributes->{"CustomToV8"}; 6205 return 1 if $interface->extendedAttributes->{"CustomToV8"};
6199 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; 6206 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"};
6200 return 1 if InheritsInterface($interface, "Document"); 6207 return 1 if InheritsInterface($interface, "Document");
6201 6208
6202 return 0; 6209 return 0;
6203 } 6210 }
6204 6211
6205 1; 6212 1;
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/init-message-event-expected.txt ('k') | Source/bindings/scripts/unstable/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698