Title: [268435] trunk/Source/WebCore
Revision
268435
Author
wei...@apple.com
Date
2020-10-13 17:14:15 -0700 (Tue, 13 Oct 2020)

Log Message

[WebIDL] Add support for identifiers with dashes ('-')
https://bugs.webkit.org/show_bug.cgi?id=217667

Reviewed by Darin Adler.

To support CSSStyleDeclaration.idl correctly, we need to add support for dashes ('-')
in WebIDL identifers.

* bindings/scripts/IDLParser.pm:
Update identifer regular _expression_ to match current spec which allows for dashes ('-').

* bindings/scripts/CodeGeneratorJS.pm:
(MangleAttributeOrFunctionName):
Helper to centralize mangling required to construct valid c++ identifiers from the WebIDL
identifiers, since now WebIDL identifiers can contain dashes ('-'), which is not valid in
c++. For now, we use a very simple mangling which replaces all dashes ('-') with the string
"_dash_".

(GetAttributeGetterName):
(GetAttributeSetterName):
(GetFunctionName):
Clarify and cleanup logic a bit and call the new mangler.

(GenerateImplementation):
GetAttributeGetterName will now always use the $className, so this caller needs to actually
pass the right value in. Previously, the $generatorName it passed in was not actually used.
Also removes some duplicate definitions of $interfaceName.

* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:
Adds tests for various combinations of underscores and dashes in identifiers.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (268434 => 268435)


--- trunk/Source/WebCore/ChangeLog	2020-10-13 23:57:04 UTC (rev 268434)
+++ trunk/Source/WebCore/ChangeLog	2020-10-14 00:14:15 UTC (rev 268435)
@@ -1,3 +1,37 @@
+2020-10-13  Sam Weinig  <wei...@apple.com>
+
+        [WebIDL] Add support for identifiers with dashes ('-') 
+        https://bugs.webkit.org/show_bug.cgi?id=217667
+
+        Reviewed by Darin Adler.
+
+        To support CSSStyleDeclaration.idl correctly, we need to add support for dashes ('-')
+        in WebIDL identifers.
+
+        * bindings/scripts/IDLParser.pm:
+        Update identifer regular _expression_ to match current spec which allows for dashes ('-').
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (MangleAttributeOrFunctionName):
+        Helper to centralize mangling required to construct valid c++ identifiers from the WebIDL
+        identifiers, since now WebIDL identifiers can contain dashes ('-'), which is not valid in 
+        c++. For now, we use a very simple mangling which replaces all dashes ('-') with the string 
+        "_dash_".
+ 
+        (GetAttributeGetterName):
+        (GetAttributeSetterName):
+        (GetFunctionName):
+        Clarify and cleanup logic a bit and call the new mangler.
+
+        (GenerateImplementation):
+        GetAttributeGetterName will now always use the $className, so this caller needs to actually
+        pass the right value in. Previously, the $generatorName it passed in was not actually used.
+        Also removes some duplicate definitions of $interfaceName.
+
+        * bindings/scripts/test/JS/JSTestObj.cpp:
+        * bindings/scripts/test/TestObj.idl:
+        Adds tests for various combinations of underscores and dashes in identifiers.
+
 2020-10-13  Chris Dumez  <cdu...@apple.com>
 
         Simplify AudioNode::checkNumberOfChannelsForInput()

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (268434 => 268435)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2020-10-13 23:57:04 UTC (rev 268434)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2020-10-14 00:14:15 UTC (rev 268435)
@@ -1847,13 +1847,23 @@
     return "WTFMove(${name})";
 }
 
+sub MangleAttributeOrFunctionName
+{
+    my ($name) = @_;
+
+    $name =~ s/-/_dash_/g;
+
+    return $name;
+}
+
 sub GetAttributeGetterName
 {
     my ($interface, $className, $attribute) = @_;
 
-    return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->name) if $attribute->isStatic;
     return GetJSBuiltinFunctionName($className, $attribute) if IsJSBuiltin($interface, $attribute);
