| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_AST_AST_H_ | 5 #ifndef V8_AST_AST_H_ |
| 6 #define V8_AST_AST_H_ | 6 #define V8_AST_AST_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast-types.h" | 8 #include "src/ast/ast-types.h" |
| 9 #include "src/ast/ast-value-factory.h" | 9 #include "src/ast/ast-value-factory.h" |
| 10 #include "src/ast/modules.h" | 10 #include "src/ast/modules.h" |
| (...skipping 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1627 void set_var(Variable* v) { | 1627 void set_var(Variable* v) { |
| 1628 DCHECK(!is_resolved()); | 1628 DCHECK(!is_resolved()); |
| 1629 DCHECK_NOT_NULL(v); | 1629 DCHECK_NOT_NULL(v); |
| 1630 var_ = v; | 1630 var_ = v; |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 bool is_this() const { return IsThisField::decode(bit_field_); } | 1633 bool is_this() const { return IsThisField::decode(bit_field_); } |
| 1634 | 1634 |
| 1635 bool is_assigned() const { return IsAssignedField::decode(bit_field_); } | 1635 bool is_assigned() const { return IsAssignedField::decode(bit_field_); } |
| 1636 void set_is_assigned() { | 1636 void set_is_assigned() { |
| 1637 DCHECK(!is_resolved()); | |
| 1638 bit_field_ = IsAssignedField::update(bit_field_, true); | 1637 bit_field_ = IsAssignedField::update(bit_field_, true); |
| 1638 if (is_resolved()) { |
| 1639 var()->set_maybe_assigned(); |
| 1640 } |
| 1639 } | 1641 } |
| 1640 | 1642 |
| 1641 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } | 1643 bool is_resolved() const { return IsResolvedField::decode(bit_field_); } |
| 1642 void set_is_resolved() { | 1644 void set_is_resolved() { |
| 1643 bit_field_ = IsResolvedField::update(bit_field_, true); | 1645 bit_field_ = IsResolvedField::update(bit_field_, true); |
| 1644 } | 1646 } |
| 1645 | 1647 |
| 1646 bool is_new_target() const { return IsNewTargetField::decode(bit_field_); } | 1648 bool is_new_target() const { return IsNewTargetField::decode(bit_field_); } |
| 1647 void set_is_new_target() { | 1649 void set_is_new_target() { |
| 1648 bit_field_ = IsNewTargetField::update(bit_field_, true); | 1650 bit_field_ = IsNewTargetField::update(bit_field_, true); |
| (...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3448 RewritableExpression* NewRewritableExpression(Expression* expression) { | 3450 RewritableExpression* NewRewritableExpression(Expression* expression) { |
| 3449 DCHECK_NOT_NULL(expression); | 3451 DCHECK_NOT_NULL(expression); |
| 3450 return new (zone_) RewritableExpression(expression); | 3452 return new (zone_) RewritableExpression(expression); |
| 3451 } | 3453 } |
| 3452 | 3454 |
| 3453 Assignment* NewAssignment(Token::Value op, | 3455 Assignment* NewAssignment(Token::Value op, |
| 3454 Expression* target, | 3456 Expression* target, |
| 3455 Expression* value, | 3457 Expression* value, |
| 3456 int pos) { | 3458 int pos) { |
| 3457 DCHECK(Token::IsAssignmentOp(op)); | 3459 DCHECK(Token::IsAssignmentOp(op)); |
| 3460 |
| 3461 if (op != Token::INIT && target->IsVariableProxy()) { |
| 3462 target->AsVariableProxy()->set_is_assigned(); |
| 3463 } |
| 3464 |
| 3458 Assignment* assign = new (zone_) Assignment(op, target, value, pos); | 3465 Assignment* assign = new (zone_) Assignment(op, target, value, pos); |
| 3459 if (assign->is_compound()) { | 3466 if (assign->is_compound()) { |
| 3460 DCHECK(Token::IsAssignmentOp(op)); | |
| 3461 assign->binary_operation_ = | 3467 assign->binary_operation_ = |
| 3462 NewBinaryOperation(assign->binary_op(), target, value, pos + 1); | 3468 NewBinaryOperation(assign->binary_op(), target, value, pos + 1); |
| 3463 } | 3469 } |
| 3464 return assign; | 3470 return assign; |
| 3465 } | 3471 } |
| 3466 | 3472 |
| 3467 Yield* NewYield(Expression* generator_object, Expression* expression, int pos, | 3473 Yield* NewYield(Expression* generator_object, Expression* expression, int pos, |
| 3468 Yield::OnException on_exception) { | 3474 Yield::OnException on_exception) { |
| 3469 if (!expression) expression = NewUndefinedLiteral(pos); | 3475 if (!expression) expression = NewUndefinedLiteral(pos); |
| 3470 return new (zone_) Yield(generator_object, expression, pos, on_exception); | 3476 return new (zone_) Yield(generator_object, expression, pos, on_exception); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3628 : NULL; \ | 3634 : NULL; \ |
| 3629 } | 3635 } |
| 3630 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) | 3636 AST_NODE_LIST(DECLARE_NODE_FUNCTIONS) |
| 3631 #undef DECLARE_NODE_FUNCTIONS | 3637 #undef DECLARE_NODE_FUNCTIONS |
| 3632 | 3638 |
| 3633 | 3639 |
| 3634 } // namespace internal | 3640 } // namespace internal |
| 3635 } // namespace v8 | 3641 } // namespace v8 |
| 3636 | 3642 |
| 3637 #endif // V8_AST_AST_H_ | 3643 #endif // V8_AST_AST_H_ |
| OLD | NEW |