 Chromium Code Reviews
 Chromium Code Reviews Issue 99333017:
  IDL compiler: simplify type conversion in Event Constructor  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk
    
  
    Issue 99333017:
  IDL compiler: simplify type conversion in Event Constructor  (Closed) 
  Base URL: svn://svn.chromium.org/blink/trunk| 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 3002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 $numberConversion; | 
| 
Nils Barth (inactive)
2013/12/11 08:14:20
This is actually never used -- it's always NormalC
 | |
| 3025 if ($attribute->extendedAttributes->{"EnforceRange"}) { | 3025 if ($attribute->extendedAttributes->{"EnforceRange"}) { | 
| 3026 push(@convertArguments, "EnforceRange"); | 3026 $numberConversion = "EnforceRange"; | 
| 3027 } elsif ($attribute->extendedAttributes->{"Clamp"}) { | 3027 } elsif ($attribute->extendedAttributes->{"Clamp"}) { | 
| 3028 push(@convertArguments, "Clamp"); | 3028 $numberConversion = "Clamp"; | 
| 3029 } elsif (IsIntegerType($attribute->type)) { | 3029 } else { | 
| 3030 push(@convertArguments, "NormalConversion"); | 3030 $numberConversion = "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 } | 3031 } | 
| 3038 | 3032 my $dictionaryGetter = "options.convert(conversionContext.conver sionType($isNullable, $numberConversion, \"" . $attribute->type . "\"), \"$attri buteName\", eventInit.$attributeImplName)"; | 
| 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" }; | 3033 my $deprecation = $attribute->extendedAttributes->{"DeprecateAs" }; | 
| 3047 if ($deprecation) { | 3034 if ($deprecation) { | 
| 3048 $code .= " if ($dictionaryGetter) {\n"; | 3035 $code .= " if ($dictionaryGetter) {\n"; | 
| 3049 $code .= " if (options.hasProperty(\"$attributeName\" ))\n"; | 3036 $code .= " if (options.hasProperty(\"$attributeName\" ))\n"; | 
| 3050 $code .= " " . GenerateDeprecationNotification($depre cation); | 3037 $code .= " " . GenerateDeprecationNotification($depre cation); | 
| 3051 $code .= " } else {\n"; | 3038 $code .= " } else {\n"; | 
| 3052 $code .= " return false;\n"; | 3039 $code .= " return false;\n"; | 
| 3053 $code .= " }\n"; | 3040 $code .= " }\n"; | 
| 3054 } else { | 3041 } else { | 
| 3055 $code .= " if (!$dictionaryGetter)\n"; | 3042 $code .= " if (!$dictionaryGetter)\n"; | 
| (...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6376 | 6363 | 
| 6377 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "ToV8"); | 6364 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "ToV8"); | 
| 6378 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "Wrap"); | 6365 return 1 if ExtendedAttributeContains($interface->extendedAttributes->{"Cust om"}, "Wrap"); | 
| 6379 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6366 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 
| 6380 return 1 if InheritsInterface($interface, "Document"); | 6367 return 1 if InheritsInterface($interface, "Document"); | 
| 6381 | 6368 | 
| 6382 return 0; | 6369 return 0; | 
| 6383 } | 6370 } | 
| 6384 | 6371 | 
| 6385 1; | 6372 1; | 
| OLD | NEW |