-    return "js" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->name) . ($codeGenerator->IsConstructorType($attribute->type) ? "Constructor" : "");
+    return $codeGenerator->WK_lcfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) if $attribute->isStatic;
+    return $codeGenerator->WK_lcfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) . "Constructor" if $codeGenerator->IsConstructorType($attribute->type);
+    return $codeGenerator->WK_lcfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name));
 }
 
 sub GetAttributeSetterName
@@ -1860,9 +1870,10 @@
 {
     my ($interface, $className, $attribute) = @_;
 
-    return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst($attribute->name) if $attribute->isStatic;
     return "set" . $codeGenerator->WK_ucfirst(GetJSBuiltinFunctionName($className, $attribute)) if IsJSBuiltin($interface, $attribute);
-    return "setJS" . $interface->type->name . $codeGenerator->WK_ucfirst($attribute->name) . ($codeGenerator->IsConstructorType($attribute->type) ? "Constructor" : "");
+    return "set" . $codeGenerator->WK_ucfirst($className) . "Constructor" . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) if $attribute->isStatic;
+    return "set" . $codeGenerator->WK_ucfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name)) . "Constructor" if $codeGenerator->IsConstructorType($attribute->type);
+    return "set" . $codeGenerator->WK_ucfirst($className) . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($attribute->name));
 }
 
 sub GetFunctionName
@@ -1875,7 +1886,7 @@
     $functionName = "SymbolIterator" if $functionName eq "[Symbol.Iterator]";
 
     my $kind = $operation->isStatic ? "Constructor" : (OperationShouldBeOnInstance($interface, $operation) ? "Instance" : "Prototype");
-    return $codeGenerator->WK_lcfirst($className) . $kind . "Function" . $codeGenerator->WK_ucfirst($functionName);
+    return $codeGenerator->WK_lcfirst($className) . $kind . "Function" . $codeGenerator->WK_ucfirst(MangleAttributeOrFunctionName($functionName));
 }
 
 sub GetFullyQualifiedImplementationCallName
@@ -4360,7 +4371,6 @@
             die "Overloads is not supported in DOMJIT" if $isOverloaded;
             die "Currently ReadDOM value is only allowed" unless $codeGenerator->ExtendedAttributeContains($operation->extendedAttributes->{DOMJIT}, "ReadDOM");
 
-            my $interfaceName = $interface->type->name;
             my $functionName = GetFunctionName($interface, $className, $operation);
             my $nameOfFunctionWithoutTypeCheck = $codeGenerator->WK_lcfirst($functionName) . "WithoutTypeCheck";
             my $domJITSignatureName = "DOMJITSignatureFor" . $interface->type->name . $codeGenerator->WK_ucfirst($operation->name);
@@ -4390,10 +4400,9 @@
             my $conditionalString = $codeGenerator->GenerateConditionalString($attribute);
             push(@implContent, "#if ${conditionalString}\n\n") if $conditionalString;
             AddToImplIncludes("DOMJITIDLTypeFilter.h", $conditionalString);
-            my $interfaceName = $interface->type->name;
             my $generatorName = $interfaceName . $codeGenerator->WK_ucfirst($attribute->name);
             my $domJITClassName = $generatorName . "Attribute";
