Changeset 252808 in webkit


Ignore:
Timestamp:
Nov 22, 2019 3:10:51 PM (4 years ago)
Author:
Chris Dumez
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:
Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252807 r252808  
     12019-11-22  Chris Dumez  <cdumez@apple.com>
     2
     3        Bindings generator fails to add includes for iterable<> key / value types
     4        https://bugs.webkit.org/show_bug.cgi?id=204530
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * bindings/scripts/CodeGeneratorJS.pm:
     9        (GenerateIterableDefinition):
     10        * bindings/scripts/test/JS/JSTestInterface.cpp:
     11        (WebCore::JSTestInterfacePrototype::finishCreation):
     12        (WebCore::jsTestInterfacePrototypeFunctionEntriesCaller):
     13        (WebCore::jsTestInterfacePrototypeFunctionEntries):
     14        (WebCore::jsTestInterfacePrototypeFunctionKeysCaller):
     15        (WebCore::jsTestInterfacePrototypeFunctionKeys):
     16        (WebCore::jsTestInterfacePrototypeFunctionValuesCaller):
     17        (WebCore::jsTestInterfacePrototypeFunctionValues):
     18        (WebCore::jsTestInterfacePrototypeFunctionForEachCaller):
     19        (WebCore::jsTestInterfacePrototypeFunctionForEach):
     20        * bindings/scripts/test/JS/JSTestIterable.cpp:
     21        * bindings/scripts/test/JS/JSTestNode.cpp:
     22        * bindings/scripts/test/TestInterface.idl:
     23
    1242019-11-22  Zalan Bujtas  <zalan@apple.com>
    225
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r252480 r252808  
    64086408    my $iteratorTraitsKeyType = $interface->iterable->isKeyValue ? GetIDLType($interface, $interface->iterable->keyType) : "void";
    64096409    my $iteratorTraitsValueType = GetIDLType($interface, $interface->iterable->valueType);
     6410   
     6411    AddToImplIncludesForIDLType($interface->iterable->keyType) if $interface->iterable->isKeyValue;
     6412    AddToImplIncludesForIDLType($interface->iterable->valueType);
    64106413
    64116414    push(@implContent,  <<END);
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r251425 r252808  
    3232#include "JSDOMConvertInterface.h"
    3333#include "JSDOMExceptionHandling.h"
     34#include "JSDOMIterator.h"
    3435#include "JSDOMOperation.h"
    3536#include "JSDOMWrapperCache.h"
     37#include "JSTestNode.h"
     38#include "JSTestObj.h"
    3639#include "ScriptExecutionContext.h"
    3740#include "TestSupplemental.h"
     41#include <JavaScriptCore/BuiltinNames.h>
    3842#include <JavaScriptCore/FunctionPrototype.h>
    3943#include <JavaScriptCore/HeapAnalyzer.h>
     
    5559#include "JSDOMGlobalObject.h"
    5660#include "JSNode.h"
    57 #include "JSTestObj.h"
    5861#endif
    5962
     
    9699JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfaceConstructorFunctionSupplementalMethod4(JSC::JSGlobalObject*, JSC::CallFrame*);
    97100#endif
     101JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionSymbolIterator(JSC::JSGlobalObject*, JSC::CallFrame*);
     102JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionEntries(JSC::JSGlobalObject*, JSC::CallFrame*);
     103JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionKeys(JSC::JSGlobalObject*, JSC::CallFrame*);
     104JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionValues(JSC::JSGlobalObject*, JSC::CallFrame*);
     105JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionForEach(JSC::JSGlobalObject*, JSC::CallFrame*);
    98106
    99107// Attributes
     
    377385    { 0, 0, NoIntrinsic, { 0, 0 } },
    378386#endif
     387    { "entries", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionEntries), (intptr_t) (0) } },
     388    { "keys", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionKeys), (intptr_t) (0) } },
     389    { "values", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionValues), (intptr_t) (0) } },
     390    { "forEach", static_cast<unsigned>(JSC::PropertyAttribute::Function), NoIntrinsic, { (intptr_t)static_cast<RawNativeFunction>(jsTestInterfacePrototypeFunctionForEach), (intptr_t) (1) } },
    379391#if ENABLE(Condition22) || ENABLE(Condition23)
    380392    { "IMPLEMENTSCONSTANT1", JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly | JSC::PropertyAttribute::ConstantInteger, NoIntrinsic, { (long long)(1) } },
     
    405417    Base::finishCreation(vm);
    406418    reifyStaticProperties(vm, JSTestInterface::info(), JSTestInterfacePrototypeTableValues, *this);
     419    putDirect(vm, vm.propertyNames->iteratorSymbol, getDirect(vm, vm.propertyNames->builtinNames().entriesPublicName()), static_cast<unsigned>(JSC::PropertyAttribute::DontEnum));
    407420}
    408421
     
    10391052#endif
    10401053
     1054struct TestInterfaceIteratorTraits {
     1055    static constexpr JSDOMIteratorType type = JSDOMIteratorType::Map;
     1056    using KeyType = IDLInterface<TestNode>;
     1057    using ValueType = IDLInterface<TestObj>;
     1058};
     1059
     1060using TestInterfaceIterator = JSDOMIterator<JSTestInterface, TestInterfaceIteratorTraits>;
     1061using TestInterfaceIteratorPrototype = JSDOMIteratorPrototype<JSTestInterface, TestInterfaceIteratorTraits>;
     1062
     1063template<>
     1064const JSC::ClassInfo TestInterfaceIterator::s_info = { "TestInterface Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TestInterfaceIterator) };
     1065
     1066template<>
     1067const JSC::ClassInfo TestInterfaceIteratorPrototype::s_info = { "TestInterface Iterator", &Base::s_info, nullptr, nullptr, CREATE_METHOD_TABLE(TestInterfaceIteratorPrototype) };
     1068
     1069static inline EncodedJSValue jsTestInterfacePrototypeFunctionEntriesCaller(JSGlobalObject*, CallFrame*, JSTestInterface* thisObject, JSC::ThrowScope&)
     1070{
     1071    return JSValue::encode(iteratorCreate<TestInterfaceIterator>(*thisObject, IterationKind::KeyValue));
     1072}
     1073
     1074JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionEntries(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
     1075{
     1076    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionEntriesCaller>(*lexicalGlobalObject, *callFrame, "entries");
     1077}
     1078
     1079static inline EncodedJSValue jsTestInterfacePrototypeFunctionKeysCaller(JSGlobalObject*, CallFrame*, JSTestInterface* thisObject, JSC::ThrowScope&)
     1080{
     1081    return JSValue::encode(iteratorCreate<TestInterfaceIterator>(*thisObject, IterationKind::Key));
     1082}
     1083
     1084JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionKeys(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
     1085{
     1086    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionKeysCaller>(*lexicalGlobalObject, *callFrame, "keys");
     1087}
     1088
     1089static inline EncodedJSValue jsTestInterfacePrototypeFunctionValuesCaller(JSGlobalObject*, CallFrame*, JSTestInterface* thisObject, JSC::ThrowScope&)
     1090{
     1091    return JSValue::encode(iteratorCreate<TestInterfaceIterator>(*thisObject, IterationKind::Value));
     1092}
     1093
     1094JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionValues(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
     1095{
     1096    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionValuesCaller>(*lexicalGlobalObject, *callFrame, "values");
     1097}
     1098
     1099static inline EncodedJSValue jsTestInterfacePrototypeFunctionForEachCaller(JSGlobalObject* lexicalGlobalObject, CallFrame* callFrame, JSTestInterface* thisObject, JSC::ThrowScope& throwScope)
     1100{
     1101    return JSValue::encode(iteratorForEach<TestInterfaceIterator>(*lexicalGlobalObject, *callFrame, *thisObject, throwScope));
     1102}
     1103
     1104JSC::EncodedJSValue JSC_HOST_CALL jsTestInterfacePrototypeFunctionForEach(JSC::JSGlobalObject* lexicalGlobalObject, JSC::CallFrame* callFrame)
     1105{
     1106    return IDLOperation<JSTestInterface>::call<jsTestInterfacePrototypeFunctionForEachCaller>(*lexicalGlobalObject, *callFrame, "forEach");
     1107}
     1108
    10411109void JSTestInterface::analyzeHeap(JSCell* cell, HeapAnalyzer& analyzer)
    10421110{
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestIterable.cpp

    r251425 r252808  
    2525#include "JSDOMBinding.h"
    2626#include "JSDOMConstructorNotConstructable.h"
     27#include "JSDOMConvertInterface.h"
    2728#include "JSDOMExceptionHandling.h"
    2829#include "JSDOMIterator.h"
    2930#include "JSDOMOperation.h"
    3031#include "JSDOMWrapperCache.h"
     32#include "JSTestNode.h"
    3133#include "ScriptExecutionContext.h"
    3234#include <JavaScriptCore/BuiltinNames.h>
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

    r251691 r252808  
    3434#include "JSDOMOperationReturningPromise.h"
    3535#include "JSDOMWrapperCache.h"
     36#include "JSTestNode.h"
    3637#include "RuntimeEnabledFeatures.h"
    3738#include "ScriptExecutionContext.h"
  • trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl

    r219302 r252808  
    3939    ImplementationLacksVTable
    4040] interface TestInterface {
     41    iterable<TestNode, TestObj>;
    4142};
    4243
Note: See TracChangeset for help on using the changeset viewer.