Title: [101102] trunk/Source/WebCore
Revision
101102
Author
[email protected]
Date
2011-11-23 14:03:20 -0800 (Wed, 23 Nov 2011)

Log Message

Binding CodeGenerators don't support Conditional= on constants
https://bugs.webkit.org/show_bug.cgi?id=67666

Reviewed by Adam Barth.

Adds support for [Conditional=LABEL] to const IDL fields.

* bindings/scripts/CodeGenerator.pm:
(GenerateConditionalStringFromAttributeValue): Moved out of CodeGenerator{CPP,JS,V8}.pm.
(GenerateCompileTimeCheckForEnumsIfNeeded): Wrap in conditional #if.
* bindings/scripts/CodeGeneratorCPP.pm:
(GenerateConditionalString):
(GenerateHeader): Ditto.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateConditionalString):
(GenerateHeader): Ditto.
(GenerateImplementation): Ditto.
(GenerateHashTable):
(WriteData):
* bindings/scripts/CodeGeneratorObjC.pm:
(GenerateHeader): Ditto.
* bindings/scripts/CodeGeneratorV8.pm:
(GenerateConditionalString): Ditto.
(GenerateImplementation):
(WriteData):
* bindings/scripts/test/CPP/WebDOMTestObj.h: Generated code now wraps conditional const in #if.
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjCONDITIONAL_CONST): Ditto
* bindings/scripts/test/JS/JSTestObj.h: Ditto
* bindings/scripts/test/ObjC/DOMTestObj.h: Ditto
* bindings/scripts/test/TestObj.idl: Added a conditional const.
* bindings/scripts/test/V8/V8TestObj.cpp: Generated code now wraps conditional const in #if.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (101101 => 101102)


--- trunk/Source/WebCore/ChangeLog	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/ChangeLog	2011-11-23 22:03:20 UTC (rev 101102)
@@ -1,3 +1,38 @@
+2011-11-23  Erik Arvidsson  <[email protected]>
+
+        Binding CodeGenerators don't support Conditional= on constants
+        https://bugs.webkit.org/show_bug.cgi?id=67666
+
+        Reviewed by Adam Barth.
+
+        Adds support for [Conditional=LABEL] to const IDL fields.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (GenerateConditionalStringFromAttributeValue): Moved out of CodeGenerator{CPP,JS,V8}.pm.
+        (GenerateCompileTimeCheckForEnumsIfNeeded): Wrap in conditional #if.
+        * bindings/scripts/CodeGeneratorCPP.pm:
+        (GenerateConditionalString):
+        (GenerateHeader): Ditto.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateConditionalString):
+        (GenerateHeader): Ditto.
+        (GenerateImplementation): Ditto.
+        (GenerateHashTable):
+        (WriteData):
+        * bindings/scripts/CodeGeneratorObjC.pm:
+        (GenerateHeader): Ditto.
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateConditionalString): Ditto.
+        (GenerateImplementation):
+        (WriteData):
+        * bindings/scripts/test/CPP/WebDOMTestObj.h: Generated code now wraps conditional const in #if.
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        (WebCore::jsTestObjCONDITIONAL_CONST): Ditto
+        * bindings/scripts/test/JS/JSTestObj.h: Ditto
+        * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto
+        * bindings/scripts/test/TestObj.idl: Added a conditional const.
+        * bindings/scripts/test/V8/V8TestObj.cpp: Generated code now wraps conditional const in #if.
+
 2011-11-23  Rafael Weinstein  <[email protected]>
 
         [MutationObservers] Modifications to the style property don't dispatch "attributes" Mutation Records

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2011-11-23 22:03:20 UTC (rev 101102)
@@ -559,9 +559,22 @@
     return not $dataNode->extendedAttributes->{"DontCheckEnums"};
 }
 
