Changeset 17483 in webkit for trunk/JavaScriptCore/kjs/function.h
- Timestamp:
- Oct 31, 2006, 10:16:08 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.h
r16613 r17483 41 41 friend class ActivationImp; 42 42 public: 43 FunctionImp(ExecState* exec, const Identifier& n, FunctionBodyNode* b);43 FunctionImp(ExecState*, const Identifier& n, FunctionBodyNode* b); 44 44 virtual ~FunctionImp(); 45 45 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); 53 53 Identifier getParameterName(int index); 54 54 // parameters in string representation, e.g. (a, b, c) … … 56 56 virtual CodeType codeType() const = 0; 57 57 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; } 61 61 static const ClassInfo info; 62 62 … … 89 89 * @return The function's scope 90 90 */ 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; } 93 93 94 94 virtual void mark(); … … 99 99 ScopeChain _scope; 100 100 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*); 106 107 }; 107 108 108 109 class DeclaredFunctionImp : public FunctionImp { 109 110 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); 112 113 113 114 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*); 117 118 CodeType codeType() const { return FunctionCode; } 118 119 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*); 124 125 }; 125 126 126 127 class IndexToNameMap { 127 128 public: 128 IndexToNameMap(FunctionImp *func, const List &args);129 IndexToNameMap(FunctionImp* func, const List& args); 129 130 ~IndexToNameMap(); 130 131 131 132 Identifier& operator[](int index); 132 133 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); 135 136 136 137 private: 137 138 IndexToNameMap(); // prevent construction w/o parameters 138 139 int size; 139 Identifier 140 Identifier* _map; 140 141 }; 141 142 142 143 class Arguments : public JSObject { 143 144 public: 144 Arguments(ExecState *exec, FunctionImp *func, const List &args, ActivationImp *act);145 Arguments(ExecState*, FunctionImp* func, const List& args, ActivationImp* act); 145 146 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; 155 156 mutable IndexToNameMap indexToNameMap; 156 157 }; … … 158 159 class ActivationImp : public JSObject { 159 160 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; } 167 168 static const ClassInfo info; 168 169 … … 172 173 private: 173 174 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; 178 179 List _arguments; 179 mutable Arguments *_argumentsObject;180 mutable Arguments* _argumentsObject; 180 181 }; 181 182 … … 183 184 public: 184 185 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); 186 187 virtual CodeType codeType() const; 187 188 enum { Eval, ParseInt, ParseFloat, IsNaN, IsFinite, Escape, UnEscape,
Note:
See TracChangeset
for help on using the changeset viewer.