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