context.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef KJS_CONTEXT_H
00026 #define KJS_CONTEXT_H
00027
00028 #include "function.h"
00029
00030 namespace KJS {
00031
00035 class ContextImp {
00036 friend class Context;
00037 friend class StatementNode;
00038 public:
00039
00040 ContextImp(Object &glob, InterpreterImp *interpreter, Object &thisV, int _sourceId, CodeType type = GlobalCode,
00041 ContextImp *callingContext = 0L, FunctionImp *func = 0L, const List *args = 0);
00042 virtual ~ContextImp();
00043
00044 const ScopeChain &scopeChain() const { return scope; }
00045 CodeType codeType() const { return m_codeType; }
00046 Object variableObject() const { return variable; }
00047 void setVariableObject(const Object &v) { variable = v; }
00048 Object thisValue() const { return thisVal; }
00049 ContextImp *callingContext() { return _callingContext; }
00050 ObjectImp *activationObject() { return activation.imp(); }
00051 FunctionImp *function() const { return _function; }
00052 const List *arguments() const { return _arguments; }
00053
00054 void pushScope(const Object &s) { scope.push(s.imp()); }
00055 void popScope() { scope.pop(); }
00056 LabelStack *seenLabels() { return &ls; }
00057
00058 void mark();
00059
00060 void pushTryCatch() { tryCatch++; };
00061 void popTryCatch() { tryCatch--; };
00062 bool inTryCatch() const;
00063
00064 void setLines(int l0, int l1) { line0 = l0; line1 = l1; }
00065
00066 private:
00067 InterpreterImp *_interpreter;
00068 ContextImp *_callingContext;
00069 FunctionImp *_function;
00070 const List *_arguments;
00071 Object activation;
00072
00073 ScopeChain scope;
00074 Object variable;
00075 Object thisVal;
00076
00077 LabelStack ls;
00078 CodeType m_codeType;
00079
00080 int tryCatch;
00081 int sourceId;
00082 int line0;
00083 int line1;
00084 Identifier functionName;
00085 List args;
00086 };
00087
00088 }
00089
00090 #endif
|