| OLD | NEW |
| 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 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 if (IsRefPtrType($returnType) && !GetArrayType($returnType)) { | 2009 if (IsRefPtrType($returnType) && !GetArrayType($returnType)) { |
| 2010 $expression = "WTF::getPtr(" . $expression . ")"; | 2010 $expression = "WTF::getPtr(" . $expression . ")"; |
| 2011 } | 2011 } |
| 2012 | 2012 |
| 2013 $code .= GenerateCustomElementInvocationScopeIfNeeded($attribute->extendedAt
tributes); | 2013 $code .= GenerateCustomElementInvocationScopeIfNeeded($attribute->extendedAt
tributes); |
| 2014 | 2014 |
| 2015 my $returnSvgNativeType = GetSVGTypeNeedingTearOff($returnType); | 2015 my $returnSvgNativeType = GetSVGTypeNeedingTearOff($returnType); |
| 2016 if ($returnSvgNativeType) { | 2016 if ($returnSvgNativeType) { |
| 2017 $code .= <<END; | 2017 $code .= <<END; |
| 2018 if (!$expression) { | 2018 if (!$expression) { |
| 2019 throwUninformativeAndGenericTypeError(info.GetIsolate()); | 2019 throwTypeError(ExceptionMessages::failedToSet(\"${attrName}\", \"${inter
faceName}\", \"The provided value is not of type '$returnType'.\"), info.GetIsol
ate()); |
| 2020 return; | 2020 return; |
| 2021 } | 2021 } |
| 2022 END | 2022 END |
| 2023 $expression = $expression . "->propertyReference()"; | 2023 $expression = $expression . "->propertyReference()"; |
| 2024 } | 2024 } |
| 2025 | 2025 |
| 2026 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; | 2026 my $raisesException = $attribute->extendedAttributes->{"RaisesException"}; |
| 2027 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_
MISSING" or $raisesException eq "Setter"); | 2027 my $useExceptions = 1 if $raisesException && ($raisesException eq "VALUE_IS_
MISSING" or $raisesException eq "Setter"); |
| 2028 | 2028 |
| 2029 if ($useExceptions) { | 2029 if ($useExceptions) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 $code .= " return;\n"; | 2239 $code .= " return;\n"; |
| 2240 $code .= " }\n"; | 2240 $code .= " }\n"; |
| 2241 } | 2241 } |
| 2242 if ($leastNumMandatoryParams >= 1) { | 2242 if ($leastNumMandatoryParams >= 1) { |
| 2243 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; | 2243 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; |
| 2244 $code .= " throwTypeError(ExceptionMessages::failedToExecute(\"$n
ame\", \"$interfaceName\", ExceptionMessages::notEnoughArguments($leastNumMandat
oryParams, info.Length())), info.GetIsolate());\n"; | 2244 $code .= " throwTypeError(ExceptionMessages::failedToExecute(\"$n
ame\", \"$interfaceName\", ExceptionMessages::notEnoughArguments($leastNumMandat
oryParams, info.Length())), info.GetIsolate());\n"; |
| 2245 $code .= " return;\n"; | 2245 $code .= " return;\n"; |
| 2246 $code .= " }\n"; | 2246 $code .= " }\n"; |
| 2247 } | 2247 } |
| 2248 $code .= <<END; | 2248 $code .= <<END; |
| 2249 throwUninformativeAndGenericTypeError(info.GetIsolate()); | 2249 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfaceNam
e\", \"No function was found that matched the signature provided.\"), info.GetIs
olate()); |
| 2250 END | 2250 END |
| 2251 $code .= "}\n\n"; | 2251 $code .= "}\n\n"; |
| 2252 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 2252 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
| 2253 $implementation{nameSpaceInternal}->add($code); | 2253 $implementation{nameSpaceInternal}->add($code); |
| 2254 } | 2254 } |
| 2255 | 2255 |
| 2256 sub GenerateFunctionCallback | 2256 sub GenerateFunctionCallback |
| 2257 { | 2257 { |
| 2258 my $function = shift; | 2258 my $function = shift; |
| 2259 my $interface = shift; | 2259 my $interface = shift; |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2682 } | 2682 } |
| 2683 if ($leastNumMandatoryParams >= 1) { | 2683 if ($leastNumMandatoryParams >= 1) { |
| 2684 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); | 2684 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
| 2685 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; | 2685 $code .= " if (UNLIKELY(info.Length() < $leastNumMandatoryParams)) {\
n"; |
| 2686 | 2686 |
| 2687 $code .= " throwTypeError(ExceptionMessages::failedToConstruct(\"
$interfaceName\", ExceptionMessages::notEnoughArguments($leastNumMandatoryParams
, info.Length())), info.GetIsolate());\n"; | 2687 $code .= " throwTypeError(ExceptionMessages::failedToConstruct(\"
$interfaceName\", ExceptionMessages::notEnoughArguments($leastNumMandatoryParams
, info.Length())), info.GetIsolate());\n"; |
| 2688 $code .= " return;\n"; | 2688 $code .= " return;\n"; |
| 2689 $code .= " }\n"; | 2689 $code .= " }\n"; |
| 2690 } | 2690 } |
| 2691 $code .= <<END; | 2691 $code .= <<END; |
| 2692 throwUninformativeAndGenericTypeError(info.GetIsolate()); | 2692 throwTypeError(ExceptionMessages::failedToConstruct(\"$interfaceName\", \"No
matching constructor signature.\"), info.GetIsolate()); |
| 2693 return; | 2693 return; |
| 2694 END | 2694 END |
| 2695 $code .= "}\n\n"; | 2695 $code .= "}\n\n"; |
| 2696 $implementation{nameSpaceInternal}->add($code); | 2696 $implementation{nameSpaceInternal}->add($code); |
| 2697 } | 2697 } |
| 2698 | 2698 |
| 2699 sub GenerateSingleConstructorCallback | 2699 sub GenerateSingleConstructorCallback |
| 2700 { | 2700 { |
| 2701 my $interface = shift; | 2701 my $interface = shift; |
| 2702 my $function = shift; | 2702 my $function = shift; |
| (...skipping 2425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5128 my $implClassName = GetImplName($interface); | 5128 my $implClassName = GetImplName($interface); |
| 5129 my $name = GetImplName($function); | 5129 my $name = GetImplName($function); |
| 5130 my $returnType = $function->type; | 5130 my $returnType = $function->type; |
| 5131 my $nativeReturnType = GetNativeType($returnType, {}, ""); | 5131 my $nativeReturnType = GetNativeType($returnType, {}, ""); |
| 5132 my $code = ""; | 5132 my $code = ""; |
| 5133 | 5133 |
| 5134 my $isSVGTearOffType = (IsSVGTypeNeedingTearOff($returnType) and not $interf
aceName =~ /List$/); | 5134 my $isSVGTearOffType = (IsSVGTypeNeedingTearOff($returnType) and not $interf
aceName =~ /List$/); |
| 5135 $nativeReturnType = GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTe
arOffType; | 5135 $nativeReturnType = GetSVGWrappedTypeNeedingTearOff($returnType) if $isSVGTe
arOffType; |
| 5136 | 5136 |
| 5137 my $index = 0; | 5137 my $index = 0; |
| 5138 my $humanFriendlyIndex = $index + 1; |
| 5138 | 5139 |
| 5139 my @arguments; | 5140 my @arguments; |
| 5140 my $functionName; | 5141 my $functionName; |
| 5141 my $implementedBy = $function->extendedAttributes->{"ImplementedBy"}; | 5142 my $implementedBy = $function->extendedAttributes->{"ImplementedBy"}; |
| 5142 if ($implementedBy) { | 5143 if ($implementedBy) { |
| 5143 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy)
; | 5144 my $implementedByImplName = GetImplNameFromImplementedBy($implementedBy)
; |
| 5144 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy
ImplName)); | 5145 AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implementedBy
ImplName)); |
| 5145 unshift(@arguments, "imp") if !$function->isStatic; | 5146 unshift(@arguments, "imp") if !$function->isStatic; |
| 5146 $functionName = "${implementedByImplName}::${name}"; | 5147 $functionName = "${implementedByImplName}::${name}"; |
| 5147 } elsif ($function->isStatic) { | 5148 } elsif ($function->isStatic) { |
| 5148 $functionName = "${implClassName}::${name}"; | 5149 $functionName = "${implClassName}::${name}"; |
| 5149 } else { | 5150 } else { |
| 5150 $functionName = "imp->${name}"; | 5151 $functionName = "imp->${name}"; |
| 5151 } | 5152 } |
| 5152 | 5153 |
| 5153 my $callWith = $function->extendedAttributes->{"CallWith"}; | 5154 my $callWith = $function->extendedAttributes->{"CallWith"}; |
| 5154 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 1, $func
tion); | 5155 my ($callWithArgs, $subCode) = GenerateCallWith($callWith, $indent, 1, $func
tion); |
| 5155 $code .= $subCode; | 5156 $code .= $subCode; |
| 5156 unshift(@arguments, @$callWithArgs); | 5157 unshift(@arguments, @$callWithArgs); |
| 5157 $index += @$callWithArgs; | 5158 $index += @$callWithArgs; |
| 5159 $humanFriendlyIndex = $index + 1; |
| 5160 |
| 5158 $numberOfParameters += @$callWithArgs; | 5161 $numberOfParameters += @$callWithArgs; |
| 5159 | 5162 |
| 5160 foreach my $parameter (@{$function->parameters}) { | 5163 foreach my $parameter (@{$function->parameters}) { |
| 5161 if ($index eq $numberOfParameters) { | 5164 if ($index eq $numberOfParameters) { |
| 5162 last; | 5165 last; |
| 5163 } | 5166 } |
| 5164 my $paramName = $parameter->name; | 5167 my $paramName = $parameter->name; |
| 5165 my $paramType = $parameter->type; | 5168 my $paramType = $parameter->type; |
| 5166 | 5169 |
| 5167 if ($replacements{$paramName}) { | 5170 if ($replacements{$paramName}) { |
| 5168 push @arguments, $replacements{$paramName}; | 5171 push @arguments, $replacements{$paramName}; |
| 5169 } elsif ($parameter->type eq "NodeFilter" || $parameter->type eq "XPathN
SResolver") { | 5172 } elsif ($parameter->type eq "NodeFilter" || $parameter->type eq "XPathN
SResolver") { |
| 5170 push @arguments, "$paramName.get()"; | 5173 push @arguments, "$paramName.get()"; |
| 5171 } elsif (IsSVGTypeNeedingTearOff($parameter->type) and not $interfaceNam
e =~ /List$/) { | 5174 } elsif (IsSVGTypeNeedingTearOff($parameter->type) and not $interfaceNam
e =~ /List$/) { |
| 5172 AddToImplIncludes("core/dom/ExceptionCode.h"); | 5175 AddToImplIncludes("bindings/v8/ExceptionMessages.h"); |
| 5173 push @arguments, "$paramName->propertyReference()"; | 5176 push @arguments, "$paramName->propertyReference()"; |
| 5174 $code .= <<END; | 5177 $code .= <<END; |
| 5175 if (!$paramName) { | 5178 if (!$paramName) { |
| 5176 throwUninformativeAndGenericTypeError(info.GetIsolate()); | 5179 throwTypeError(ExceptionMessages::failedToExecute(\"$name\", \"$interfac
eName\", \"parameter $humanFriendlyIndex is not of type '${ \$parameter->type }'
.\"), info.GetIsolate()); |
| 5177 return; | 5180 return; |
| 5178 } | 5181 } |
| 5179 END | 5182 END |
| 5180 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans
formList") { | 5183 } elsif ($parameter->type eq "SVGMatrix" and $interfaceName eq "SVGTrans
formList") { |
| 5181 push @arguments, "$paramName.get()"; | 5184 push @arguments, "$paramName.get()"; |
| 5182 } elsif ($parameter->isNullable && !IsRefPtrType($parameter->type)) { | 5185 } elsif ($parameter->isNullable && !IsRefPtrType($parameter->type)) { |
| 5183 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; | 5186 push @arguments, "${paramName}IsNull ? 0 : &$paramName"; |
| 5184 } else { | 5187 } else { |
| 5185 push @arguments, $paramName; | 5188 push @arguments, $paramName; |
| 5186 } | 5189 } |
| 5187 $index++; | 5190 $index++; |
| 5191 $humanFriendlyIndex = $index + 1; |
| 5188 } | 5192 } |
| 5189 | 5193 |
| 5190 if ($function->extendedAttributes->{"RaisesException"}) { | 5194 if ($function->extendedAttributes->{"RaisesException"}) { |
| 5191 push @arguments, "exceptionState"; | 5195 push @arguments, "exceptionState"; |
| 5192 } | 5196 } |
| 5193 | 5197 |
| 5194 my $functionString = "$functionName(" . join(", ", @arguments) . ")"; | 5198 my $functionString = "$functionName(" . join(", ", @arguments) . ")"; |
| 5195 | 5199 |
| 5196 my $return = "result"; | 5200 my $return = "result"; |
| 5197 my $returnIsRef = IsRefPtrType($returnType); | 5201 my $returnIsRef = IsRefPtrType($returnType); |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6306 my $interface = shift; | 6310 my $interface = shift; |
| 6307 | 6311 |
| 6308 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6312 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6309 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6313 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6310 return 1 if InheritsInterface($interface, "Document"); | 6314 return 1 if InheritsInterface($interface, "Document"); |
| 6311 | 6315 |
| 6312 return 0; | 6316 return 0; |
| 6313 } | 6317 } |
| 6314 | 6318 |
| 6315 1; | 6319 1; |
| OLD | NEW |