Title: [252808] trunk/Source/WebCore
Revision
252808
Author
[email protected]
Date
2019-11-22 15:10:51 -0800 (Fri, 22 Nov 2019)

Log Message

Bindings generator fails to add includes for iterable<> key / value types
https://bugs.webkit.org/show_bug.cgi?id=204530

Reviewed by Ryosuke Niwa.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateIterableDefinition):
* bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::JSTestInterfacePrototype::finishCreation):
(WebCore::jsTestInterfacePrototypeFunctionEntriesCaller):
(WebCore::jsTestInterfacePrototypeFunctionEntries):
(WebCore::jsTestInterfacePrototypeFunctionKeysCaller):
(WebCore::jsTestInterfacePrototypeFunctionKeys):
(WebCore::jsTestInterfacePrototypeFunctionValuesCaller):
(WebCore::jsTestInterfacePrototypeFunctionValues):
(WebCore::jsTestInterfacePrototypeFunctionForEachCaller):
(WebCore::jsTestInterfacePrototypeFunctionForEach):
* bindings/scripts/test/JS/JSTestIterable.cpp:
* bindings/scripts/test/JS/JSTestNode.cpp:
* bindings/scripts/test/TestInterface.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252807 => 252808)


--- trunk/Source/WebCore/ChangeLog	2019-11-22 23:06:02 UTC (rev 252807)
+++ trunk/Source/WebCore/ChangeLog	2019-11-22 23:10:51 UTC (rev 252808)
@@ -1,3 +1,26 @@
+2019-11-22  Chris Dumez  <[email protected]>
+
+        Bindings generator fails to add includes for iterable<> key / value types
+        https://bugs.webkit.org/show_bug.cgi?id=204530
+
+        Reviewed by Ryosuke Niwa.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateIterableDefinition):
+        * bindings/scripts/test/JS/JSTestInterface.cpp:
+        (WebCore::JSTestInterfacePrototype::finishCreation):
+        (WebCore::jsTestInterfacePrototypeFunctionEntriesCaller):
+        (WebCore::jsTestInterfacePrototypeFunctionEntries):
+        (WebCore::jsTestInterfacePrototypeFunctionKeysCaller):
+        (WebCore::jsTestInterfacePrototypeFunctionKeys):
+        (WebCore::jsTestInterfacePrototypeFunctionValuesCaller):
+        (WebCore::jsTestInterfacePrototypeFunctionValues):
+        (WebCore::jsTestInterfacePrototypeFunctionForEachCaller):
+        (WebCore::jsTestInterfacePrototypeFunctionForEach):
+        * bindings/scripts/test/JS/JSTestIterable.cpp:
+        * bindings/scripts/test/JS/JSTestNode.cpp:
+        * bindings/scripts/test/TestInterface.idl:
+
 2019-11-22  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Line::Run::expand should take a range of runs to merge

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (252807 => 252808)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2019-11-22 23:06:02 UTC (rev 252807)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2019-11-22 23:10:51 UTC (rev 252808)
@@ -6407,6 +6407,9 @@
     my $iteratorTraitsType = $interface->iterable->isKeyValue ? "JSDOMIteratorType::Map" : "JSDOMIteratorType::Set";
     my $iteratorTraitsKeyType = $interface->iterable->isKeyValue ? GetIDLType($interface, $interface->iterable->keyType) : "void";
     my $iteratorTraitsValueType = GetIDLType($interface, $interface->iterable->valueType);
