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

Side by Side Diff: src/ast.h

Issue 883823002: Implement proper scoping for "this" in arrow functions Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Make sure an unresolved VariableProxy for "this" is not considered a valid LHS Created 5 years, 10 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
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 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 Handle<FixedArray> constant_elements_; 1623 Handle<FixedArray> constant_elements_;
1624 ZoneList<Expression*>* values_; 1624 ZoneList<Expression*>* values_;
1625 }; 1625 };
1626 1626
1627 1627
1628 class VariableProxy FINAL : public Expression { 1628 class VariableProxy FINAL : public Expression {
1629 public: 1629 public:
1630 DECLARE_NODE_TYPE(VariableProxy) 1630 DECLARE_NODE_TYPE(VariableProxy)
1631 1631
1632 bool IsValidReferenceExpression() const OVERRIDE { 1632 bool IsValidReferenceExpression() const OVERRIDE {
1633 return !is_resolved() || var()->IsValidReference(); 1633 return !is_this() && (!is_resolved() || var()->IsValidReference());
wingo 2015/02/04 10:02:13 So it used to be that we would eagerly resolve "th
aperez 2015/02/04 21:00:42 Acknowledged. Also, I am going to write it as:
1634 } 1634 }
1635 1635
1636 bool IsArguments() const { return is_resolved() && var()->is_arguments(); } 1636 bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
1637 1637
1638 Handle<String> name() const { return raw_name()->string(); } 1638 Handle<String> name() const { return raw_name()->string(); }
1639 const AstRawString* raw_name() const { 1639 const AstRawString* raw_name() const {
1640 return is_resolved() ? var_->raw_name() : raw_name_; 1640 return is_resolved() ? var_->raw_name() : raw_name_;
1641 } 1641 }
1642 1642
1643 Variable* var() const { 1643 Variable* var() const {
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
3537 3537
3538 private: 3538 private:
3539 Zone* zone_; 3539 Zone* zone_;
3540 AstValueFactory* ast_value_factory_; 3540 AstValueFactory* ast_value_factory_;
3541 }; 3541 };
3542 3542
3543 3543
3544 } } // namespace v8::internal 3544 } } // namespace v8::internal
3545 3545
3546 #endif // V8_AST_H_ 3546 #endif // V8_AST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698