Changeset 17483 in webkit for trunk/JavaScriptCore/kjs/function.h


Ignore:
Timestamp:
Oct 31, 2006, 10:16:08 AM (19 years ago)
Author:
ap
Message:

2006-10-31 Vladimir Olexa <[email protected]>

Reviewed by Geoff.

http://bugs.webkit.org/show_bug.cgi?id=4166
Function object does not support caller property

Test: fast/js/caller-property.html

  • kjs/function.cpp: (KJS::FunctionImp::callerGetter): added (KJS::FunctionImp::getOwnPropertySlot): added if statement to handle callerGetter()
  • kjs/function.h: added callerGetter() declaration
  • kjs/identifier.h: added caller property macro
  • tests/mozilla/expected.html:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/function.h

    r16613 r17483  
    4141    friend class ActivationImp;
    4242  public:
    43     FunctionImp(ExecState* exec, const Identifier& n, FunctionBodyNode* b);
     43    FunctionImp(ExecState*, const Identifier& n, FunctionBodyNode* b);
    4444    virtual ~FunctionImp();
    4545
    46     virtual bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot&);
    47     virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
    48     virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
    49 
    50     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
    51 
    52     void addParameter(const Identifier &n);
     46    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     47    virtual void put(ExecState*, const Identifier& propertyName, JSValue* value, int attr = None);
     48    virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
     49
     50    virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List& args);
     51
     52    void addParameter(const Identifier& n);
    5353    Identifier getParameterName(int index);
    5454    // parameters in string representation, e.g. (a, b, c)
     
    5656    virtual CodeType codeType() const = 0;
    5757
    58     virtual Completion execute(ExecState *exec) = 0;
    59 
    60     virtual const ClassInfo *classInfo() const { return &info; }
     58    virtual Completion execute(ExecState*) = 0;
     59
     60    virtual const ClassInfo* classInfo() const { return &info; }
    6161    static const ClassInfo info;
    6262
     
    8989     * @return The function's scope
    9090     */
    91     const ScopeChain &scope() const { return _scope; }
    92     void setScope(const ScopeChain &s) { _scope = s; }
     91    const ScopeChain& scope() const { return _scope; }
     92    void setScope(const ScopeChain& s) { _scope = s; }
    9393
    9494    virtual void mark();
     
    9999    ScopeChain _scope;
    100100
    101     static JSValue *argumentsGetter(ExecState *, JSObject *, const Identifier &, const PropertySlot&);
    102     static JSValue *lengthGetter(ExecState *, JSObject *, const Identifier &, const PropertySlot&);
    103 
    104     void processParameters(ExecState *exec, const List &);
    105     virtual void processVarDecls(ExecState *exec);
     101    static JSValue* argumentsGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     102    static JSValue* callerGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     103    static JSValue* lengthGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot&);
     104
     105    void processParameters(ExecState*, const List&);
     106    virtual void processVarDecls(ExecState*);
    106107  };
    107108
    108109  class DeclaredFunctionImp : public FunctionImp {
    109110  public:
    110     DeclaredFunctionImp(ExecState *exec, const Identifier &n,
    111                         FunctionBodyNode *b, const ScopeChain &sc);
     111    DeclaredFunctionImp(ExecState*, const Identifier& n,
     112                        FunctionBodyNode* b, const ScopeChain& sc);
    112113
    113114    bool implementsConstruct() const;
    114     JSObject *construct(ExecState *exec, const List &args);
    115 
    116     virtual Completion execute(ExecState *exec);
     115    JSObject* construct(ExecState*, const List& args);
     116
     117    virtual Completion execute(ExecState*);
    117118    CodeType codeType() const { return FunctionCode; }
    118119
    119     virtual const ClassInfo *classInfo() const { return &info; }
    120     static const ClassInfo info;
    121 
    122   private:
    123     virtual void processVarDecls(ExecState *exec);
     120    virtual const ClassInfo* classInfo() const { return &info; }
     121    static const ClassInfo info;
     122
     123  private:
     124    virtual void processVarDecls(ExecState*);
    124125  };
    125126
    126127  class IndexToNameMap {
    127128  public:
    128     IndexToNameMap(FunctionImp *func, const List &args);
     129    IndexToNameMap(FunctionImp* func, const List& args);
    129130    ~IndexToNameMap();
    130131   
    131132    Identifier& operator[](int index);
    132133    Identifier& operator[](const Identifier &indexIdentifier);
    133     bool isMapped(const Identifier &index) const;
    134     void unMap(const Identifier &index);
     134    bool isMapped(const Identifier& index) const;
     135    void unMap(const Identifier& index);
    135136   
    136137  private:
    137138    IndexToNameMap(); // prevent construction w/o parameters
    138139    int size;
    139     Identifier * _map;
     140    Identifier* _map;
    140141  };
    141142 
    142143  class Arguments : public JSObject {
    143144  public:
    144     Arguments(ExecState *exec, FunctionImp *func, const List &args, ActivationImp *act);
     145    Arguments(ExecState*, FunctionImp* func, const List& args, ActivationImp* act);
    145146    virtual void mark();
    146     virtual bool getOwnPropertySlot(ExecState *, const Identifier &, PropertySlot&);
    147     virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
    148     virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
    149     virtual const ClassInfo *classInfo() const { return &info; }
    150     static const ClassInfo info;
    151   private:
    152     static JSValue *mappedIndexGetter(ExecState *exec, JSObject *, const Identifier &, const PropertySlot& slot);
    153 
    154     ActivationImp *_activationObject;
     147    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     148    virtual void put(ExecState*, const Identifier& propertyName, JSValue* value, int attr = None);
     149    virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
     150    virtual const ClassInfo* classInfo() const { return &info; }
     151    static const ClassInfo info;
     152  private:
     153    static JSValue* mappedIndexGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot);
     154
     155    ActivationImp* _activationObject;
    155156    mutable IndexToNameMap indexToNameMap;
    156157  };
     
    158159  class ActivationImp : public JSObject {
    159160  public:
    160     ActivationImp(FunctionImp *function, const List &arguments);
    161 
    162     virtual bool getOwnPropertySlot(ExecState *exec, const Identifier &, PropertySlot&);
    163     virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
    164     virtual bool deleteProperty(ExecState *exec, const Identifier &propertyName);
    165 
    166     virtual const ClassInfo *classInfo() const { return &info; }
     161    ActivationImp(FunctionImp* function, const List& arguments);
     162
     163    virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
     164    virtual void put(ExecState*, const Identifier& propertyName, JSValue* value, int attr = None);
     165    virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
     166
     167    virtual const ClassInfo* classInfo() const { return &info; }
    167168    static const ClassInfo info;
    168169   
     
    172173  private:
    173174    static PropertySlot::GetValueFunc getArgumentsGetter();
    174     static JSValue *argumentsGetter(ExecState *exec, JSObject *, const Identifier &, const PropertySlot& slot);
    175     void createArgumentsObject(ExecState *exec) const;
    176    
    177     FunctionImp *_function;
     175    static JSValue* argumentsGetter(ExecState*, JSObject*, const Identifier&, const PropertySlot& slot);
     176    void createArgumentsObject(ExecState*) const;
     177   
     178    FunctionImp* _function;
    178179    List _arguments;
    179     mutable Arguments *_argumentsObject;
     180    mutable Arguments* _argumentsObject;
    180181  };
    181182
     
    183184  public:
    184185    GlobalFuncImp(ExecState*, FunctionPrototype*, int i, int len, const Identifier&);
    185     virtual JSValue *callAsFunction(ExecState *exec, JSObject *thisObj, const List &args);
     186    virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List& args);
    186187    virtual CodeType codeType() const;
    187188    enum { Eval, ParseInt, ParseFloat, IsNaN, IsFinite, Escape, UnEscape,
Note: See TracChangeset for help on using the changeset viewer.