+    
+    AddToImplIncludesForIDLType($interface->iterable->keyType) if $interface->iterable->isKeyValue;
+    AddToImplIncludesForIDLType($interface->iterable->valueType);
 
     push(@implContent,  <<END);
 struct ${iteratorTraitsName} {

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp (252807 => 252808)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2019-11-22 23:06:02 UTC (rev 252807)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp	2019-11-22 23:10:51 UTC (rev 252808)
@@ -31,10 +31,14 @@
 #include "JSDOMConstructor.h"
 #include "JSDOMConvertInterface.h"
 #include "JSDOMExceptionHandling.h"
+#include "JSDOMIterator.h"
 #include "JSDOMOperation.h"
 #include "JSDOMWrapperCache.h"
+#include "JSTestNode.h"
+#include "JSTestObj.h"
 #include "ScriptExecutionContext.h"
 #include "TestSupplemental.h"
+#include <_javascript_Core/BuiltinNames.h>
 #include <_javascript_Core/FunctionPrototype.h>
 #include <_javascript_Core/HeapAnalyzer.h>
 #include <_javascript_Core/JSCInlines.h>
@@ -54,7 +58,6 @@
 #include "JSDOMConvertNumbers.h"
 #include "JSDOMGlobalObject.h"
 #include "JSNode.h"
-#include "JSTestObj.h"
 #endif
 
 #if ENABLE(Condition22) || ENABLE(Condition23)
@@ -95,6 +98,11 @@
 #if ENABLE(Condition11) || ENABLE(Condition12)
 JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplementalMethod4(JSC::JSGlobalObject*, JSC::CallFrame*);
 #endif
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSymbolIterator(JSC::JSGlobalObject*, JSC::CallFrame*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionEntries(JSC::JSGlobalObject*, JSC::CallFrame*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionKeys(JSC::JSGlobalObject*, JSC::CallFrame*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionValues(JSC::JSGlobalObject*, JSC::CallFrame*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionForEach(JSC::JSGlobalObject*, JSC::CallFrame*);
 
 // Attributes
 
@@ -376,6 +384,10 @@
 #else
     { 0, 0, NoIntrinsic, { 0, 0 } },
 #endif
+    { "entries", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionEntries), (intptr_t) (0) } },
+    { "keys", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionKeys), (intptr_t) (0) } },
+    { "values", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionValues), (intptr_t) (0) } },
+    { "forEach", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionForEach), (intptr_t) (1) } },
 #if ENABLE(Condition22) || ENABLE(Condition23)
     { "IMPLEMENTSCONSTANT1", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
 #else
@@ -404,6 +416,7 @@
 {
     Base::finishCreation(vm);
     reifyStaticProperties(vm, JSTestInterface::info(), JSTestInterfacePrototypeTableValues, *this);
+    putDirect(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
 }
 
 const ClassInfo JSTestInterface::s_info = { "TestInterface", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(JSTestInterface) };
@@ -1038,6 +1051,61 @@
 
 #endif
 
+struct TestInterfaceIteratorTraits {
+    static constexpr JSDOMIteratorType type = JSDOMIteratorType::Map;
+    using KeyType = IDLInterface<TestNode>;
+    using ValueType = IDLInterface<TestObj>;
+};
+
+using TestInterfaceIterator = JSDOMIterator<JSTestInterface, TestInterfaceIteratorTraits>;
+using TestInterfaceIteratorPrototype = JSDOMIteratorPrototype<JSTestInterface, TestInterfaceIteratorTraits>;
+
+template<>
+const JSC::ClassInfo TestInterfaceIterator::s_info = { "TestInterface Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TestInterfaceIterator) };
+
+template<>
+const JSC::ClassInfo TestInterfaceIteratorPrototype::s_info = { "TestInterface Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TestInterfaceIteratorPrototype) };
+
+static inline EncodedJSValue jsTestInterfacePrototypeFunctionEntriesCaller(JSGlobalObject*, CallFrame*, JSTestInterface* thisObject, JSC::ThrowScope&)
+{
+    return JSValue::encode(iteratorCreate<TestInterfaceIterator>(*thisObject, IterationKind::KeyValue));
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionEntries(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
+{
+    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionEntriesCaller>(*lexicalGlobalObject, *callFrame, "entries");
+}
+
+static inline EncodedJSValue jsTestInterfacePrototypeFunctionKeysCaller(JSGlobalObject*, CallFrame*, JSTestInterface* thisObject, JSC::ThrowScope&)
+{
+    return JSValue::encode(iteratorCreate<TestInterfaceIterator>(*thisObject, IterationKind::Key));
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionKeys(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
+{
+    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionKeysCaller>(*lexicalGlobalObject, *callFrame, "keys");
+}
+
+static inline EncodedJSValue jsTestInterfacePrototypeFunctionValuesCaller(JSGlobalObject*, CallFrame*, JSTestInterface* thisObject, JSC::ThrowScope&)
+{
+    return JSValue::encode(iteratorCreate<TestInterfaceIterator>(*thisObject, IterationKind::Value));
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionValues(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
+{
+    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionValuesCaller>(*lexicalGlobalObject, *callFrame, "values");
+}
+
+static inline EncodedJSValue jsTestInterfacePrototypeFunctionForEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSTestInterface* thisObject, JSC::ThrowScope& throwScope)
+{
+    return JSValue::encode(iteratorForEach<TestInterfaceIterator>(*lexicalGlobalObject, *callFrame, *thisObject, throwScope));
+}
+
+JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionForEach(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
+{
+    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionForEachCaller>(*lexicalGlobalObject, *callFrame, "forEach");
+}
+
 void JSTestInterface::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
 {
     auto* thisObject = jsCast<JSTestInterface*>(cell);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp (252807 => 252808)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp	2019-11-22 23:06:02 UTC (rev 252807)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp	2019-11-22 23:10:51 UTC (rev 252808)
@@ -24,10 +24,12 @@
 #include "ActiveDOMObject.h"
 #include "JSDOMBinding.h"
 #include "JSDOMConstructorNotConstructable.h"
+#include "JSDOMConvertInterface.h"
 #include "JSDOMExceptionHandling.h"
 #include "JSDOMIterator.h"
 #include "JSDOMOperation.h"
 #include "JSDOMWrapperCache.h"
+#include "JSTestNode.h"
 #include "ScriptExecutionContext.h"
 #include <_javascript_Core/BuiltinNames.h>
 #include <_javascript_Core/FunctionPrototype.h>

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp (252807 => 252808)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2019-11-22 23:06:02 UTC (rev 252807)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp	2019-11-22 23:10:51 UTC (rev 252808)
@@ -33,6 +33,7 @@
 #include "JSDOMOperation.h"
 #include "JSDOMOperationReturningPromise.h"
 #include "JSDOMWrapperCache.h"
+#include "JSTestNode.h"
 #include "RuntimeEnabledFeatures.h"
 #include "ScriptExecutionContext.h"
 #include <_javascript_Core/BuiltinNames.h>

Modified: trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl (252807 => 252808)


--- trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl	2019-11-22 23:06:02 UTC (rev 252807)
+++ trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl	2019-11-22 23:10:51 UTC (rev 252808)
@@ -38,6 +38,7 @@
     ExportMacro=WEBCORE_EXPORT,
     ImplementationLacksVTable
 ] interface TestInterface {
+    iterable<TestNode, TestObj>;
 };
 
 TestInterface implements TestImplements;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to