OLD | NEW |
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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 CountOperation(bool is_prefix, Token::Value op, Expression* expression) | 1177 CountOperation(bool is_prefix, Token::Value op, Expression* expression) |
1178 : is_prefix_(is_prefix), op_(op), expression_(expression) { | 1178 : is_prefix_(is_prefix), op_(op), expression_(expression) { |
1179 ASSERT(Token::IsCountOp(op)); | 1179 ASSERT(Token::IsCountOp(op)); |
1180 } | 1180 } |
1181 | 1181 |
1182 virtual void Accept(AstVisitor* v); | 1182 virtual void Accept(AstVisitor* v); |
1183 | 1183 |
1184 bool is_prefix() const { return is_prefix_; } | 1184 bool is_prefix() const { return is_prefix_; } |
1185 bool is_postfix() const { return !is_prefix_; } | 1185 bool is_postfix() const { return !is_prefix_; } |
1186 Token::Value op() const { return op_; } | 1186 Token::Value op() const { return op_; } |
| 1187 Token::Value binary_op() { |
| 1188 return op_ == Token::INC ? Token::ADD : Token::SUB; |
| 1189 } |
1187 Expression* expression() const { return expression_; } | 1190 Expression* expression() const { return expression_; } |
1188 | 1191 |
1189 virtual void MarkAsStatement() { is_prefix_ = true; } | 1192 virtual void MarkAsStatement() { is_prefix_ = true; } |
1190 | 1193 |
1191 private: | 1194 private: |
1192 bool is_prefix_; | 1195 bool is_prefix_; |
1193 Token::Value op_; | 1196 Token::Value op_; |
1194 Expression* expression_; | 1197 Expression* expression_; |
1195 }; | 1198 }; |
1196 | 1199 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 #undef DEF_VISIT | 1811 #undef DEF_VISIT |
1809 | 1812 |
1810 private: | 1813 private: |
1811 bool stack_overflow_; | 1814 bool stack_overflow_; |
1812 }; | 1815 }; |
1813 | 1816 |
1814 | 1817 |
1815 } } // namespace v8::internal | 1818 } } // namespace v8::internal |
1816 | 1819 |
1817 #endif // V8_AST_H_ | 1820 #endif // V8_AST_H_ |
OLD | NEW |