[WebIDL] Implement overload resolution algorithm
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Aug 2016 17:02:23 +0000 (17:02 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Aug 2016 17:02:23 +0000 (17:02 +0000)
commit66bbc41bb703eda57caab50cbe89a37eb821e08b
treef27a216fc4204a69fe285146beb9b2fe1d1739e2
parent904903fe7c27f054d43926db341107c8ce54bb6a
[WebIDL] Implement overload resolution algorithm
https://bugs.webkit.org/show_bug.cgi?id=160394

Reviewed by Darin Adler.

Source/WebCore:

Implement overload resolution algorithm:
- http://heycam.github.io/webidl/#es-overloads

This means that our support for operation overloading in our IDL is
now a lot more extensive than it used to be and is now compliant with
the Web IDL specification.

In particular, overloading should now work for a lot more parameter
types which means that:
- We should be able to drop some custom bindings code in a follow-up patch.
- We will be able to drop the [StrictTypeChecking] attribute which was
  a hack used to make overloading work for parameters of type DOMString.

Also, the order of the overloads in the IDL no longer impacts the
generated bindings code. It used to be that you needed to put the
overloads with the more specific parameter types first in order for the
generated bindings code to be somewhat correct.

No new tests, rebaselined bindings tests.

* bindings/scripts/CodeGenerator.pm:
(IsStringOrEnumType):
* bindings/scripts/CodeGeneratorJS.pm:
(IsNullableType):
(StripNullable):
(ComputeEffectiveOverloadSet):
(AreTypesDistinguishableForOverloadResolution):
(GetDistinguishingArgumentIndex):
(GetOverloadThatMatches):
(GenerateOverloadedFunction):
* bindings/scripts/test/JS/JSTestGlobalObject.cpp:
(WebCore::jsTestGlobalObjectInstanceFunctionEnabledAtRuntimeOperation):
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjPrototypeFunctionEnabledAtRuntimeOperation):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction):
(WebCore::jsTestObjConstructorFunctionOverloadedMethod12): Deleted.
(WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise): Deleted.
* bindings/scripts/test/TestObj.idl:
* dom/EventTarget.h:
* dom/EventTarget.idl:
* html/HTMLOptionsCollection.h:
* html/HTMLOptionsCollection.idl:
* html/HTMLSelectElement.h:
(WebCore::HTMLSelectElement::add):
* html/HTMLSelectElement.idl:

LayoutTests:

Update / Rebaseline existing test. There is no major behavior change.
We sometimes get a different exception message than we used to.

* fast/canvas/canvas-clip-path-expected.txt:
* fast/canvas/canvas-fill-path-expected.txt:
* fast/canvas/canvas-path-addPath-expected.txt:
* fast/canvas/canvas-path-isPointInPath-expected.txt:
* fast/canvas/canvas-path-isPointInStroke-expected.txt:
* fast/canvas/canvas-putImageData-expected.txt:
* fast/canvas/canvas-putImageData.js:
* fast/canvas/canvas-stroke-path-expected.txt:
* fast/canvas/webgl/script-tests/texImageTest.js:
* fast/canvas/webgl/texImageTest-expected.txt:
* fast/dom/HTMLSelectElement/add-expected.txt:
* fast/dom/HTMLSelectElement/add.html:
* fast/dom/HTMLSelectElement/options-collection-add-expected.txt:
* fast/dom/HTMLSelectElement/options-collection-add.html:
* fast/dom/incompatible-operations-expected.txt:
* js/dom/select-options-add-expected.txt:
* webaudio/audiobuffer-expected.txt:
* webaudio/audiobuffer.html:
* webgl/1.0.2/resources/webgl_test_files/conformance/textures/tex-image-with-invalid-data.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/canvas/canvas-clip-path-expected.txt
LayoutTests/fast/canvas/canvas-fill-path-expected.txt
LayoutTests/fast/canvas/canvas-path-addPath-expected.txt
LayoutTests/fast/canvas/canvas-path-isPointInPath-expected.txt
LayoutTests/fast/canvas/canvas-path-isPointInStroke-expected.txt
LayoutTests/fast/canvas/canvas-putImageData-expected.txt
LayoutTests/fast/canvas/canvas-putImageData.js
LayoutTests/fast/canvas/canvas-stroke-path-expected.txt
LayoutTests/fast/canvas/webgl/script-tests/texImageTest.js
LayoutTests/fast/canvas/webgl/texImageTest-expected.txt
LayoutTests/fast/dom/HTMLSelectElement/add-expected.txt
LayoutTests/fast/dom/HTMLSelectElement/add.html
LayoutTests/fast/dom/HTMLSelectElement/options-collection-add-expected.txt
LayoutTests/fast/dom/HTMLSelectElement/options-collection-add.html
LayoutTests/fast/dom/incompatible-operations-expected.txt
LayoutTests/js/dom/select-options-add-expected.txt
LayoutTests/webaudio/audiobuffer-expected.txt
LayoutTests/webaudio/audiobuffer.html
LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/textures/tex-image-with-invalid-data.html
Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGenerator.pm
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestGlobalObject.cpp
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/EventTarget.h
Source/WebCore/dom/EventTarget.idl
Source/WebCore/html/HTMLOptionsCollection.h
Source/WebCore/html/HTMLOptionsCollection.idl
Source/WebCore/html/HTMLSelectElement.h
Source/WebCore/html/HTMLSelectElement.idl