| 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 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1099 private: | 1099 private: |
| 1100 Expression* condition_; | 1100 Expression* condition_; |
| 1101 Expression* then_expression_; | 1101 Expression* then_expression_; |
| 1102 Expression* else_expression_; | 1102 Expression* else_expression_; |
| 1103 }; | 1103 }; |
| 1104 | 1104 |
| 1105 | 1105 |
| 1106 class Assignment: public Expression { | 1106 class Assignment: public Expression { |
| 1107 public: | 1107 public: |
| 1108 Assignment(Token::Value op, Expression* target, Expression* value, int pos) | 1108 Assignment(Token::Value op, Expression* target, Expression* value, int pos) |
| 1109 : op_(op), target_(target), value_(value), pos_(pos) { | 1109 : op_(op), target_(target), value_(value), pos_(pos), |
| 1110 block_start_(false), block_end_(false) { |
| 1110 ASSERT(Token::IsAssignmentOp(op)); | 1111 ASSERT(Token::IsAssignmentOp(op)); |
| 1111 } | 1112 } |
| 1112 | 1113 |
| 1113 virtual void Accept(AstVisitor* v); | 1114 virtual void Accept(AstVisitor* v); |
| 1114 virtual Assignment* AsAssignment() { return this; } | 1115 virtual Assignment* AsAssignment() { return this; } |
| 1115 | 1116 |
| 1116 Token::Value binary_op() const; | 1117 Token::Value binary_op() const; |
| 1117 | 1118 |
| 1118 Token::Value op() const { return op_; } | 1119 Token::Value op() const { return op_; } |
| 1119 Expression* target() const { return target_; } | 1120 Expression* target() const { return target_; } |
| 1120 Expression* value() const { return value_; } | 1121 Expression* value() const { return value_; } |
| 1121 int position() { return pos_; } | 1122 int position() { return pos_; } |
| 1122 | 1123 |
| 1124 // An initialization block is a series of statments of the form |
| 1125 // x.y.z.a = ...; x.y.z.b = ...; etc. The parser marks the beginning and |
| 1126 // ending of these blocks to allow for optimizations of initialization |
| 1127 // blocks. |
| 1128 bool starts_initialization_block() { return block_start_; } |
| 1129 bool ends_initialization_block() { return block_end_; } |
| 1130 void mark_block_start() { block_start_ = true; } |
| 1131 void mark_block_end() { block_end_ = true; } |
| 1132 |
| 1123 private: | 1133 private: |
| 1124 Token::Value op_; | 1134 Token::Value op_; |
| 1125 Expression* target_; | 1135 Expression* target_; |
| 1126 Expression* value_; | 1136 Expression* value_; |
| 1127 int pos_; | 1137 int pos_; |
| 1138 bool block_start_; |
| 1139 bool block_end_; |
| 1128 }; | 1140 }; |
| 1129 | 1141 |
| 1130 | 1142 |
| 1131 class Throw: public Expression { | 1143 class Throw: public Expression { |
| 1132 public: | 1144 public: |
| 1133 Throw(Expression* exception, int pos) | 1145 Throw(Expression* exception, int pos) |
| 1134 : exception_(exception), pos_(pos) {} | 1146 : exception_(exception), pos_(pos) {} |
| 1135 | 1147 |
| 1136 virtual void Accept(AstVisitor* v); | 1148 virtual void Accept(AstVisitor* v); |
| 1137 Expression* exception() const { return exception_; } | 1149 Expression* exception() const { return exception_; } |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 #undef DEF_VISIT | 1636 #undef DEF_VISIT |
| 1625 | 1637 |
| 1626 private: | 1638 private: |
| 1627 bool stack_overflow_; | 1639 bool stack_overflow_; |
| 1628 }; | 1640 }; |
| 1629 | 1641 |
| 1630 | 1642 |
| 1631 } } // namespace v8::internal | 1643 } } // namespace v8::internal |
| 1632 | 1644 |
| 1633 #endif // V8_AST_H_ | 1645 #endif // V8_AST_H_ |
| OLD | NEW |