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

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: mjsunit/debug-scopes: Skip "this" the same as "arguments" 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 | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ast.cc » ('j') | src/parser.cc » ('J')
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 02f7df64b0d62bbaa9c1eb717ce1db6f8d4939b5..09649a182adea2ebf4b41d5bd61aec47466de4eb 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1635,7 +1635,7 @@ class VariableProxy FINAL : public Expression {
DECLARE_NODE_TYPE(VariableProxy)
bool IsValidReferenceExpression() const OVERRIDE {
- return !is_resolved() || var()->IsValidReference();
+ return !is_this();
}
bool IsArguments() const { return is_resolved() && var()->is_arguments(); }
@@ -1693,8 +1693,11 @@ class VariableProxy FINAL : public Expression {
protected:
VariableProxy(Zone* zone, Variable* var, int position);
- VariableProxy(Zone* zone, const AstRawString* name, bool is_this,
- Interface* interface, int position);
+ VariableProxy(Zone* zone,
+ const AstRawString* name,
+ Variable::Kind variable_kind,
+ Interface* interface,
+ int position);
class IsThisField : public BitField8<bool, 0, 1> {};
class IsAssignedField : public BitField8<bool, 1, 1> {};
@@ -3415,10 +3418,13 @@ class AstNodeFactory FINAL BASE_EMBEDDED {
}
VariableProxy* NewVariableProxy(const AstRawString* name,
- bool is_this,
Interface* interface = Interface::NewValue(),
int position = RelocInfo::kNoPosition) {
- return new (zone_) VariableProxy(zone_, name, is_this, interface, position);
+ return new (zone_) VariableProxy(zone_, name,
+ (name == ast_value_factory_->this_string())
wingo 2015/02/06 17:31:19 Can we instead change from "bool is_this," to "Var
aperez 2015/02/09 16:08:14 Acknowledged.
+ ? Variable::THIS
+ : Variable::NORMAL,
+ interface, position);
}
Property* NewProperty(Expression* obj, Expression* key, int pos) {
« no previous file with comments | « src/arm64/lithium-codegen-arm64.cc ('k') | src/ast.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698