+sub GenerateConditionalStringFromAttributeValue
+{
+    my $generator = shift;
+    my $conditional = shift;
+    if ($conditional =~ /&/) {
+        return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
+    } elsif ($conditional =~ /\|/) {
+        return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")";
+    } else {
+        return "ENABLE(" . $conditional . ")";
+    }
+}
+
 sub GenerateCompileTimeCheckForEnumsIfNeeded
 {
-    my ($object, $dataNode) = @_;
+    my ($generator, $dataNode) = @_;
     my $interfaceName = $dataNode->name;
     my @checks = ();
     # If necessary, check that all constants are available as enums with the same value.
@@ -571,7 +584,18 @@
             my $reflect = $constant->extendedAttributes->{"Reflect"};
             my $name = $reflect ? $reflect : $constant->name;
             my $value = $constant->value;
+            my $conditional = $constant->extendedAttributes->{"Conditional"};
+
+            if ($conditional) {
+                my $conditionalString = $generator->GenerateConditionalStringFromAttributeValue($conditional);
+                push(@checks, "#if ${conditionalString}\n");
+            }
+
             push(@checks, "COMPILE_ASSERT($value == ${interfaceName}::$name, ${interfaceName}Enum${name}IsWrongUseDontCheckEnums);\n");
+
+            if ($conditional) {
+                push(@checks, "#endif\n");
+            }
         }
         push(@checks, "\n");
     }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorCPP.pm	2011-11-23 22:03:20 UTC (rev 101102)
@@ -318,24 +318,12 @@
     $implIncludes{"WebDOM$type.h"} = 1;
 }
 
-sub GenerateConditionalStringFromAttributeValue
-{
-    my $conditional = shift;
-    if ($conditional =~ /&/) {
-        return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-    } elsif ($conditional =~ /\|/) {
-        return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")";
-    } else {
-        return "ENABLE(" . $conditional . ")";
-    }
-}
-
 sub GenerateConditionalString
 {
     my $node = shift;
     my $conditional = $node->extendedAttributes->{"Conditional"};
     if ($conditional) {
-        return GenerateConditionalStringFromAttributeValue($conditional);
+        return $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
     } else {
         return "";
     }
@@ -414,18 +402,29 @@
     # - Add constants.
     if ($numConstants > 0) {
         my @headerConstants = ();
+        my @constants = @{$dataNode->constants};
+        my $combinedConstants = "";
 
         # FIXME: we need a way to include multiple enums.
-        foreach my $constant (@{$dataNode->constants}) {
+        foreach my $constant (@constants) {
             my $constantName = $constant->name;
             my $constantValue = $constant->value;
+            my $conditional = $constant->extendedAttributes->{"Conditional"};
+            my $notLast = $constant ne $constants[-1];
 
-            my $output = "WEBDOM_" . $constantName . " = " . $constantValue;
-            push(@headerConstants, "        " . $output);
+            if ($conditional) {
+                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
+                $combinedConstants .= "#if ${conditionalString}\n";
+            }
+            $combinedConstants .= "        WEBDOM_$constantName = $constantValue";
+            $combinedConstants .= "," if $notLast;
+            if ($conditional) {
+                $combinedConstants .= "\n#endif\n";
+            } elsif ($notLast) {
+                $combinedConstants .= "\n";
+            }
         }
 
-        my $combinedConstants = join(",\n", @headerConstants);
-
         push(@headerContent, "    ");
         push(@headerContent, "enum {\n");
         push(@headerContent, $combinedConstants);

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2011-11-23 22:03:20 UTC (rev 101102)
@@ -411,24 +411,12 @@
     }
 }
 
-sub GenerateConditionalStringFromAttributeValue
-{
-    my $conditional = shift;
-    if ($conditional =~ /&/) {
-        return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-    } elsif ($conditional =~ /\|/) {
-        return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")";
-    } else {
-        return "ENABLE(" . $conditional . ")";
-    }
-}
-
 sub GenerateConditionalString
 {
     my $node = shift;
     my $conditional = $node->extendedAttributes->{"Conditional"};
     if ($conditional) {
-        return GenerateConditionalStringFromAttributeValue($conditional);
+        return $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
     } else {
         return "";
     }
@@ -1123,7 +1111,13 @@
         push(@headerContent,"// Constants\n\n");
         foreach my $constant (@{$dataNode->constants}) {
             my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
+            my $conditional = $constant->extendedAttributes->{"Conditional"};
+            if ($conditional) {
+                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
+                push(@headerContent, "#if ${conditionalString}\n");
+            }
             push(@headerContent, "JSC::JSValue ${getter}(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);\n");
+            push(@headerContent, "#endif\n") if $conditional;
         }
     }
 
@@ -1362,19 +1356,27 @@
         my @hashValue1 = ();
         my @hashValue2 = ();
         my @hashSpecials = ();
+        my %conditionals = ();
 
         # FIXME: we should not need a function for every constant.
         foreach my $constant (@{$dataNode->constants}) {
-            push(@hashKeys, $constant->name);
-            my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
+            my $name = $constant->name;
+            push(@hashKeys, $name);
+            my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($name);
             push(@hashValue1, $getter);
             push(@hashValue2, "0");
             push(@hashSpecials, "DontDelete | ReadOnly");
+
+            my $conditional = $constant->extendedAttributes->{"Conditional"};
+            if ($conditional) {
+                $conditionals{$name} = $conditional;
+            }
         }
 
         $object->GenerateHashTable($hashName, $hashSize,
                                    \@hashKeys, \@hashSpecials,
-                                   \@hashValue1, \@hashValue2);
+                                   \@hashValue1, \@hashValue2,
+                                   \%conditionals);
 
         push(@implContent, $codeGenerator->GenerateCompileTimeCheckForEnumsIfNeeded($dataNode));
 