-            my $getter = GetAttributeGetterName($interface, $generatorName, $attribute);
+            my $getter = GetAttributeGetterName($interface, $className, $attribute);
             my $resultType = "JSC::SpecBytecodeTop";
             if ($attribute->extendedAttributes->{DOMJIT}) {
                 $resultType = GetResultTypeFilter($interface, $attribute->type);

Modified: trunk/Source/WebCore/bindings/scripts/IDLParser.pm (268434 => 268435)


--- trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2020-10-13 23:57:04 UTC (rev 268434)
+++ trunk/Source/WebCore/bindings/scripts/IDLParser.pm	2020-10-14 00:14:15 UTC (rev 268435)
@@ -403,7 +403,7 @@
 my $floatTokenPattern = '^(-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+))';
 my $integerTokenPattern = '^(-?[1-9][0-9]*|-?0[Xx][0-9A-Fa-f]+|-?0[0-7]*)';
 my $stringTokenPattern = '^(\"[^\"]*\")';
-my $identifierTokenPattern = '^([A-Z_a-z][0-9A-Z_a-z]*)';
+my $identifierTokenPattern = '^([_-]?[A-Z_a-z][0-9A-Z_a-z-]*)';
 my $otherTokenPattern = '^(\.\.\.|[^\t\n\r 0-9A-Z_a-z])';
 
 sub getTokenInternal

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


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2020-10-13 23:57:04 UTC (rev 268434)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp	2020-10-14 00:14:15 UTC (rev 268435)
@@ -1597,6 +1597,11 @@
 JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionConditionallyExposedToWindowFunction);
 JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionConditionallyExposedToWorkerFunction);
 JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionConditionallyExposedToWindowAndWorkerFunction);
+JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_dash_leading_dash_hyphen_dash_function);
+JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionTrailing_dash_hyphen_dash_function_dash_);
+JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionLeading_underscore_function);
+JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunction_double_leading_underscore_function);
+JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionTrailing_underscore_function_);
 JSC_DECLARE_HOST_FUNCTION(jsTestObjPrototypeFunctionToString);
 
 // Attributes
@@ -1796,6 +1801,16 @@
 JSC_DECLARE_CUSTOM_SETTER(setJSTestObjConditionallyExposedToWorkerAttribute);
 JSC_DECLARE_CUSTOM_GETTER(jsTestObjConditionallyExposedToWindowAndWorkerAttribute);
 JSC_DECLARE_CUSTOM_SETTER(setJSTestObjConditionallyExposedToWindowAndWorkerAttribute);
+JSC_DECLARE_CUSTOM_GETTER(jsTestObj_dash_leading_dash_hyphen_dash_attribute);
+JSC_DECLARE_CUSTOM_SETTER(setJSTestObj_dash_leading_dash_hyphen_dash_attribute);
+JSC_DECLARE_CUSTOM_GETTER(jsTestObjTrailing_dash_hyphen_dash_attribute_dash_);
+JSC_DECLARE_CUSTOM_SETTER(setJSTestObjTrailing_dash_hyphen_dash_attribute_dash_);
+JSC_DECLARE_CUSTOM_GETTER(jsTestObjLeading_underscore_attribute);
+JSC_DECLARE_CUSTOM_SETTER(setJSTestObjLeading_underscore_attribute);
+JSC_DECLARE_CUSTOM_GETTER(jsTestObj_double_leading_underscore_attribute);
+JSC_DECLARE_CUSTOM_SETTER(setJSTestObj_double_leading_underscore_attribute);
+JSC_DECLARE_CUSTOM_GETTER(jsTestObjTrailing_underscore_attribute_);
+JSC_DECLARE_CUSTOM_SETTER(setJSTestObjTrailing_underscore_attribute_);
 
 class JSTestObjPrototype final : public JSC::JSNonFinalObject {
 public:
@@ -2128,6 +2143,11 @@
     { "conditionallyExposedToWindowAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionallyExposedToWindowAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConditionallyExposedToWindowAttribute) } },
     { "conditionallyExposedToWorkerAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionallyExposedToWorkerAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConditionallyExposedToWorkerAttribute) } },
     { "conditionallyExposedToWindowAndWorkerAttribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConditionallyExposedToWindowAndWorkerAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjConditionallyExposedToWindowAndWorkerAttribute) } },
+    { "-leading-hyphen-attribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObj_dash_leading_dash_hyphen_dash_attribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObj_dash_leading_dash_hyphen_dash_attribute) } },
+    { "trailing-hyphen-attribute-", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTrailing_dash_hyphen_dash_attribute_dash_), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTrailing_dash_hyphen_dash_attribute_dash_) } },
+    { "leading_underscore_attribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLeading_underscore_attribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjLeading_underscore_attribute) } },
+    { "_double_leading_underscore_attribute", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObj_double_leading_underscore_attribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObj_double_leading_underscore_attribute) } },
+    { "trailing_underscore_attribute_", static_cast<unsigned>(JSC::PropertyAttribute::CustomAccessor | JSC::PropertyAttribute::DOMAttribute), NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjTrailing_underscore_attribute_), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjTrailing_underscore_attribute_) } },
 #if ENABLE(TEST_FEATURE)
     { "enabledAtRuntimeOperation", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionEnabledAtRuntimeOperation), (intptr_t) (1) } },
 #else
