Autogenerate passing union types as part of a functions variadic arguments
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Oct 2016 19:07:14 +0000 (19:07 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Oct 2016 19:07:14 +0000 (19:07 +0000)
commit28c54a656d181dde05cc304d325c81e8af02d069
treed55a8706d3c4087fa5e329b606aec89b2f18a5a9
parent74dba23588ec4518f912474ccb44da165c54354e
Autogenerate passing union types as part of a functions variadic arguments
https://bugs.webkit.org/show_bug.cgi?id=162919

Reviewed by Darin Adler.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSBindingsAllInOne.cpp:
Remove deleted files.

* bindings/generic/IDLTypes.h:
Switch to use std::reference_wrapper as it's implementation type. We may need more
granularity here in the future, but this will work for now.

* bindings/js/JSCharacterDataCustom.cpp: Removed.
* bindings/js/JSDocumentTypeCustom.cpp: Removed.
* bindings/js/JSNodeOrString.cpp: Removed.
* bindings/js/JSNodeOrString.h: Removed.

* bindings/js/JSDOMBinding.h:
(WebCore::VariadicHelperBase::convert): Deleted.
(WebCore::toArguments): Deleted.
Moved to JSDOMConvert.h and renamed to convertVariadicArguments and make
it work in terms of IDLTypes.

* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLInterface<T>>::convert):
(WebCore::VariadicConverterBase::convert):
(WebCore::VariadicConverterBase<IDLInterface<T>>::convert):
(WebCore::convertVariadicArguments):

* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::prepend): Deleted.
(WebCore::JSDocument::append): Deleted.
* bindings/js/JSDocumentFragmentCustom.cpp:
(WebCore::JSDocumentFragment::prepend): Deleted.
(WebCore::JSDocumentFragment::append): Deleted.
* bindings/js/JSElementCustom.cpp:
(WebCore::JSElement::before): Deleted.
(WebCore::JSElement::after): Deleted.
(WebCore::JSElement::replaceWith): Deleted.
(WebCore::JSElement::prepend): Deleted.
(WebCore::JSElement::append): Deleted.
Remove now generated functions.

* bindings/scripts/CodeGenerator.pm:
(assert):
Add assert to help debugging.

(ParseInterface):
Don't treat union types as interfaces.

(GetFlattenedMemberTypes):
(GetNumberOfNullableMemberTypes):
(GetIDLUnionMemberTypes):
Implement WebIDL algorithms for getting the flattened member list of union, and use it
to construct the c++ IDLType.

(GetBaseIDLType):
(GetIDLType):
Add helper to convert an parsed idlType to a c++ IDLType.

(IsWrapperType):
Don't treat union types as wrappers.

* bindings/scripts/CodeGeneratorJS.pm:
(AddToImplIncludesForIDLType):
Add helper for adding #includes based on a parsed idlType. It recursively handles union types.

(GenerateParametersCheck):
Use the new convertVariadicArguments function to handle all variadic arguments, including
union types.

* bindings/scripts/IDLParser.pm:
(parseDictionaryMember):
(parseAttributeRest):
(parseOptionalOrRequiredArgument):
(parseExceptionField):
Add an idlType to domSignature and populate it.

* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod13):
(WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
(WebCore::jsTestObjPrototypeFunctionVariadicUnionMethod):
* bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::constructJSTestOverloadedConstructors5):
* bindings/scripts/test/TestObj.idl:
Add and update tests.

* dom/ChildNode.idl:
* dom/ParentNode.idl:
Remove Custom extended attribute.

* dom/ContainerNode.cpp:
* dom/ContainerNode.h:
* dom/Node.cpp:
* dom/Node.h:
Switch to using std::reference_wrapper instead of Ref<> for passed in parameters.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206956 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/generic/IDLTypes.h
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSCharacterDataCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSDOMBinding.h
Source/WebCore/bindings/js/JSDOMConvert.h
Source/WebCore/bindings/js/JSDocumentCustom.cpp
Source/WebCore/bindings/js/JSDocumentFragmentCustom.cpp
Source/WebCore/bindings/js/JSDocumentTypeCustom.cpp [deleted file]
Source/WebCore/bindings/js/JSElementCustom.cpp
Source/WebCore/bindings/js/JSNodeOrString.cpp [deleted file]
Source/WebCore/bindings/js/JSNodeOrString.h [deleted file]
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/IDLParser.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/ChildNode.idl
Source/WebCore/dom/ContainerNode.cpp
Source/WebCore/dom/ContainerNode.h
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/ParentNode.idl