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

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

Issue 99333017: IDL compiler: simplify type conversion in Event Constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix layout test result (error text) Created 7 years 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
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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 3013
3014 END 3014 END
3015 } 3015 }
3016 3016
3017 foreach my $attribute (@{$interface->attributes}) { 3017 foreach my $attribute (@{$interface->attributes}) {
3018 if ($attribute->extendedAttributes->{"InitializedByEventConstructor"}) { 3018 if ($attribute->extendedAttributes->{"InitializedByEventConstructor"}) {
3019 if ($attribute->type ne "any") { 3019 if ($attribute->type ne "any") {
3020 my $attributeName = $attribute->name; 3020 my $attributeName = $attribute->name;
3021 my $attributeImplName = GetImplName($attribute); 3021 my $attributeImplName = GetImplName($attribute);
3022 3022
3023 # Construct the arguments to the corresponding Dictionary.conver t() method. 3023 my $isNullable = $attribute->isNullable ? "true" : "false";
3024 my @convertArguments = (); 3024 my $dictionaryGetter = "options.convert(conversionContext.setCon versionType(\"" . $attribute->type . "\", $isNullable), \"$attributeName\", even tInit.$attributeImplName)";
3025 if ($attribute->extendedAttributes->{"EnforceRange"}) {
3026 push(@convertArguments, "EnforceRange");
3027 } elsif ($attribute->extendedAttributes->{"Clamp"}) {
3028 push(@convertArguments, "Clamp");
3029 } elsif (IsIntegerType($attribute->type)) {
3030 push(@convertArguments, "NormalConversion");
3031 } elsif ($attribute->type eq "boolean" || $attribute->type eq "d ouble") {
3032 ;
3033 } elsif ($attribute->type eq "DOMString" || IsEnumType($attribut e->type) || IsCallbackFunctionType($attribute->type)) {
3034 ;
3035 } elsif ($attribute->type ne "object") {
3036 push(@convertArguments, "\"" . $attribute->type . "\"");
3037 }
3038
3039 my $withPropertyAttributes = "";
3040 if (@convertArguments || $attribute->isNullable) {
3041 unshift(@convertArguments, $attribute->isNullable ? "true" : "false");
3042 $withPropertyAttributes = ".withAttributes(" . join(", ", @c onvertArguments) . ")";
3043 }
3044
3045 my $dictionaryGetter = "options.convert(conversionContext${withP ropertyAttributes}, \"$attributeName\", eventInit.$attributeImplName)";
3046 my $deprecation = $attribute->extendedAttributes->{"DeprecateAs" }; 3025 my $deprecation = $attribute->extendedAttributes->{"DeprecateAs" };
3047 if ($deprecation) { 3026 if ($deprecation) {
3048 $code .= " if ($dictionaryGetter) {\n"; 3027 $code .= " if ($dictionaryGetter) {\n";
3049 $code .= " if (options.hasProperty(\"$attributeName\" ))\n"; 3028 $code .= " if (options.hasProperty(\"$attributeName\" ))\n";
3050 $code .= " " . GenerateDeprecationNotification($depre cation); 3029 $code .= " " . GenerateDeprecationNotification($depre cation);
3051 $code .= " } else {\n"; 3030 $code .= " } else {\n";
3052 $code .= " return false;\n"; 3031 $code .= " return false;\n";
3053 $code .= " }\n"; 3032 $code .= " }\n";
3054 } else { 3033 } else {
3055 $code .= " if (!$dictionaryGetter)\n"; 3034 $code .= " if (!$dictionaryGetter)\n";
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
6376 6355
6377 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "ToV8"); 6356 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "ToV8");
6378 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "Wrap"); 6357 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "Wrap");
6379 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; 6358 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"};
6380 return 1 if InheritsInterface($interface, "Document"); 6359 return 1 if InheritsInterface($interface, "Document");
6381 6360
6382 return 0; 6361 return 0;
6383 } 6362 }
6384 6363
6385 1; 6364 1;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698