@@ -2309,6 +2329,11 @@
     { "conditionallyExposedToWindowFunction", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionConditionallyExposedToWindowFunction), (intptr_t) (0) } },
     { "conditionallyExposedToWorkerFunction", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionConditionallyExposedToWorkerFunction), (intptr_t) (0) } },
     { "conditionallyExposedToWindowAndWorkerFunction", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionConditionallyExposedToWindowAndWorkerFunction), (intptr_t) (0) } },
+    { "-leading-hyphen-function", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_dash_leading_dash_hyphen_dash_function), (intptr_t) (0) } },
+    { "trailing-hyphen-function-", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionTrailing_dash_hyphen_dash_function_dash_), (intptr_t) (0) } },
+    { "leading_underscore_function", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionLeading_underscore_function), (intptr_t) (0) } },
+    { "_double_leading_underscore_function", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunction_double_leading_underscore_function), (intptr_t) (0) } },
+    { "trailing_underscore_function_", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionTrailing_underscore_function_), (intptr_t) (0) } },
     { "toString", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestObjPrototypeFunctionToString), (intptr_t) (0) } },
 #if ENABLE(Condition1)
     { "CONDITIONAL_CONST", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(0) } },
@@ -5328,6 +5353,161 @@
     return IDLAttribute<JSTestObj>::set<setJSTestObjConditionallyExposedToWindowAndWorkerAttributeSetter>(*lexicalGlobalObject, thisValue, encodedValue, "conditionallyExposedToWindowAndWorkerAttribute");
 }
 
