Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/ast.h

Issue 546075: First step of refactoring expression contexts in the toplevel code... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Evaluated for control flow (and side effects). 173 // Evaluated for control flow (and side effects).
174 kTest, 174 kTest,
175 // Evaluated for control flow and side effects. Value is also 175 // Evaluated for control flow and side effects. Value is also
176 // needed if true. 176 // needed if true.
177 kValueTest, 177 kValueTest,
178 // Evaluated for control flow and side effects. Value is also 178 // Evaluated for control flow and side effects. Value is also
179 // needed if false. 179 // needed if false.
180 kTestValue 180 kTestValue
181 }; 181 };
182 182
183 Expression() : context_(kUninitialized) {}
184
185 virtual Expression* AsExpression() { return this; } 183 virtual Expression* AsExpression() { return this; }
186 184
187 virtual bool IsValidJSON() { return false; } 185 virtual bool IsValidJSON() { return false; }
188 virtual bool IsValidLeftHandSide() { return false; } 186 virtual bool IsValidLeftHandSide() { return false; }
189 187
190 // Symbols that cannot be parsed as array indices are considered property 188 // Symbols that cannot be parsed as array indices are considered property
191 // names. We do not treat symbols that can be array indexes as property 189 // names. We do not treat symbols that can be array indexes as property
192 // names because [] for string objects is handled only by keyed ICs. 190 // names because [] for string objects is handled only by keyed ICs.
193 virtual bool IsPropertyName() { return false; } 191 virtual bool IsPropertyName() { return false; }
194 192
195 // Mark the expression as being compiled as an expression 193 // Mark the expression as being compiled as an expression
196 // statement. This is used to transform postfix increments to 194 // statement. This is used to transform postfix increments to
197 // (faster) prefix increments. 195 // (faster) prefix increments.
198 virtual void MarkAsStatement() { /* do nothing */ } 196 virtual void MarkAsStatement() { /* do nothing */ }
199 197
200 // Static type information for this expression. 198 // Static type information for this expression.
201 StaticType* type() { return &type_; } 199 StaticType* type() { return &type_; }
202 200
203 Context context() { return context_; }
204 void set_context(Context context) { context_ = context; }
205
206 private: 201 private:
207 StaticType type_; 202 StaticType type_;
208 Context context_;
209 }; 203 };
210 204
211 205
212 /** 206 /**
213 * A sentinel used during pre parsing that represents some expression 207 * A sentinel used during pre parsing that represents some expression
214 * that is a valid left hand side without having to actually build 208 * that is a valid left hand side without having to actually build
215 * the expression. 209 * the expression.
216 */ 210 */
217 class ValidLeftHandSideSentinel: public Expression { 211 class ValidLeftHandSideSentinel: public Expression {
218 public: 212 public:
(...skipping 1592 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 #undef DEF_VISIT 1805 #undef DEF_VISIT
1812 1806
1813 private: 1807 private:
1814 bool stack_overflow_; 1808 bool stack_overflow_;
1815 }; 1809 };
1816 1810
1817 1811
1818 } } // namespace v8::internal 1812 } } // namespace v8::internal
1819 1813
1820 #endif // V8_AST_H_ 1814 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « src/arm/fast-codegen-arm.cc ('k') | src/compiler.cc » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698