Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: src/ast.h

Issue 345573002: Infer whether a variable is assigned (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: A few more tests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/assembler.h" 10 #include "src/assembler.h"
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1624 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { 1624 virtual bool IsValidReferenceExpression() const V8_OVERRIDE {
1625 return var_ == NULL ? true : var_->IsValidReference(); 1625 return var_ == NULL ? true : var_->IsValidReference();
1626 } 1626 }
1627 1627
1628 bool IsVariable(Handle<String> n) const { 1628 bool IsVariable(Handle<String> n) const {
1629 return !is_this() && name().is_identical_to(n); 1629 return !is_this() && name().is_identical_to(n);
1630 } 1630 }
1631 1631
1632 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); } 1632 bool IsArguments() const { return var_ != NULL && var_->is_arguments(); }
1633 1633
1634 bool IsLValue() const { return is_lvalue_; }
1635
1636 Handle<String> name() const { return name_; } 1634 Handle<String> name() const { return name_; }
1637 Variable* var() const { return var_; } 1635 Variable* var() const { return var_; }
1638 bool is_this() const { return is_this_; } 1636 bool is_this() const { return is_this_; }
1639 Interface* interface() const { return interface_; } 1637 Interface* interface() const { return interface_; }
1640 1638
1641 1639 bool is_assigned() const { return is_assigned_; }
1642 void MarkAsTrivial() { is_trivial_ = true; } 1640 void set_is_assigned() { is_assigned_ = true; }
1643 void MarkAsLValue() { is_lvalue_ = true; }
1644 1641
1645 // Bind this proxy to the variable var. Interfaces must match. 1642 // Bind this proxy to the variable var. Interfaces must match.
1646 void BindTo(Variable* var); 1643 void BindTo(Variable* var);
1647 1644
1648 protected: 1645 protected:
1649 VariableProxy(Zone* zone, Variable* var, int position); 1646 VariableProxy(Zone* zone, Variable* var, int position);
1650 1647
1651 VariableProxy(Zone* zone, 1648 VariableProxy(Zone* zone,
1652 Handle<String> name, 1649 Handle<String> name,
1653 bool is_this, 1650 bool is_this,
1654 Interface* interface, 1651 Interface* interface,
1655 int position); 1652 int position);
1656 1653
1657 Handle<String> name_; 1654 Handle<String> name_;
1658 Variable* var_; // resolved variable, or NULL 1655 Variable* var_; // resolved variable, or NULL
1659 bool is_this_; 1656 bool is_this_;
1660 bool is_trivial_; 1657 bool is_assigned_;
1661 // True if this variable proxy is being used in an assignment
1662 // or with a increment/decrement operator.
1663 bool is_lvalue_;
1664 Interface* interface_; 1658 Interface* interface_;
1665 }; 1659 };
1666 1660
1667 1661
1668 class Property V8_FINAL : public Expression { 1662 class Property V8_FINAL : public Expression {
1669 public: 1663 public:
1670 DECLARE_NODE_TYPE(Property) 1664 DECLARE_NODE_TYPE(Property)
1671 1665
1672 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { return true; } 1666 virtual bool IsValidReferenceExpression() const V8_OVERRIDE { return true; }
1673 1667
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3352 3346
3353 private: 3347 private:
3354 Zone* zone_; 3348 Zone* zone_;
3355 Visitor visitor_; 3349 Visitor visitor_;
3356 }; 3350 };
3357 3351
3358 3352
3359 } } // namespace v8::internal 3353 } } // namespace v8::internal
3360 3354
3361 #endif // V8_AST_H_ 3355 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698