source: webkit/trunk/JavaScriptCore/runtime/JSFunction.h@ 38826

Last change on this file since 38826 was 38826, checked in by [email protected], 16 years ago

2008-11-27 Cameron Zwarich <[email protected]>

Not reviewed.

r38825 made JSFunction::m_body private, but some inspector code in
WebCore sets the field. Add setters for it, and update the inspector
code to use the new getters and setters.

JavaScriptCore:

  • runtime/JSFunction.h: (JSC::JSFunction::setBody):

WebCore:

  • inspector/JavaScriptDebugServer.cpp: (WebCore::JavaScriptDebugServer::recompileAllJSFunctions):
  • Property svn:eol-style set to native
File size: 3.5 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 JSC {
34
35 class FunctionBodyNode;
36 class FunctionPrototype;
37 class JSActivation;
38 class JSGlobalObject;
39
40 class JSFunction : public InternalFunction {
41 friend class JIT;
42 friend class Interpreter;
43
44 typedef InternalFunction Base;
45
46 JSFunction(PassRefPtr<Structure> structure)
47 : InternalFunction(structure)
48 , m_scopeChain(NoScopeChain())
49 {
50 }
51
52 public:
53 JSFunction(ExecState*, const Identifier&, FunctionBodyNode*, ScopeChainNode*);
54 ~JSFunction();
55
56 virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
57 virtual void put(ExecState*, const Identifier& propertyName, JSValue*, PutPropertySlot&);
58 virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
59
60 JSObject* construct(ExecState*, const ArgList&);
61 JSValue* call(ExecState*, JSValue* thisValue, const ArgList&);
62
63 void setScope(const ScopeChain& scopeChain) { m_scopeChain = scopeChain; }
64 ScopeChain& scope() { return m_scopeChain; }
65
66 void setBody(FunctionBodyNode* body) { m_body = body; }
67 void setBody(PassRefPtr<FunctionBodyNode> body) { m_body = body; }
68 FunctionBodyNode* body() const { return m_body.get(); }
69
70 virtual void mark();
71
72 static const ClassInfo info;
73
74 static PassRefPtr<Structure> createStructure(JSValue* prototype)
75 {
76 return Structure::create(prototype, TypeInfo(ObjectType, ImplementsHasInstance));
77 }
78
79 private:
80 virtual const ClassInfo* classInfo() const { return &info; }
81
82 virtual ConstructType getConstructData(ConstructData&);
83 virtual CallType getCallData(CallData&);
84
85 static JSValue* argumentsGetter(ExecState*, const Identifier&, const PropertySlot&);
86 static JSValue* callerGetter(ExecState*, const Identifier&, const PropertySlot&);
87 static JSValue* lengthGetter(ExecState*, const Identifier&, const PropertySlot&);
88
89 RefPtr<FunctionBodyNode> m_body;
90 ScopeChain m_scopeChain;
91 };
92
93 JSFunction* asFunction(JSValue*);
94
95 inline JSFunction* asFunction(JSValue* value)
96 {
97 ASSERT(asObject(value)->inherits(&JSFunction::info));
98 return static_cast<JSFunction*>(asObject(value));
99 }
100
101} // namespace kJS
102
103#endif // JSFunction_h
Note: See TracBrowser for help on using the repository browser.