@@ -1394,11 +1396,17 @@
 
     # FIXME: we should not need a function for every constant.
     foreach my $constant (@{$dataNode->constants}) {
-        push(@hashKeys, $constant->name);
-        my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
+        my $name = $constant->name;
+        push(@hashKeys, $name);
+        my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($name);
         push(@hashValue1, $getter);
         push(@hashValue2, "0");
         push(@hashSpecials, "DontDelete | ReadOnly");
+
+        my $conditional = $constant->extendedAttributes->{"Conditional"};
+        if ($conditional) {
+            $conditionals{$name} = $conditional;
+        }
     }
 
     foreach my $function (@{$dataNode->functions}) {
@@ -1983,7 +1991,7 @@
 
             my $conditional = $function->signature->extendedAttributes->{"Conditional"};
             if ($conditional) {
-                my $conditionalString = GenerateConditionalStringFromAttributeValue($conditional);
+                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
                 push(@implContent, "#if ${conditionalString}\n");
             }
 
@@ -2057,9 +2065,7 @@
                 GenerateOverloadedPrototypeFunction($function, $dataNode, $implClassName);
             }
 
-            if ($conditional) {
-                push(@implContent, "#endif\n\n");
-            }
+            push(@implContent, "#endif\n\n") if $conditional;
         }
         
         if ($needsMarkChildren && !$dataNode->extendedAttributes->{"CustomMarkFunction"}) {
@@ -2092,7 +2098,13 @@
 
         foreach my $constant (@{$dataNode->constants}) {
             my $getter = "js" . $interfaceName . $codeGenerator->WK_ucfirst($constant->name);
+            my $conditional = $constant->extendedAttributes->{"Conditional"};
 
+            if ($conditional) {
+                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
+                push(@implContent, "#if ${conditionalString}\n");
+            }
+
             # FIXME: this casts into int to match our previous behavior which turned 0xFFFFFFFF in -1 for NodeFilter.SHOW_ALL
             push(@implContent, "JSValue ${getter}(ExecState* exec, JSValue, const Identifier&)\n");
             push(@implContent, "{\n");
@@ -2103,6 +2115,7 @@
                 push(@implContent, "    return jsNumber(static_cast<int>(" . $constant->value . "));\n");
             }
             push(@implContent, "}\n\n");
+            push(@implContent, "#endif\n") if $conditional;
         }
     }
 
@@ -3020,7 +3033,7 @@
             $conditional = $conditionals->{$key};
         }
         if ($conditional) {
-            my $conditionalString = GenerateConditionalStringFromAttributeValue($conditional);
+            my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
             push(@implContent, "#if ${conditionalString}\n");
         }
         
@@ -3030,9 +3043,7 @@
             $targetType = "static_cast<PropertySlot::GetValueFunc>";
         }
         push(@implContent, "    { \"$key\", @$specials[$i], (intptr_t)" . $targetType . "(@$value1[$i]), (intptr_t)@$value2[$i] THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },\n");
-        if ($conditional) {
-            push(@implContent, "#endif\n");
-        }
+        push(@implContent, "#endif\n") if $conditional;
         ++$i;
     }
     push(@implContent, "    { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }\n");
