OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 }; | 1362 }; |
1363 | 1363 |
1364 | 1364 |
1365 class BinaryOperation: public Expression { | 1365 class BinaryOperation: public Expression { |
1366 public: | 1366 public: |
1367 BinaryOperation(Token::Value op, Expression* left, Expression* right) | 1367 BinaryOperation(Token::Value op, Expression* left, Expression* right) |
1368 : op_(op), left_(left), right_(right) { | 1368 : op_(op), left_(left), right_(right) { |
1369 ASSERT(Token::IsBinaryOp(op)); | 1369 ASSERT(Token::IsBinaryOp(op)); |
1370 } | 1370 } |
1371 | 1371 |
1372 BinaryOperation(BinaryOperation* other, Expression* left, Expression* right); | 1372 // Construct a binary operation with a given operator and left and right |
| 1373 // subexpressions. The rest of the expression state is copied from |
| 1374 // another expression. |
| 1375 BinaryOperation(Expression* other, |
| 1376 Token::Value op, |
| 1377 Expression* left, |
| 1378 Expression* right); |
1373 | 1379 |
1374 virtual void Accept(AstVisitor* v); | 1380 virtual void Accept(AstVisitor* v); |
1375 | 1381 |
1376 // Type testing & conversion | 1382 // Type testing & conversion |
1377 virtual BinaryOperation* AsBinaryOperation() { return this; } | 1383 virtual BinaryOperation* AsBinaryOperation() { return this; } |
1378 | 1384 |
1379 virtual bool IsPrimitive(); | 1385 virtual bool IsPrimitive(); |
1380 virtual bool IsCritical(); | 1386 virtual bool IsCritical(); |
1381 | 1387 |
1382 // True iff the result can be safely overwritten (to avoid allocation). | 1388 // True iff the result can be safely overwritten (to avoid allocation). |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 | 2118 |
2113 // Holds the result of copying an expression. | 2119 // Holds the result of copying an expression. |
2114 Expression* expr_; | 2120 Expression* expr_; |
2115 // Holds the result of copying a statement. | 2121 // Holds the result of copying a statement. |
2116 Statement* stmt_; | 2122 Statement* stmt_; |
2117 }; | 2123 }; |
2118 | 2124 |
2119 } } // namespace v8::internal | 2125 } } // namespace v8::internal |
2120 | 2126 |
2121 #endif // V8_AST_H_ | 2127 #endif // V8_AST_H_ |
OLD | NEW |