+static inline JSValue jsTestObj_dash_leading_dash_hyphen_dash_attributeGetter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.leadingHyphenAttribute())));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestObj_dash_leading_dash_hyphen_dash_attribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestObj>::get<jsTestObj_dash_leading_dash_hyphen_dash_attributeGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "-leading-hyphen-attribute");
+}
+
+static inline bool setJSTestObj_dash_leading_dash_hyphen_dash_attributeSetter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
+        return impl.setLeadingHyphenAttribute(WTFMove(nativeValue));
+    });
+    return true;
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestObj_dash_leading_dash_hyphen_dash_attribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestObj>::set<setJSTestObj_dash_leading_dash_hyphen_dash_attributeSetter>(*lexicalGlobalObject, thisValue, encodedValue, "-leading-hyphen-attribute");
+}
+
+static inline JSValue jsTestObjTrailing_dash_hyphen_dash_attribute_dash_Getter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.trailingHyphenAttribute())));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestObjTrailing_dash_hyphen_dash_attribute_dash_, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestObj>::get<jsTestObjTrailing_dash_hyphen_dash_attribute_dash_Getter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "trailing-hyphen-attribute-");
+}
+
+static inline bool setJSTestObjTrailing_dash_hyphen_dash_attribute_dash_Setter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
+        return impl.setTrailingHyphenAttribute(WTFMove(nativeValue));
+    });
+    return true;
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestObjTrailing_dash_hyphen_dash_attribute_dash_, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestObj>::set<setJSTestObjTrailing_dash_hyphen_dash_attribute_dash_Setter>(*lexicalGlobalObject, thisValue, encodedValue, "trailing-hyphen-attribute-");
+}
+
+static inline JSValue jsTestObjLeading_underscore_attributeGetter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.leading_underscore_attribute())));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestObjLeading_underscore_attribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestObj>::get<jsTestObjLeading_underscore_attributeGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "leading_underscore_attribute");
+}
+
+static inline bool setJSTestObjLeading_underscore_attributeSetter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
+        return impl.setLeading_underscore_attribute(WTFMove(nativeValue));
+    });
+    return true;
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestObjLeading_underscore_attribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestObj>::set<setJSTestObjLeading_underscore_attributeSetter>(*lexicalGlobalObject, thisValue, encodedValue, "leading_underscore_attribute");
+}
+
+static inline JSValue jsTestObj_double_leading_underscore_attributeGetter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl._double_leading_underscore_attribute())));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestObj_double_leading_underscore_attribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestObj>::get<jsTestObj_double_leading_underscore_attributeGetter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "_double_leading_underscore_attribute");
+}
+
+static inline bool setJSTestObj_double_leading_underscore_attributeSetter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
+        return impl.set_double_leading_underscore_attribute(WTFMove(nativeValue));
+    });
+    return true;
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestObj_double_leading_underscore_attribute, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestObj>::set<setJSTestObj_double_leading_underscore_attributeSetter>(*lexicalGlobalObject, thisValue, encodedValue, "_double_leading_underscore_attribute");
+}
+
+static inline JSValue jsTestObjTrailing_underscore_attribute_Getter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    RELEASE_AND_RETURN(throwScope, (toJS<IDLDOMString>(lexicalGlobalObject, throwScope, impl.trailing_underscore_attribute_())));
+}
+
+JSC_DEFINE_CUSTOM_GETTER(jsTestObjTrailing_underscore_attribute_, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, PropertyName))
+{
+    return IDLAttribute<JSTestObj>::get<jsTestObjTrailing_underscore_attribute_Getter, CastedThisErrorBehavior::Assert>(*lexicalGlobalObject, thisValue, "trailing_underscore_attribute_");
+}
+
+static inline bool setJSTestObjTrailing_underscore_attribute_Setter(JSGlobalObject& lexicalGlobalObject, JSTestObj& thisObject, JSValue value)
+{
+    auto& vm = JSC::getVM(&lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    auto& impl = thisObject.wrapped();
+    auto nativeValue = convert<IDLDOMString>(lexicalGlobalObject, value);
+    RETURN_IF_EXCEPTION(throwScope, false);
+    AttributeSetter::call(lexicalGlobalObject, throwScope, [&] {
+        return impl.setTrailing_underscore_attribute_(WTFMove(nativeValue));
+    });
+    return true;
+}
+
+JSC_DEFINE_CUSTOM_SETTER(setJSTestObjTrailing_underscore_attribute_, (JSGlobalObject* lexicalGlobalObject, EncodedJSValue thisValue, EncodedJSValue encodedValue))
+{
+    return IDLAttribute<JSTestObj>::set<setJSTestObjTrailing_underscore_attribute_Setter>(*lexicalGlobalObject, thisValue, encodedValue, "trailing_underscore_attribute_");
+}
+
 #if ENABLE(TEST_FEATURE)
 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionEnabledAtRuntimeOperation1Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
 {
@@ -9246,6 +9426,91 @@
     return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionConditionallyExposedToWindowAndWorkerFunctionBody>(*lexicalGlobalObject, *callFrame, "conditionallyExposedToWindowAndWorkerFunction");
 }
 
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunction_dash_leading_dash_hyphen_dash_functionBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
+{
+    auto& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(callFrame);
+    auto& impl = castedThis->wrapped();
+    throwScope.release();
+    impl.leadingHyphenFunction();
+    return JSValue::encode(jsUndefined());
+}
+
+JSC_DEFINE_HOST_FUNCTION(jsTestObjPrototypeFunction_dash_leading_dash_hyphen_dash_function, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
+{
+    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunction_dash_leading_dash_hyphen_dash_functionBody>(*lexicalGlobalObject, *callFrame, "-leading-hyphen-function");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionTrailing_dash_hyphen_dash_function_dash_Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
+{
+    auto& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(callFrame);
+    auto& impl = castedThis->wrapped();
+    throwScope.release();
+    impl.trailingHyphenFunction();
+    return JSValue::encode(jsUndefined());
+}
+
+JSC_DEFINE_HOST_FUNCTION(jsTestObjPrototypeFunctionTrailing_dash_hyphen_dash_function_dash_, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
+{
+    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionTrailing_dash_hyphen_dash_function_dash_Body>(*lexicalGlobalObject, *callFrame, "trailing-hyphen-function-");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionLeading_underscore_functionBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
+{
+    auto& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(callFrame);
+    auto& impl = castedThis->wrapped();
+    throwScope.release();
+    impl.leading_underscore_function();
+    return JSValue::encode(jsUndefined());
+}
+
+JSC_DEFINE_HOST_FUNCTION(jsTestObjPrototypeFunctionLeading_underscore_function, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
+{
+    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionLeading_underscore_functionBody>(*lexicalGlobalObject, *callFrame, "leading_underscore_function");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunction_double_leading_underscore_functionBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
+{
+    auto& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(callFrame);
+    auto& impl = castedThis->wrapped();
+    throwScope.release();
+    impl._double_leading_underscore_function();
+    return JSValue::encode(jsUndefined());
+}
+
+JSC_DEFINE_HOST_FUNCTION(jsTestObjPrototypeFunction_double_leading_underscore_function, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
+{
+    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunction_double_leading_underscore_functionBody>(*lexicalGlobalObject, *callFrame, "_double_leading_underscore_function");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionTrailing_underscore_function_Body(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
+{
+    auto& vm = JSC::getVM(lexicalGlobalObject);
+    auto throwScope = DECLARE_THROW_SCOPE(vm);
+    UNUSED_PARAM(throwScope);
+    UNUSED_PARAM(callFrame);
+    auto& impl = castedThis->wrapped();
+    throwScope.release();
+    impl.trailing_underscore_function_();
+    return JSValue::encode(jsUndefined());
+}
+
+JSC_DEFINE_HOST_FUNCTION(jsTestObjPrototypeFunctionTrailing_underscore_function_, (JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame))
+{
+    return IDLOperation<JSTestObj>::call<jsTestObjPrototypeFunctionTrailing_underscore_function_Body>(*lexicalGlobalObject, *callFrame, "trailing_underscore_function_");
+}
+
 static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionToStringBody(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame, typename IDLOperation<JSTestObj>::ClassParameter castedThis)
 {
     auto& vm = JSC::getVM(lexicalGlobalObject);

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


--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2020-10-13 23:57:04 UTC (rev 268434)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl	2020-10-14 00:14:15 UTC (rev 268435)
@@ -455,6 +455,18 @@
     [Exposed=Window] undefined conditionallyExposedToWindowFunction();
     [Exposed=Worker] undefined conditionallyExposedToWorkerFunction();
     [Exposed=(Window, Worker)] undefined conditionallyExposedToWindowAndWorkerFunction();
+
+    [ImplementedAs=leadingHyphenAttribute] attribute DOMString -leading-hyphen-attribute;
+    [ImplementedAs=trailingHyphenAttribute] attribute DOMString trailing-hyphen-attribute-;
+    attribute DOMString _leading_underscore_attribute; // NOTE: IDL removes the leading underscore so this is interpreted as "leading_underscore_attribute"
+    attribute DOMString __double_leading_underscore_attribute; // NOTE: IDL removes the leading underscore so this is interpreted as "_double_leading_underscore_attribute"
+    attribute DOMString trailing_underscore_attribute_;
+
+    [ImplementedAs=leadingHyphenFunction] undefined -leading-hyphen-function();
+    [ImplementedAs=trailingHyphenFunction] undefined trailing-hyphen-function-();
+    undefined _leading_underscore_function(); // NOTE: WebIDL removes the leading underscore so this is interpreted as "leading_underscore_function"
+    undefined __double_leading_underscore_function(); // NOTE: WebIDL removes the leading underscore so this is interpreted as "_double_leading_underscore_function"
+    undefined trailing_underscore_function_();
 };
 
 // The following comments should not generate any code.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to