@@ -3128,7 +3139,7 @@
             print $IMPL "#include $include\n";
         }
         foreach my $condition (sort keys %implIncludeConditions) {
-            print $IMPL "\n#if " . GenerateConditionalStringFromAttributeValue($condition) . "\n";
+            print $IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
             foreach my $include (sort @{$implIncludeConditions{$condition}}) {
                 print $IMPL "#include $include\n";
             }

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm	2011-11-23 22:03:20 UTC (rev 101102)
@@ -731,18 +731,29 @@
     # - Add constants.
     if ($numConstants > 0) {
         my @headerConstants = ();
+        my @constants = @{$dataNode->constants};
+        my $combinedConstants = "";
 
         # FIXME: we need a way to include multiple enums.
-        foreach my $constant (@{$dataNode->constants}) {
+        foreach my $constant (@constants) {
             my $constantName = $constant->name;
             my $constantValue = $constant->value;
+            my $conditional = $constant->extendedAttributes->{"Conditional"};
+            my $notLast = $constant ne $constants[-1];
 
-            my $output = "    DOM_" . $constantName . " = " . $constantValue;
-            push(@headerConstants, $output);
+            if ($conditional) {
+                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
+                $combinedConstants .= "#if ${conditionalString}\n";
+            }
+            $combinedConstants .= "    DOM_$constantName = $constantValue";
+            $combinedConstants .= "," if $notLast;
+            if ($conditional) {
+                $combinedConstants .= "\n#endif\n";
+            } elsif ($notLast) {
+                $combinedConstants .= "\n";
+            }
         }
 
-        my $combinedConstants = join(",\n", @headerConstants);
-
         # FIXME: the formatting of the enums should line up the equal signs.
         # FIXME: enums are unconditionally placed in the public header.
         push(@headerContent, "enum {\n");

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-11-23 22:03:20 UTC (rev 101102)
@@ -187,25 +187,12 @@
     }
 }
 
-# If the node has a [Conditional=XXX] attribute, returns an "ENABLE(XXX)" string for use in an #if.
-sub GenerateConditionalStringFromAttributeValue
-{
-    my $conditional = shift;
-    if ($conditional =~ /&/) {
-        return "ENABLE(" . join(") && ENABLE(", split(/&/, $conditional)) . ")";
-    } elsif ($conditional =~ /\|/) {
-        return "ENABLE(" . join(") || ENABLE(", split(/\|/, $conditional)) . ")";
-    } else {
-        return "ENABLE(" . $conditional . ")";
-    }
-}
-
 sub GenerateConditionalString
 {
     my $node = shift;
     my $conditional = $node->extendedAttributes->{"Conditional"};
     if ($conditional) {
-        return GenerateConditionalStringFromAttributeValue($conditional);
+        return $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
     } else {
         return "";
     }
@@ -2354,15 +2341,21 @@
         my $name = $constant->name;
         my $value = $constant->value;
         my $attrExt = $constant->extendedAttributes;
+        my $conditional = $attrExt->{"Conditional"};
         if ($attrExt->{"EnabledAtRuntime"}) {
             push(@constantsEnabledAtRuntime, $constant);
         } else {
             # FIXME: we need the static_cast here only because of one constant, NodeFilter.idl
             # defines "const unsigned long SHOW_ALL = 0xFFFFFFFF".  It would be better if we
             # handled this here, and converted it to a -1 constant in the c++ output.
+            if ($conditional) {
+                my $conditionalString = $codeGenerator->GenerateConditionalStringFromAttributeValue($conditional);
+                push(@implContent, "#if ${conditionalString}\n");
+            }
             push(@implContent, <<END);
     {"${name}", static_cast<signed int>($value)},
 END
+            push(@implContent, "#endif\n") if $conditional;
         }
     }
     if ($has_constants) {
@@ -3745,7 +3738,7 @@
             print $IMPL "#include $include\n";
         }
         foreach my $condition (sort keys %implIncludeConditions) {
-            print $IMPL "\n#if " . GenerateConditionalStringFromAttributeValue($condition) . "\n";
+            print $IMPL "\n#if " . $codeGenerator->GenerateConditionalStringFromAttributeValue($condition) . "\n";
             foreach my $include (sort @{$implIncludeConditions{$condition}}) {
                 print $IMPL "#include $include\n";
             }

Modified: trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h	2011-11-23 22:03:20 UTC (rev 101102)
@@ -48,6 +48,9 @@
     virtual ~WebDOMTestObj();
 
     enum {
+#if ENABLE(Condition1)
+        WEBDOM_CONDITIONAL_CONST = 0,
+#endif
         WEBDOM_CONST_VALUE_0 = 0,
         WEBDOM_CONST_VALUE_1 = 1,
         WEBDOM_CONST_VALUE_2 = 2,

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2011-11-23 22:03:20 UTC (rev 101102)
@@ -147,6 +147,9 @@
 
 static const HashTableValue JSTestObjConstructorTableValues[] =
 {
+#if ENABLE(Condition1)
+    { "CONDITIONAL_CONST", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONDITIONAL_CONST), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
+#endif
     { "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
     { "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
     { "CONST_VALUE_2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_2), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
@@ -165,6 +168,9 @@
 #undef THUNK_GENERATOR
 static const HashTable JSTestObjConstructorTable = { 33, 31, JSTestObjConstructorTableValues, 0 };
 
+#if ENABLE(Condition1)
+COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDontCheckEnums);
+#endif
 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums);
 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums);
 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums);
@@ -229,6 +235,9 @@
 
 static const HashTableValue JSTestObjPrototypeTableValues[] =
 {
+#if ENABLE(Condition1)
+    { "CONDITIONAL_CONST", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONDITIONAL_CONST), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
+#endif
     { "CONST_VALUE_0", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_0), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
     { "CONST_VALUE_1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_1), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
     { "CONST_VALUE_2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCONST_VALUE_2), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
@@ -1908,6 +1917,14 @@
 
 // Constant getters
 
+#if ENABLE(Condition1)
+JSValue jsTestObjCONDITIONAL_CONST(ExecState* exec, JSValue, const Identifier&)
+{
+    UNUSED_PARAM(exec);
+    return jsNumber(static_cast<int>(0));
+}
+
+#endif
 JSValue jsTestObjCONST_VALUE_0(ExecState* exec, JSValue, const Identifier&)
 {
     UNUSED_PARAM(exec);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2011-11-23 22:03:20 UTC (rev 101102)
@@ -262,6 +262,9 @@
 JSC::JSValue jsTestObjConstructor(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
 // Constants
 
+#if ENABLE(Condition1)
+JSC::JSValue jsTestObjCONDITIONAL_CONST(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
+#endif
 JSC::JSValue jsTestObjCONST_VALUE_0(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
 JSC::JSValue jsTestObjCONST_VALUE_1(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);
 JSC::JSValue jsTestObjCONST_VALUE_2(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&);

Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h	2011-11-23 22:03:20 UTC (rev 101102)
@@ -39,6 +39,9 @@
 @protocol DOMEventListener;
 
 enum {
+#if ENABLE(Condition1)
+    DOM_CONDITIONAL_CONST = 0,
+#endif
     DOM_CONST_VALUE_0 = 0,
     DOM_CONST_VALUE_1 = 1,
     DOM_CONST_VALUE_2 = 2,

Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2011-11-23 22:03:20 UTC (rev 101102)
@@ -143,6 +143,8 @@
         attribute [Conditional=Condition1&Condition2] TestObjectBConstructor conditionalAttr5;
         attribute [Conditional=Condition1|Condition2] TestObjectCConstructor conditionalAttr6;
 
+        const [Conditional=Condition1] unsigned short CONDITIONAL_CONST = 0;
+
 #if defined(TESTING_V8) || defined(TESTING_JS)
         readonly attribute [CachedAttribute] any cachedAttribute1;
         readonly attribute [CachedAttribute] any cachedAttribute2;

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp (101101 => 101102)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-11-23 21:40:06 UTC (rev 101101)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp	2011-11-23 22:03:20 UTC (rev 101102)
@@ -1450,6 +1450,9 @@
 };
 
 static const BatchedConstant TestObjConsts[] = {
+#if ENABLE(Condition1)
+    {"CONDITIONAL_CONST", static_cast<signed int>(0)},
+#endif
     {"CONST_VALUE_0", static_cast<signed int>(0)},
     {"CONST_VALUE_1", static_cast<signed int>(1)},
     {"CONST_VALUE_2", static_cast<signed int>(2)},
@@ -1465,6 +1468,9 @@
 };
 
 
+#if ENABLE(Condition1)
+COMPILE_ASSERT(0 == TestObj::CONDITIONAL_CONST, TestObjEnumCONDITIONAL_CONSTIsWrongUseDontCheckEnums);
+#endif
 COMPILE_ASSERT(0 == TestObj::CONST_VALUE_0, TestObjEnumCONST_VALUE_0IsWrongUseDontCheckEnums);
 COMPILE_ASSERT(1 == TestObj::CONST_VALUE_1, TestObjEnumCONST_VALUE_1IsWrongUseDontCheckEnums);
 COMPILE_ASSERT(2 == TestObj::CONST_VALUE_2, TestObjEnumCONST_VALUE_2IsWrongUseDontCheckEnums);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to