| Index: src/scopes.h
|
| diff --git a/src/scopes.h b/src/scopes.h
|
| index f41a088da331eef5a7c9962693fd92b8806d4cc3..ccb231bb30cacfc812fb54cfdfc687befacfd848 100644
|
| --- a/src/scopes.h
|
| +++ b/src/scopes.h
|
| @@ -143,14 +143,16 @@ class Scope: public ZoneObject {
|
| Variable* DeclareDynamicGlobal(const AstRawString* name);
|
|
|
| // Create a new unresolved variable.
|
| + // Note that we must not share the unresolved variables with the same name
|
| + // because they may be removed selectively via RemoveUnresolved().
|
| template<class Visitor>
|
| VariableProxy* NewUnresolved(AstNodeFactory<Visitor>* factory,
|
| const AstRawString* name,
|
| Interface* interface = Interface::NewValue(),
|
| int position = RelocInfo::kNoPosition) {
|
| - // Note that we must not share the unresolved variables with
|
| - // the same name because they may be removed selectively via
|
| - // RemoveUnresolved().
|
| + if (is_global_scope() && outer_scope_ && outer_scope_->is_global_scope()) {
|
| + return outer_scope_->NewUnresolved(factory, name, interface, position);
|
| + }
|
| ASSERT(!already_resolved());
|
| VariableProxy* proxy =
|
| factory->NewVariableProxy(name, false, interface, position);
|
| @@ -267,9 +269,10 @@ class Scope: public ZoneObject {
|
| bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; }
|
| bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
|
| bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
|
| + bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; }
|
| bool is_declaration_scope() const {
|
| - return is_eval_scope() || is_function_scope() ||
|
| - is_module_scope() || is_global_scope();
|
| + return is_eval_scope() || is_function_scope() || is_module_scope() ||
|
| + (is_global_scope() && outer_scope() == NULL);
|
| }
|
| bool is_strict_eval_scope() const {
|
| return is_eval_scope() && strict_mode_ == STRICT;
|
|
|