context.h
00001
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 Object variableObject() const { return variable; }
00046 void setVariableObject(const Object &v) { variable = v; }
00047 Object thisValue() const { return thisVal; }
00048 ContextImp *callingContext() { return _callingContext; }
00049 ObjectImp *activationObject() { return activation.imp(); }
00050 FunctionImp *function() const { return _function; }
00051 const List *arguments() const { return _arguments; }
00052
00053 void pushScope(const Object &s) { scope.push(s.imp()); }
00054 void popScope() { scope.pop(); }
00055 LabelStack *seenLabels() { return &ls; }
00056
00057 void mark();
00058
00059 void pushTryCatch() { tryCatch++; };
00060 void popTryCatch() { tryCatch--; };
00061 bool inTryCatch() const;
00062
00063 void setLines(int l0, int l1) { line0 = l0; line1 = l1; }
00064
00065 CodeType type() const { return codeType; }
00066
00067 private:
00068 InterpreterImp *_interpreter;
00069 ContextImp *_callingContext;
00070 FunctionImp *_function;
00071 const List *_arguments;
00072 Object activation;
00073
00074 ScopeChain scope;
00075 Object variable;
00076 Object thisVal;
00077
00078 LabelStack ls;
00079 CodeType codeType;
00080
00081 int tryCatch;
00082 int sourceId;
00083 int line0;
00084 int line1;
00085 Identifier functionName;
00086 List args;
00087 };
00088
00089 }
00090
00091 #endif
This file is part of the documentation for kjs Library Version 3.2.0.