Changeset 157048 in webkit


Ignore:
Timestamp:
Oct 7, 2013 10:45:42 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Conditional support in bindings code generator for overloaded functions
https://bugs.webkit.org/show_bug.cgi?id=122443

Patch by Philippe Normand <pnormand@igalia.com> on 2013-10-07
Reviewed by Darin Adler.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateOverloadedFunction): Generate conditional for overloaded
function, if it's present in the idl.
(GenerateImplementation): Close the last overloaded function
conditional before generating the distpatch function.

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::jsTestObjConstructorFunctionOverloadedMethod1):
Rebaseline overloaded function tests.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r157045 r157048  
     12013-10-07  Philippe Normand  <pnormand@igalia.com>
     2
     3        Conditional support in bindings code generator for overloaded functions
     4        https://bugs.webkit.org/show_bug.cgi?id=122443
     5
     6        Reviewed by Darin Adler.
     7
     8        * bindings/scripts/CodeGeneratorJS.pm:
     9        (GenerateOverloadedFunction): Generate conditional for overloaded
     10        function, if it's present in the idl.
     11        (GenerateImplementation): Close the last overloaded function
     12        conditional before generating the distpatch function.
     13        * bindings/scripts/test/JS/JSTestObj.cpp:
     14        (WebCore::jsTestObjConstructorFunctionOverloadedMethod1):
     15        Rebaseline overloaded function tests.
     16
    1172013-10-07  Tim Horton  <timothy_horton@apple.com>
    218
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r156769 r157048  
    12871287        }
    12881288
     1289        my $conditionalString = $codeGenerator->GenerateConditionalString($overload->signature);
     1290        push(@implContent, "#if ${conditionalString}\n") if $conditionalString;
     1291
    12891292        push(@implContent, "    if ($parametersCheck)\n");
    12901293        push(@implContent, "        return ${functionName}$overload->{overloadIndex}(exec);\n");
     1294        push(@implContent, "#endif\n\n") if $conditionalString;
     1295
    12911296    }
    12921297    if ($leastNumMandatoryParams >= 1) {
     
    24332438
    24342439            push(@implContent, "}\n\n");
     2440            push(@implContent, "#endif\n\n") if $conditional;
    24352441
    24362442            if (!$isCustom && $isOverloaded && $function->{overloadIndex} == @{$function->{overloads}}) {
     
    24392445            }
    24402446
    2441             push(@implContent, "#endif\n\n") if $conditional;
    24422447        }
    24432448    }
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r156808 r157048  
    28192819}
    28202820
     2821#endif
     2822
    28212823EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(ExecState* exec)
    28222824{
    28232825    size_t argsCount = exec->argumentCount();
     2826#if ENABLE(Condition1)
    28242827    if (argsCount == 1)
    28252828        return jsTestObjConstructorFunctionOverloadedMethod11(exec);
     2829#endif
     2830
    28262831    JSValue arg0(exec->argument(0));
     2832#if ENABLE(Condition1)
    28272833    if ((argsCount == 1 && (arg0.isUndefinedOrNull() || arg0.isString() || arg0.isObject())))
    28282834        return jsTestObjConstructorFunctionOverloadedMethod12(exec);
     2835#endif
     2836
    28292837    if (argsCount < 1)
    28302838        return throwVMError(exec, createNotEnoughArgumentsError(exec));
    28312839    return throwVMTypeError(exec);
    28322840}
    2833 
    2834 #endif
    28352841
    28362842EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithClamp(ExecState* exec)
Note: See TracChangeset for help on using the changeset viewer.