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 3770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3781 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; | 3781 $code .= " ExceptionState exceptionState(info.Holder(), info.GetIsola
te());\n"; |
3782 if ($raisesExceptions) { | 3782 if ($raisesExceptions) { |
3783 $extraArguments = ", exceptionState"; | 3783 $extraArguments = ", exceptionState"; |
3784 } | 3784 } |
3785 } | 3785 } |
3786 | 3786 |
3787 my $asSetterValue = 0; | 3787 my $asSetterValue = 0; |
3788 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 3788 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
3789 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); | 3789 $code .= JSValueToNativeStatement($indexedSetterFunction->parameters->[1]->t
ype, $indexedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "pro
pertyValue", " ", "info.GetIsolate()"); |
3790 | 3790 |
3791 my @conditions = (); | 3791 if ($indexedSetterFunction->extendedAttributes->{"StrictTypeChecking"} && Is
WrapperType($type)) { |
3792 my @statements = (); | 3792 $code .= <<END; |
3793 if ($treatNullAs && $treatNullAs ne "NullString") { | 3793 if (!isUndefinedOrNull(jsValue) && !V8${type}::hasInstance(jsValue, info.Get
Isolate())) { |
3794 push @conditions, "jsValue->IsNull()"; | 3794 exceptionState.throwTypeError("The provided value is not of type '$type'
."); |
3795 push @statements, "collection->${treatNullAs}(index$extraArguments);"; | 3795 exceptionState.throwIfNeeded(); |
| 3796 return; |
3796 } | 3797 } |
3797 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { | 3798 END |
3798 push @conditions, "jsValue->IsUndefined()"; | |
3799 push @statements, "collection->${treatUndefinedAs}(index$extraArguments)
;"; | |
3800 } | 3799 } |
3801 push @conditions, ""; | 3800 |
3802 push @statements, "collection->${methodName}(index, propertyValue$extraArgum
ents);"; | 3801 $code .= " bool result = collection->${methodName}(index, propertyValue$e
xtraArguments);\n"; |
3803 $code .= GenerateIfElseStatement("bool", "result", \@conditions, \@statement
s); | |
3804 | 3802 |
3805 if ($raisesExceptions) { | 3803 if ($raisesExceptions) { |
3806 $code .= " if (exceptionState.throwIfNeeded())\n"; | 3804 $code .= " if (exceptionState.throwIfNeeded())\n"; |
3807 $code .= " return;\n"; | 3805 $code .= " return;\n"; |
3808 } | 3806 } |
3809 $code .= " if (!result)\n"; | 3807 $code .= " if (!result)\n"; |
3810 $code .= " return;\n"; | 3808 $code .= " return;\n"; |
3811 $code .= " v8SetReturnValue(info, jsValue);\n"; | 3809 $code .= " v8SetReturnValue(info, jsValue);\n"; |
3812 $code .= "}\n\n"; | 3810 $code .= "}\n\n"; |
3813 $implementation{nameSpaceInternal}->add($code); | 3811 $implementation{nameSpaceInternal}->add($code); |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4114 if ($raisesExceptions) { | 4112 if ($raisesExceptions) { |
4115 $extraArguments = ", exceptionState"; | 4113 $extraArguments = ", exceptionState"; |
4116 } | 4114 } |
4117 } | 4115 } |
4118 | 4116 |
4119 my $asSetterValue = 0; | 4117 my $asSetterValue = 0; |
4120 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; | 4118 $code .= " ${implClassName}* collection = ${v8ClassName}::toNative(info.H
older());\n"; |
4121 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); | 4119 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[0]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "name", "propertyNa
me", " ", "info.GetIsolate()"); |
4122 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); | 4120 $code .= JSValueToNativeStatement($namedSetterFunction->parameters->[1]->typ
e, $namedSetterFunction->extendedAttributes, $asSetterValue, "jsValue", "propert
yValue", " ", "info.GetIsolate()"); |
4123 | 4121 |
4124 my @conditions = (); | 4122 $code .= " bool result = collection->$methodName(propertyName, propertyVa
lue$extraArguments);\n"; |
4125 my @statements = (); | |
4126 if ($treatNullAs && $treatNullAs ne "NullString") { | |
4127 push @conditions, "jsValue->IsNull()"; | |
4128 push @statements, "collection->${treatNullAs}(propertyName$extraArgument
s);"; | |
4129 } | |
4130 if ($treatUndefinedAs && $treatUndefinedAs ne "NullString") { | |
4131 push @conditions, "jsValue->IsUndefined()"; | |
4132 push @statements, "collection->${treatUndefinedAs}(propertyName$extraArg
uments);"; | |
4133 } | |
4134 push @conditions, ""; | |
4135 push @statements, "collection->${methodName}(propertyName, propertyValue$ext
raArguments);"; | |
4136 $code .= GenerateIfElseStatement("bool", "result", \@conditions, \@statement
s); | |
4137 | |
4138 $code .= " if (!result)\n"; | 4123 $code .= " if (!result)\n"; |
4139 $code .= " return;\n"; | 4124 $code .= " return;\n"; |
4140 if ($raisesExceptions) { | 4125 if ($raisesExceptions) { |
4141 $code .= " if (exceptionState.throwIfNeeded())\n"; | 4126 $code .= " if (exceptionState.throwIfNeeded())\n"; |
4142 $code .= " return;\n"; | 4127 $code .= " return;\n"; |
4143 } | 4128 } |
4144 $code .= " v8SetReturnValue(info, jsValue);\n"; | 4129 $code .= " v8SetReturnValue(info, jsValue);\n"; |
4145 $code .= "}\n\n"; | 4130 $code .= "}\n\n"; |
4146 $implementation{nameSpaceInternal}->add($code); | 4131 $implementation{nameSpaceInternal}->add($code); |
4147 } | 4132 } |
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6435 if ($parameter->type eq "SerializedScriptValue") { | 6420 if ($parameter->type eq "SerializedScriptValue") { |
6436 return 1; | 6421 return 1; |
6437 } elsif (IsIntegerType($parameter->type)) { | 6422 } elsif (IsIntegerType($parameter->type)) { |
6438 return 1; | 6423 return 1; |
6439 } | 6424 } |
6440 } | 6425 } |
6441 return 0; | 6426 return 0; |
6442 } | 6427 } |
6443 | 6428 |
6444 1; | 6429 1; |
OLD | NEW |