Title: [141944] trunk/Source/WebCore
Revision
141944
Author
[email protected]
Date
2013-02-05 15:43:25 -0800 (Tue, 05 Feb 2013)

Log Message

[JSC] Clean up CodeGeneratorJS.pm by introducing HasCustom{Getter,Setter,Method}
https://bugs.webkit.org/show_bug.cgi?id=108898

Reviewed by Sam Weinig.

No tests. No change in behavior.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
(HasCustomGetter):
(HasCustomSetter):
(HasCustomMethod):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141943 => 141944)


--- trunk/Source/WebCore/ChangeLog	2013-02-05 23:42:19 UTC (rev 141943)
+++ trunk/Source/WebCore/ChangeLog	2013-02-05 23:43:25 UTC (rev 141944)
@@ -1,3 +1,19 @@
+2013-02-05  Kentaro Hara  <[email protected]>
+
+        [JSC] Clean up CodeGeneratorJS.pm by introducing HasCustom{Getter,Setter,Method}
+        https://bugs.webkit.org/show_bug.cgi?id=108898
+
+        Reviewed by Sam Weinig.
+
+        No tests. No change in behavior.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+        (GenerateImplementation):
+        (HasCustomGetter):
+        (HasCustomSetter):
+        (HasCustomMethod):
+
 2013-02-05  Dana Jansens  <[email protected]>
 
         [chromium] Provide compositor offscreen context through the WebLayerTreeViewClient interface

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (141943 => 141944)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-02-05 23:42:19 UTC (rev 141943)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-02-05 23:43:25 UTC (rev 141944)
@@ -896,9 +896,8 @@
     if ($numAttributes > 0) {
         foreach (@{$interface->attributes}) {
             my $attribute = $_;
-            $numCustomAttributes++ if $attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"};
-            $numCustomAttributes++ if ($attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCustomGetter"});
-            $numCustomAttributes++ if ($attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"});
+            $numCustomAttributes++ if HasCustomGetter($attribute->signature->extendedAttributes);
+            $numCustomAttributes++ if HasCustomSetter($attribute->signature->extendedAttributes);
             if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) {
                 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
                 push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
@@ -921,13 +920,13 @@
 
         foreach my $attribute (@{$interface->attributes}) {
             my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature);
-            if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCustomGetter"}) {
+            if (HasCustomGetter($attribute->signature->extendedAttributes)) {
                 push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
                 my $methodName = $codeGenerator->WK_lcfirst($attribute->signature->name);
                 push(@headerContent, "    JSC::JSValue " . $methodName . "(JSC::ExecState*) const;\n");
                 push(@headerContent, "#endif\n") if $conditionalString;
             }
-            if (($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) && !IsReadonly($attribute)) {
+            if (HasCustomSetter($attribute->signature->extendedAttributes) && !IsReadonly($attribute)) {
                 push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
                 push(@headerContent, "    void set" . $codeGenerator->WK_ucfirst($attribute->signature->name) . "(JSC::ExecState*, JSC::JSValue);\n");
                 push(@headerContent, "#endif\n") if $conditionalString;
@@ -936,13 +935,13 @@
     }
 
     foreach my $function (@{$interface->functions}) {
-        $numCustomFunctions++ if $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCustom"};
+        $numCustomFunctions++ if HasCustomMethod($function->signature->extendedAttributes);
     }
 
     if ($numCustomFunctions > 0) {
         push(@headerContent, "\n    // Custom functions\n");
         foreach my $function (@{$interface->functions}) {
-            next unless $function->signature->extendedAttributes->{"Custom"} or $function->signature->extendedAttributes->{"JSCustom"};
+            next unless HasCustomMethod($function->signature->extendedAttributes);
             next if $function->{overloads} && $function->{overloadIndex} != 1;
             my $conditionalString = $codeGenerator->GenerateConditionalString($function->signature);
             push(@headerContent, "#if ${conditionalString}\n") if $conditionalString;
@@ -1789,7 +1788,7 @@
                 push(@implContent, "    PropertyName propertyName = Identifier::from(exec, index);\n");
                 $generatedPropertyName = 1;
             };
-            
+
             if ($interface->extendedAttributes->{"IndexedGetter"} || $interface->extendedAttributes->{"NumericIndexedGetter"}) {
                 if (IndexGetterReturnsStrings($interfaceName)) {
                     push(@implContent, "    if (index <= MAX_ARRAY_INDEX) {\n");
@@ -1804,7 +1803,7 @@
                 push(@implContent, "        return true;\n");
                 push(@implContent, "    }\n");
             }
-            
+
             if ($interface->extendedAttributes->{"NamedGetter"} || $interface->extendedAttributes->{"CustomNamedGetter"}) {
                 &$propertyNameGeneration();
                 push(@implContent, "    if (canGetItemsForName(exec, static_cast<$interfaceName*>(thisObject->impl()), propertyName)) {\n");
@@ -1813,7 +1812,7 @@
                 push(@implContent, "    }\n");
                 $implIncludes{"wtf/text/AtomicString.h"} = 1;
             }
-            
+
             if ($interface->extendedAttributes->{"JSCustomGetOwnPropertySlotAndDescriptor"}) {
                 &$propertyNameGeneration();
                 push(@implContent, "    if (thisObject->getOwnPropertySlotDelegate(exec, propertyName, slot))\n");
@@ -1856,7 +1855,7 @@
                     push(@implContent, "        return jsUndefined();\n");
                 }
 
-                if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomGetter"} || $attribute->signature->extendedAttributes->{"JSCustomGetter"}) {
+                if (HasCustomGetter($attribute->signature->extendedAttributes)) {
                     push(@implContent, "    return castedThis->$implGetterFunctionName(exec);\n");
                 } elsif ($attribute->signature->extendedAttributes->{"CheckSecurityForNode"}) {
                     $implIncludes{"JSDOMBinding.h"} = 1;
@@ -2070,7 +2069,7 @@
                                 push(@implContent, "        return;\n");
                             }
 
-                            if ($attribute->signature->extendedAttributes->{"Custom"} || $attribute->signature->extendedAttributes->{"JSCustom"} || $attribute->signature->extendedAttributes->{"CustomSetter"} || $attribute->signature->extendedAttributes->{"JSCustomSetter"}) {
+                            if (HasCustomSetter($attribute->signature->extendedAttributes)) {
                                 push(@implContent, "    jsCast<$className*>(thisObject)->set$implSetterFunctionName(exec, value);\n");
                             } elsif ($type eq "EventListener") {
                                 $implIncludes{"JSEventListener.h"} = 1;
@@ -2236,7 +2235,7 @@
         foreach my $function (@{$interface->functions}) {
             AddIncludesForTypeInImpl($function->signature->type);
 
-            my $isCustom = $function->signature->extendedAttributes->{"Custom"} || $function->signature->extendedAttributes->{"JSCustom"};
+            my $isCustom = HasCustomMethod($function->signature->extendedAttributes);
             my $isOverloaded = $function->{overloads} && @{$function->{overloads}} > 1;
 
             next if $isCustom && $isOverloaded && $function->{overloadIndex} > 1;
@@ -4066,6 +4065,24 @@
     return $interface->extendedAttributes->{"CustomConstructor"} || $interface->extendedAttributes->{"JSCustomConstructor"};
 }
 
+sub HasCustomGetter
+{
+    my $attrExt = shift;
+    return $attrExt->{"Custom"} || $attrExt->{"JSCustom"} || $attrExt->{"CustomGetter"} || $attrExt->{"JSCustomGetter"};
+}
+
+sub HasCustomSetter
+{
+    my $attrExt = shift;
+    return $attrExt->{"Custom"} || $attrExt->{"JSCustom"} || $attrExt->{"CustomSetter"} || $attrExt->{"JSCustomSetter"};
+}
+
+sub HasCustomMethod
+{
+    my $attrExt = shift;
+    return $attrExt->{"Custom"} || $attrExt->{"JSCustom"};
+}
+
 sub IsConstructable
 {
     my $interface = shift;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to