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

Unified Diff: src/scopes.h

Issue 653603002: Try to fix cross-script global scope (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 2 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/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698