Index: src/scopes.h |
diff --git a/src/scopes.h b/src/scopes.h |
index 7b372d9643fe4c1c07892139c6ecf1937ed1257e..c869e8010148298dfe3b83f5325fb49d8e209321 100644 |
--- a/src/scopes.h |
+++ b/src/scopes.h |
@@ -143,13 +143,14 @@ class Scope: public ZoneObject { |
VariableProxy* NewUnresolved(AstNodeFactory* factory, |
const AstRawString* name, |
int start_position = RelocInfo::kNoPosition, |
- int end_position = RelocInfo::kNoPosition) { |
+ int end_position = RelocInfo::kNoPosition, |
+ Variable::Kind kind = Variable::NORMAL) { |
// Note that we must not share the unresolved variables with |
// the same name because they may be removed selectively via |
// RemoveUnresolved(). |
DCHECK(!already_resolved()); |
- VariableProxy* proxy = factory->NewVariableProxy( |
- name, Variable::NORMAL, start_position, end_position); |
+ VariableProxy* proxy = |
+ factory->NewVariableProxy(name, kind, start_position, end_position); |
unresolved_.Add(proxy, zone_); |
return proxy; |
} |
@@ -344,7 +345,18 @@ class Scope: public ZoneObject { |
LanguageMode language_mode() const { return language_mode_; } |
// The variable corresponding to the 'this' value. |
- Variable* receiver() { return receiver_; } |
+ Variable* receiver() { |
+ CHECK(has_this_declaration()); |
+ CHECK_NOT_NULL(receiver_); |
adamk
2015/04/22 15:50:54
These should probably be DCHECKs.
wingo
2015/04/23 14:16:02
Done.
|
+ return receiver_; |
+ } |
+ |
+ Variable* LookupThis() { return Lookup(ast_value_factory_->this_string()); } |
+ |
+ bool has_this_declaration() const { |
+ return (is_function_scope() && !is_arrow_scope()) || is_module_scope() || |
+ is_script_scope(); |
+ } |
// The variable corresponding to the 'new.target' value. |
Variable* new_target_var() { return new_target_; } |
@@ -695,6 +707,8 @@ class Scope: public ZoneObject { |
void AllocateNonParameterLocal(Isolate* isolate, Variable* var); |
void AllocateNonParameterLocals(Isolate* isolate); |
void AllocateVariablesRecursively(Isolate* isolate); |
+ void AllocateParameter(Variable* var, int index); |
+ void AllocateReceiver(); |
void AllocateModules(); |
// Resolve and fill in the allocation information for all variables |