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

Unified 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: Rebased against master, plus fixes. Only 4 tests failing (+2 in TurboFan) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index 9b86d0b51292f6291b734962af0f8912e8218f4d..fbc89d54c3ccc45f53484330bedf93e6564bab81 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1599,7 +1599,7 @@ class VariableProxy FINAL : public Expression {
DECLARE_NODE_TYPE(VariableProxy)
bool IsValidReferenceExpression() const OVERRIDE {
- return !is_resolved() || var()->IsValidReference();
+ return !is_this() && !is_new_target();
}
bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
@@ -1621,6 +1621,8 @@ class VariableProxy FINAL : public Expression {
bool is_this() const { return IsThisField::decode(bit_field_); }
+ bool is_new_target() const { return IsNewTargetField::decode(bit_field_); }
+
bool is_assigned() const { return IsAssignedField::decode(bit_field_); }
void set_is_assigned() {
bit_field_ = IsAssignedField::update(bit_field_, true);
@@ -1655,12 +1657,13 @@ class VariableProxy FINAL : public Expression {
protected:
VariableProxy(Zone* zone, Variable* var, int position);
- VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
- int position);
+ VariableProxy(Zone* zone, const AstRawString* name,
+ Variable::Kind variable_kind, int position);
class IsThisField : public BitField8<bool, 0, 1> {};
class IsAssignedField : public BitField8<bool, 1, 1> {};
class IsResolvedField : public BitField8<bool, 2, 1> {};
+ class IsNewTargetField : public BitField8<bool, 3, 1> {};
// Start with 16-bit (or smaller) field, which should get packed together
// with Expression's trailing 16-bit field.
@@ -3358,9 +3361,9 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
}
VariableProxy* NewVariableProxy(const AstRawString* name,
- bool is_this,
+ Variable::Kind variable_kind,
int position = RelocInfo::kNoPosition) {
- return new (zone_) VariableProxy(zone_, name, is_this, position);
+ return new (zone_) VariableProxy(zone_, name, variable_kind, position);
}
Property* NewProperty(Expression* obj, Expression* key, int pos) {
« 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