Changeset 123800 in webkit


Ignore:
Timestamp:
Jul 26, 2012 3:15:56 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Support constructor-type static readonly attribute for CodeGenerator.
https://bugs.webkit.org/show_bug.cgi?id=92413.

Patch by Chang Shu <cshu@webkit.org> on 2012-07-26
Reviewed by Adam Barth.

Added support for constructor-type static readonly attribute for CodeGenerator.
This is achieved by putting the attribute entry in the table where static properties
belong to but leave the implementation same as a non-static constructor-type attribute.

Tested by running run-bindings-tests.

  • bindings/scripts/CodeGeneratorJS.pm:

(GenerateImplementation):

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

(WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr):
(WebCore::jsTestInterfaceConstructorSupplementalStaticAttr):

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

(WebCore):
(WebCore::jsTestObjConstructorStaticReadOnlyLongAttr):
(WebCore::jsTestObjConstructorStaticStringAttr):
(WebCore::jsTestObjConstructorTestSubObj):

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

(WebCore):

  • bindings/scripts/test/TestObj.idl:
  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore):

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r123799 r123800  
     12012-07-26  Chang Shu  <cshu@webkit.org>
     2
     3        Support constructor-type static readonly attribute for CodeGenerator.
     4        https://bugs.webkit.org/show_bug.cgi?id=92413.
     5
     6        Reviewed by Adam Barth.
     7
     8        Added support for constructor-type static readonly attribute for CodeGenerator.
     9        This is achieved by putting the attribute entry in the table where static properties
     10        belong to but leave the implementation same as a non-static constructor-type attribute.
     11
     12        Tested by running run-bindings-tests.
     13
     14        * bindings/scripts/CodeGeneratorJS.pm:
     15        (GenerateImplementation):
     16        * bindings/scripts/test/JS/JSTestInterface.cpp:
     17        (WebCore::jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr):
     18        (WebCore::jsTestInterfaceConstructorSupplementalStaticAttr):
     19        * bindings/scripts/test/JS/JSTestObj.cpp:
     20        (WebCore):
     21        (WebCore::jsTestObjConstructorStaticReadOnlyLongAttr):
     22        (WebCore::jsTestObjConstructorStaticStringAttr):
     23        (WebCore::jsTestObjConstructorTestSubObj):
     24        * bindings/scripts/test/JS/JSTestObj.h:
     25        (WebCore):
     26        * bindings/scripts/test/TestObj.idl:
     27        * bindings/scripts/test/V8/V8TestObj.cpp:
     28        (WebCore):
     29
    1302012-07-26  Sadrul Habib Chowdhury  <sadrul@chromium.org>
    231
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r123546 r123800  
    17651765                push(@implContent, "#if ${attributeConditionalString}\n") if $attributeConditionalString;
    17661766
    1767                 push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue");
    1768                 push(@implContent, " slotBase") if !$attribute->isStatic;
    1769                 push(@implContent, ", PropertyName)\n");
     1767                push(@implContent, "JSValue ${getFunctionName}(ExecState* exec, JSValue slotBase, PropertyName)\n");
    17701768                push(@implContent, "{\n");
    17711769
    1772                 if (!$attribute->isStatic) {
     1770                if (!$attribute->isStatic || $attribute->signature->type =~ /Constructor$/) {
    17731771                    push(@implContent, "    ${className}* castedThis = jsCast<$className*>(asObject(slotBase));\n");
     1772                } else {
     1773                    push(@implContent, "    UNUSED_PARAM(slotBase);\n");
    17741774                }
    17751775
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp

    r123439 r123800  
    243243
    244244#if ENABLE(Condition11) || ENABLE(Condition12)
    245 JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec, JSValue, PropertyName)
    246 {
     245JSValue jsTestInterfaceConstructorSupplementalStaticReadOnlyAttr(ExecState* exec, JSValue slotBase, PropertyName)
     246{
     247    UNUSED_PARAM(slotBase);
    247248    UNUSED_PARAM(exec);
    248249    JSValue result = jsNumber(TestSupplemental::supplementalStaticReadOnlyAttr());
     
    253254
    254255#if ENABLE(Condition11) || ENABLE(Condition12)
    255 JSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSValue, PropertyName)
    256 {
     256JSValue jsTestInterfaceConstructorSupplementalStaticAttr(ExecState* exec, JSValue slotBase, PropertyName)
     257{
     258    UNUSED_PARAM(slotBase);
    257259    UNUSED_PARAM(exec);
    258260    JSValue result = jsString(exec, TestSupplemental::supplementalStaticAttr());
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r123600 r123800  
    169169    { "staticReadOnlyLongAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticReadOnlyLongAttr), (intptr_t)0, NoIntrinsic },
    170170    { "staticStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorStaticStringAttr), (intptr_t)setJSTestObjConstructorStaticStringAttr, NoIntrinsic },
     171    { "TestSubObj", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjConstructorTestSubObj), (intptr_t)0, NoIntrinsic },
    171172    { "classMethod", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethod), (intptr_t)0, NoIntrinsic },
    172173    { "classMethodWithOptional", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestObjConstructorFunctionClassMethodWithOptional), (intptr_t)1, NoIntrinsic },
     
    414415
    415416
    416 JSValue jsTestObjConstructorStaticReadOnlyLongAttr(ExecState* exec, JSValue, PropertyName)
    417 {
     417JSValue jsTestObjConstructorStaticReadOnlyLongAttr(ExecState* exec, JSValue slotBase, PropertyName)
     418{
     419    UNUSED_PARAM(slotBase);
    418420    UNUSED_PARAM(exec);
    419421    JSValue result = jsNumber(TestObj::staticReadOnlyLongAttr());
     
    422424
    423425
    424 JSValue jsTestObjConstructorStaticStringAttr(ExecState* exec, JSValue, PropertyName)
    425 {
     426JSValue jsTestObjConstructorStaticStringAttr(ExecState* exec, JSValue slotBase, PropertyName)
     427{
     428    UNUSED_PARAM(slotBase);
    426429    UNUSED_PARAM(exec);
    427430    JSValue result = jsString(exec, TestObj::staticStringAttr());
    428431    return result;
     432}
     433
     434
     435JSValue jsTestObjConstructorTestSubObj(ExecState* exec, JSValue slotBase, PropertyName)
     436{
     437    JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
     438    return JSTestSubObj::getConstructor(exec, castedThis);
    429439}
    430440
  • trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h

    r123600 r123800  
    224224JSC::JSValue jsTestObjConstructorStaticStringAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
    225225void setJSTestObjConstructorStaticStringAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
     226JSC::JSValue jsTestObjConstructorTestSubObj(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
    226227JSC::JSValue jsTestObjShortAttr(JSC::ExecState*, JSC::JSValue, JSC::PropertyName);
    227228void setJSTestObjShortAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue);
  • trunk/Source/WebCore/bindings/scripts/test/TestObj.idl

    r123600 r123800  
    4242        static readonly attribute long     staticReadOnlyLongAttr;
    4343        static attribute DOMString         staticStringAttr;
     44        static readonly attribute TestSubObjConstructor TestSubObj;
    4445#endif
    4546        attribute short                    shortAttr;
  • trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r123600 r123800  
    4949#include "V8ScriptProfile.h"
    5050#include "V8TestCallback.h"
     51#include "V8TestSubObj.h"
    5152#include "V8a.h"
    5253#include "V8any.h"
     
    19111912    // Attribute 'staticStringAttr' (Type: 'attribute' ExtAttr: '')
    19121913    {"staticStringAttr", TestObjV8Internal::staticStringAttrAttrGetter, TestObjV8Internal::staticStringAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
     1914    // Attribute 'TestSubObj' (Type: 'readonly attribute' ExtAttr: '')
     1915    {"TestSubObj", TestObjV8Internal::TestObjConstructorGetter, 0, &V8TestSubObj::info, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
    19131916    // Attribute 'shortAttr' (Type: 'attribute' ExtAttr: '')
    19141917    {"shortAttr", TestObjV8Internal::shortAttrAttrGetter, TestObjV8Internal::shortAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
Note: See TracChangeset for help on using the changeset viewer.