| Index: src/variables.h
|
| diff --git a/src/variables.h b/src/variables.h
|
| index 0cb50c87e985580c1fd1c7fc5ea9b3fde63f4206..218eefae08e08a0cd937a14e1d158c5b878d1a0c 100644
|
| --- a/src/variables.h
|
| +++ b/src/variables.h
|
| @@ -105,6 +105,16 @@ class Variable: public ZoneObject {
|
| bool is_this() const { return kind_ == THIS; }
|
| bool is_arguments() const { return kind_ == ARGUMENTS; }
|
|
|
| + // For script scopes, the "this" binding is provided by a ScriptContext added
|
| + // to the global's ScriptContextTable. This binding might not statically
|
| + // resolve to a Variable::THIS binding, instead being DYNAMIC_LOCAL. However
|
| + // any variable named "this" does indeed refer to a Variable::THIS binding;
|
| + // the grammar ensures this to be the case. So wherever a "this" binding
|
| + // might be provided by the global, use HasThisName instead of is_this().
|
| + bool HasThisName(Isolate* isolate) const {
|
| + return is_this() || *name() == *isolate->factory()->this_string();
|
| + }
|
| +
|
| ClassVariable* AsClassVariable() {
|
| DCHECK(is_class());
|
| return reinterpret_cast<ClassVariable*>(this);
|
|
|