Changeset 26715 in webkit for trunk/JavaScriptCore/kjs/function.h
- Timestamp:
- Oct 17, 2007, 2:01:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/function.h
r26620 r26715 73 73 }; 74 74 75 /**76 * @short Implementation class for internal Functions.77 */78 75 class FunctionImp : public InternalFunctionImp { 79 76 friend class ActivationImp; 80 77 public: 81 FunctionImp(ExecState*, const Identifier& n, FunctionBodyNode* b); 82 virtual ~FunctionImp(); 78 FunctionImp(ExecState*, const Identifier& name, FunctionBodyNode*, const ScopeChain&); 83 79 84 80 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&); … … 86 82 virtual bool deleteProperty(ExecState*, const Identifier& propertyName); 87 83 84 virtual bool implementsConstruct() const { return true; } 85 virtual JSObject* construct(ExecState*, const List& args); 86 88 87 virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List& args); 88 Completion execute(ExecState*); 89 89 90 90 // Note: unlike body->paramName, this returns Identifier::null for parameters 91 91 // that will never get set, due to later param having the same name 92 92 Identifier getParameterName(int index); 93 virtual CodeType codeType() const = 0;94 95 virtual Completion execute(ExecState*) = 0;96 93 97 94 virtual const ClassInfo* classInfo() const { return &info; } … … 100 97 RefPtr<FunctionBodyNode> body; 101 98 102 /** 103 * Returns the scope of this object. This is used when execution declared 104 * functions - the execution context for the function is initialized with 105 * extra object in it's scope. An example of this is functions declared 106 * inside other functions: 107 * 108 * \code 109 * function f() { 110 * 111 * function b() { 112 * return prototype; 113 * } 114 * 115 * var x = 4; 116 * // do some stuff 117 * } 118 * f.prototype = new String(); 119 * \endcode 120 * 121 * When the function f.b is executed, its scope will include properties of 122 * f. So in the example above the return value of f.b() would be the new 123 * String object that was assigned to f.prototype. 124 * 125 * @param exec The current execution state 126 * @return The function's scope 127 */ 99 void setScope(const ScopeChain& s) { _scope = s; } 128 100 const ScopeChain& scope() const { return _scope; } 129 void setScope(const ScopeChain& s) { _scope = s; }130 101 131 102 virtual void mark(); … … 139 110 140 111 void passInParameters(ExecState*, const List&); 141 virtual void processVarDecls(ExecState*); 142 }; 143 144 class DeclaredFunctionImp : public FunctionImp { 145 public: 146 DeclaredFunctionImp(ExecState*, const Identifier& n, 147 FunctionBodyNode* b, const ScopeChain& sc); 148 149 bool implementsConstruct() const; 150 JSObject* construct(ExecState*, const List& args); 151 152 virtual Completion execute(ExecState*); 153 CodeType codeType() const { return FunctionCode; } 154 155 virtual const ClassInfo* classInfo() const { return &info; } 156 static const ClassInfo info; 157 158 private: 159 virtual void processVarDecls(ExecState*); 112 void processVarDecls(ExecState*); 160 113 }; 161 114 … … 223 176 GlobalFuncImp(ExecState*, FunctionPrototype*, int i, int len, const Identifier&); 224 177 virtual JSValue* callAsFunction(ExecState*, JSObject* thisObj, const List& args); 225 virtual CodeType codeType() const;226 178 enum { Eval, ParseInt, ParseFloat, IsNaN, IsFinite, Escape, UnEscape, 227 179 DecodeURI, DecodeURIComponent, EncodeURI, EncodeURIComponent
Note:
See TracChangeset
for help on using the changeset viewer.