source: webkit/trunk/JavaScriptCore/kjs/JSFunction.h@ 35027

Last change on this file since 35027 was 35022, checked in by [email protected], 17 years ago

2008-07-05 Sam Weinig <[email protected]>

Reviewed by Cameron Zwarich.

First step in broad cleanup effort.

[ File list elided ]

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1/*
2 * Copyright (C) 1999-2000 Harri Porten ([email protected])
3 * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Cameron Zwarich ([email protected])
5 * Copyright (C) 2007 Maks Orlovich
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 */
23
24#ifndef JSFunction_h
25#define JSFunction_h
26
27#include "InternalFunction.h"
28#include "JSVariableObject.h"
29#include "SymbolTable.h"
30#include "nodes.h"
31#include "JSObject.h"
32
33namespace KJS {
34
35 class FunctionBodyNode;
36 class FunctionPrototype;
37 class JSActivation;
38 class JSGlobalObject;
39
40 class JSFunction : public InternalFunction {
41 public:
42 JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*);
43
44 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
45 virtual void put(ExecState*, const Identifier& propertyName, JSValue*);
46 virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
47
48 JSObject* construct(ExecState*, const ArgList&);
49 JSValue* call(ExecState*, JSValue* thisValue, const ArgList&);
50
51 // Note: Returns a null identifier for any parameters that will never get set
52 // due to a later parameter with the same name.
53 const Identifier& getParameterName(int index);
54
55 void setScope(const ScopeChain& scopeChain) { m_scopeChain = scopeChain; }
56 ScopeChain& scope() { return m_scopeChain; }
57
58 virtual void mark();
59
60 static const ClassInfo info;
61
62 // FIXME: This should be private
63 RefPtr<FunctionBodyNode> m_body;
64
65 private:
66 virtual const ClassInfo* classInfo() const { return &info; }
67
68 virtual ConstructType getConstructData(ConstructData&);
69 virtual CallType getCallData(CallData&);
70
71 static JSValue* argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
72 static JSValue* callerGetter(ExecState*, const Identifier&, const PropertySlot&);
73 static JSValue* lengthGetter(ExecState*, const Identifier&, const PropertySlot&);
74
75 ScopeChain m_scopeChain;
76 };
77
78} // namespace kJS
79
80#endif // JSFunction_h
Note: See TracBrowser for help on using the repository browser.