#ifndef KJS_CONTEXT_H
#define KJS_CONTEXT_H
#include "function.h"
#include "protect.h"
namespace KJS {
class ContextImp {
public:
ContextImp(Object &glob, InterpreterImp *, Object &thisV, CodeType type = GlobalCode,
ContextImp *callingContext = 0, FunctionImp *functiion = 0, const List *args = 0);
~ContextImp();
const ScopeChain &scopeChain() const { return scope; }
Object variableObject() const { return variable; }
void setVariableObject(const Object &v) { variable = v; }
Object thisValue() const { return thisVal; }
ContextImp *callingContext() { return _callingContext; }
ObjectImp *activationObject() { return activation.imp(); }
FunctionImp *function() const { return _function; }
const List *arguments() const { return _arguments; }
void pushScope(const Object &s) { scope.push(s.imp()); }
void popScope() { scope.pop(); }
LabelStack *seenLabels() { return &ls; }
void mark();
private:
InterpreterImp *_interpreter;
ContextImp *_callingContext;
FunctionImp *_function;
const List *_arguments;
ProtectedObject activation;
ScopeChain scope;
ProtectedObject variable;
ProtectedObject thisVal;
LabelStack ls;
CodeType codeType;
};
}
#endif