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

Unified Diff: src/ast.h

Issue 1290013002: [es6] Make assignment to new.target an early ReferenceError (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add a few more tests Created 5 years, 4 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/parser.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 f7f713afa6cab5e1bc16a2fc917145b7449d6193..e5e32617deadc5bc2bd13b396a425d4a5fa7dc64 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1639,7 +1639,9 @@ class VariableProxy final : public Expression {
public:
DECLARE_NODE_TYPE(VariableProxy)
- bool IsValidReferenceExpression() const override { return !is_this(); }
+ bool IsValidReferenceExpression() const override {
+ return !is_this() && !is_new_target();
+ }
bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
@@ -1670,6 +1672,11 @@ class VariableProxy final : public Expression {
bit_field_ = IsResolvedField::update(bit_field_, true);
}
+ bool is_new_target() const { return IsNewTargetField::decode(bit_field_); }
+ void set_is_new_target() {
+ bit_field_ = IsNewTargetField::update(bit_field_, true);
+ }
+
int end_position() const { return end_position_; }
// Bind this proxy to the variable var.
@@ -1705,6 +1712,7 @@ class VariableProxy final : public Expression {
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.
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698