Changeset 11802 in webkit for trunk/JavaScriptCore/kjs/nodes.h
- Timestamp:
- Dec 29, 2005, 3:16:11 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/nodes.h
r11566 r11802 27 27 28 28 #include <kxmlcore/RefPtr.h> 29 #include <kxmlcore/ListRefPtr.h> 29 30 30 31 #include "internal.h" … … 220 221 public: 221 222 // list pointer is tail of a circular list, cracked in the ArrayNode ctor 222 ElementNode(int e, Node *n) : list(this), elision(e), node(n) { }223 ElementNode(int e, Node *n) : next(this), elision(e), node(n) { } 223 224 ElementNode(ElementNode *l, int e, Node *n) 224 : list(l->list), elision(e), node(n) { l->list = this; } 225 JSValue *evaluate(ExecState *exec); 226 virtual void streamTo(SourceStream &s) const; 225 : next(l->next), elision(e), node(n) { l->next = this; } 226 JSValue *evaluate(ExecState *exec); 227 virtual void streamTo(SourceStream &s) const; 228 PassRefPtr<ElementNode> releaseNext() { return next.release(); } 227 229 private: 228 230 friend class ArrayNode; 229 RefPtr<ElementNode> list;231 ListRefPtr<ElementNode> next; 230 232 int elision; 231 233 RefPtr<Node> node; … … 236 238 ArrayNode(int e) : element(0), elision(e), opt(true) { } 237 239 ArrayNode(ElementNode *ele) 238 : element(ele-> list), elision(0), opt(false) { ele->list = 0; }240 : element(ele->next), elision(0), opt(false) { ele->next = 0; } 239 241 ArrayNode(int eli, ElementNode *ele) 240 : element(ele-> list), elision(eli), opt(true) { ele->list = 0; }242 : element(ele->next), elision(eli), opt(true) { ele->next = 0; } 241 243 JSValue *evaluate(ExecState *exec); 242 244 virtual void streamTo(SourceStream &s) const; … … 276 278 // list pointer is tail of a circular list, cracked in the ObjectLiteralNode ctor 277 279 PropertyListNode(PropertyNode *n) 278 279 : node(n), list(this) { } 280 : node(n), next(this) { } 280 281 PropertyListNode(PropertyNode *n, PropertyListNode *l) 281 : node(n), list(l->list) { l->list = this; } 282 JSValue *evaluate(ExecState *exec); 283 virtual void streamTo(SourceStream &s) const; 282 : node(n), next(l->next) { l->next = this; } 283 JSValue *evaluate(ExecState *exec); 284 virtual void streamTo(SourceStream &s) const; 285 PassRefPtr<PropertyListNode> releaseNext() { return next.release(); } 284 286 private: 285 287 friend class ObjectLiteralNode; 286 288 RefPtr<PropertyNode> node; 287 RefPtr<PropertyListNode> list;289 ListRefPtr<PropertyListNode> next; 288 290 }; 289 291 … … 291 293 public: 292 294 ObjectLiteralNode() : list(0) { } 293 ObjectLiteralNode(PropertyListNode *l) : list(l-> list) { l->list = 0; }295 ObjectLiteralNode(PropertyListNode *l) : list(l->next) { l->next = 0; } 294 296 JSValue *evaluate(ExecState *exec); 295 297 virtual void streamTo(SourceStream &s) const; … … 333 335 public: 334 336 // list pointer is tail of a circular list, cracked in the ArgumentsNode ctor 335 ArgumentListNode(Node *e) : list(this), expr(e) { }337 ArgumentListNode(Node *e) : next(this), expr(e) { } 336 338 ArgumentListNode(ArgumentListNode *l, Node *e) 337 : list(l->list), expr(e) { l->list = this; }339 : next(l->next), expr(e) { l->next = this; } 338 340 JSValue *evaluate(ExecState *exec); 339 341 List evaluateList(ExecState *exec); 340 342 virtual void streamTo(SourceStream &s) const; 343 PassRefPtr<ArgumentListNode> releaseNext() { return next.release(); } 341 344 private: 342 345 friend class ArgumentsNode; 343 RefPtr<ArgumentListNode> list;346 ListRefPtr<ArgumentListNode> next; 344 347 RefPtr<Node> expr; 345 348 }; … … 349 352 ArgumentsNode() : list(0) { } 350 353 ArgumentsNode(ArgumentListNode *l) 351 : list(l-> list) { l->list = 0; }354 : list(l->next) { l->next = 0; } 352 355 JSValue *evaluate(ExecState *exec); 353 356 List evaluateList(ExecState *exec); … … 743 746 virtual void processVarDecls(ExecState *exec); 744 747 virtual void streamTo(SourceStream &s) const; 748 PassRefPtr<StatListNode> releaseNext() { return next.release(); } 745 749 private: 746 750 friend class CaseClauseNode; 747 751 RefPtr<StatementNode> statement; 748 RefPtr<StatListNode> list;752 ListRefPtr<StatListNode> next; 749 753 }; 750 754 … … 774 778 public: 775 779 // list pointer is tail of a circular list, cracked in the ForNode/VarStatementNode ctor 776 VarDeclListNode(VarDeclNode *v) : list(this), var(v) {}780 VarDeclListNode(VarDeclNode *v) : next(this), var(v) {} 777 781 VarDeclListNode(VarDeclListNode *l, VarDeclNode *v) 778 : list(l->list), var(v) { l->list = this; } 779 JSValue *evaluate(ExecState *exec); 780 virtual void processVarDecls(ExecState *exec); 781 virtual void streamTo(SourceStream &s) const; 782 : next(l->next), var(v) { l->next = this; } 783 JSValue *evaluate(ExecState *exec); 784 virtual void processVarDecls(ExecState *exec); 785 virtual void streamTo(SourceStream &s) const; 786 PassRefPtr<VarDeclListNode> releaseNext() { return next.release(); } 782 787 private: 783 788 friend class ForNode; 784 789 friend class VarStatementNode; 785 RefPtr<VarDeclListNode> list;790 ListRefPtr<VarDeclListNode> next; 786 791 RefPtr<VarDeclNode> var; 787 792 }; … … 789 794 class VarStatementNode : public StatementNode { 790 795 public: 791 VarStatementNode(VarDeclListNode *l) : list(l->list) { l->list = 0; }792 virtual Completion execute(ExecState *exec); 793 virtual void processVarDecls(ExecState *exec); 794 virtual void streamTo(SourceStream &s) const; 795 private: 796 RefPtr<VarDeclListNode> list;796 VarStatementNode(VarDeclListNode *l) : next(l->next) { l->next = 0; } 797 virtual Completion execute(ExecState *exec); 798 virtual void processVarDecls(ExecState *exec); 799 virtual void streamTo(SourceStream &s) const; 800 private: 801 RefPtr<VarDeclListNode> next; 797 802 }; 798 803 … … 863 868 expr1(e1), expr2(e2), expr3(e3), statement(s) {} 864 869 ForNode(VarDeclListNode *e1, Node *e2, Node *e3, StatementNode *s) : 865 expr1(e1-> list), expr2(e2), expr3(e3), statement(s) { e1->list = 0; }870 expr1(e1->next), expr2(e2), expr3(e3), statement(s) { e1->next = 0; } 866 871 virtual Completion execute(ExecState *exec); 867 872 virtual void processVarDecls(ExecState *exec); … … 932 937 class CaseClauseNode : public Node { 933 938 public: 934 CaseClauseNode(Node *e) : expr(e), list(0) { }939 CaseClauseNode(Node *e) : expr(e), next(0) { } 935 940 CaseClauseNode(Node *e, StatListNode *l) 936 : expr(e), list(l->list) { l->list = 0; }941 : expr(e), next(l->next) { l->next = 0; } 937 942 JSValue *evaluate(ExecState *exec); 938 943 Completion evalStatements(ExecState *exec); … … 941 946 private: 942 947 RefPtr<Node> expr; 943 RefPtr<StatListNode> list;948 RefPtr<StatListNode> next; 944 949 }; 945 950 … … 947 952 public: 948 953 // list pointer is tail of a circular list, cracked in the CaseBlockNode ctor 949 ClauseListNode(CaseClauseNode *c) : cl (c), nx(this) { }954 ClauseListNode(CaseClauseNode *c) : clause(c), next(this) { } 950 955 ClauseListNode(ClauseListNode *n, CaseClauseNode *c) 951 : cl(c), nx(n->nx) { n->nx = this; } 952 JSValue *evaluate(ExecState *exec); 953 CaseClauseNode *clause() const { return cl.get(); } 954 ClauseListNode *next() const { return nx.get(); } 955 virtual void processVarDecls(ExecState *exec); 956 virtual void streamTo(SourceStream &s) const; 956 : clause(c), next(n->next) { n->next = this; } 957 JSValue *evaluate(ExecState *exec); 958 CaseClauseNode *getClause() const { return clause.get(); } 959 ClauseListNode *getNext() const { return next.get(); } 960 virtual void processVarDecls(ExecState *exec); 961 virtual void streamTo(SourceStream &s) const; 962 PassRefPtr<ClauseListNode> releaseNext() { return next.release(); } 957 963 private: 958 964 friend class CaseBlockNode; 959 RefPtr<CaseClauseNode> cl ;960 RefPtr<ClauseListNode> nx;965 RefPtr<CaseClauseNode> clause; 966 ListRefPtr<ClauseListNode> next; 961 967 }; 962 968 … … 1023 1029 // list pointer is tail of a circular list, cracked in the FuncDeclNode/FuncExprNode ctor 1024 1030 ParameterNode(const Identifier &i) : id(i), next(this) { } 1025 ParameterNode(ParameterNode * list, const Identifier &i)1026 : id(i), next( list->next) { list->next = this; }1031 ParameterNode(ParameterNode *next, const Identifier &i) 1032 : id(i), next(next->next) { next->next = this; } 1027 1033 JSValue *evaluate(ExecState *exec); 1028 1034 Identifier ident() { return id; } 1029 1035 ParameterNode *nextParam() { return next.get(); } 1030 1036 virtual void streamTo(SourceStream &s) const; 1037 PassRefPtr<ParameterNode> releaseNext() { return next.release(); } 1031 1038 private: 1032 1039 friend class FuncDeclNode; 1033 1040 friend class FuncExprNode; 1034 1041 Identifier id; 1035 RefPtr<ParameterNode> next;1042 ListRefPtr<ParameterNode> next; 1036 1043 }; 1037 1044 … … 1075 1082 class SourceElementsNode : public StatementNode { 1076 1083 public: 1084 static int count; 1077 1085 // list pointer is tail of a circular list, cracked in the BlockNode (or subclass) ctor 1078 1086 SourceElementsNode(StatementNode *s1); 1079 1087 SourceElementsNode(SourceElementsNode *s1, StatementNode *s2); 1080 1088 1081 1089 Completion execute(ExecState *exec); 1082 1090 void processFuncDecl(ExecState *exec); 1083 1091 virtual void processVarDecls(ExecState *exec); 1084 1092 virtual void streamTo(SourceStream &s) const; 1093 PassRefPtr<SourceElementsNode> releaseNext() { return next.release(); } 1085 1094 private: 1086 1095 friend class BlockNode; 1087 RefPtr<StatementNode> element; // 'this' element1088 RefPtr<SourceElementsNode> elements; // pointer to next1096 RefPtr<StatementNode> node; 1097 ListRefPtr<SourceElementsNode> next; 1089 1098 }; 1090 1099
Note:
See TracChangeset
for help on using the changeset viewer.