Remove unused DummyScope implementation.

R=lrn@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/7062020

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8092 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent add593da
...@@ -536,7 +536,6 @@ LexicalScope::LexicalScope(Parser* parser, Scope* scope, Isolate* isolate) ...@@ -536,7 +536,6 @@ LexicalScope::LexicalScope(Parser* parser, Scope* scope, Isolate* isolate)
LexicalScope::~LexicalScope() { LexicalScope::~LexicalScope() {
parser_->top_scope_->Leave();
parser_->top_scope_ = previous_scope_; parser_->top_scope_ = previous_scope_;
parser_->lexical_scope_ = lexical_scope_parent_; parser_->lexical_scope_ = lexical_scope_parent_;
parser_->with_nesting_level_ = previous_with_nesting_level_; parser_->with_nesting_level_ = previous_with_nesting_level_;
......
...@@ -97,8 +97,6 @@ class Scope: public ZoneObject { ...@@ -97,8 +97,6 @@ class Scope: public ZoneObject {
Scope(Scope* outer_scope, Type type); Scope(Scope* outer_scope, Type type);
virtual ~Scope() { }
// Compute top scope and allocate variables. For lazy compilation the top // Compute top scope and allocate variables. For lazy compilation the top
// scope only contains the single lazily compiled function, so this // scope only contains the single lazily compiled function, so this
// doesn't re-allocate variables repeatedly. // doesn't re-allocate variables repeatedly.
...@@ -110,22 +108,17 @@ class Scope: public ZoneObject { ...@@ -110,22 +108,17 @@ class Scope: public ZoneObject {
// The scope name is only used for printing/debugging. // The scope name is only used for printing/debugging.
void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; } void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; }
virtual void Initialize(bool inside_with); void Initialize(bool inside_with);
// Called just before leaving a scope.
virtual void Leave() {
// No cleanup or fixup necessary.
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Declarations // Declarations
// Lookup a variable in this scope. Returns the variable or NULL if not found. // Lookup a variable in this scope. Returns the variable or NULL if not found.
virtual Variable* LocalLookup(Handle<String> name); Variable* LocalLookup(Handle<String> name);
// Lookup a variable in this scope or outer scopes. // Lookup a variable in this scope or outer scopes.
// Returns the variable or NULL if not found. // Returns the variable or NULL if not found.
virtual Variable* Lookup(Handle<String> name); Variable* Lookup(Handle<String> name);
// Declare the function variable for a function literal. This variable // Declare the function variable for a function literal. This variable
// is in an intermediate scope between this function scope and the the // is in an intermediate scope between this function scope and the the
...@@ -148,7 +141,7 @@ class Scope: public ZoneObject { ...@@ -148,7 +141,7 @@ class Scope: public ZoneObject {
Variable* DeclareGlobal(Handle<String> name); Variable* DeclareGlobal(Handle<String> name);
// Create a new unresolved variable. // Create a new unresolved variable.
virtual VariableProxy* NewUnresolved(Handle<String> name, VariableProxy* NewUnresolved(Handle<String> name,
bool inside_with, bool inside_with,
int position = RelocInfo::kNoPosition); int position = RelocInfo::kNoPosition);
...@@ -164,7 +157,7 @@ class Scope: public ZoneObject { ...@@ -164,7 +157,7 @@ class Scope: public ZoneObject {
// for printing and cannot be used to find the variable. In particular, // for printing and cannot be used to find the variable. In particular,
// the only way to get hold of the temporary is by keeping the Variable* // the only way to get hold of the temporary is by keeping the Variable*
// around. // around.
virtual Variable* NewTemporary(Handle<String> name); Variable* NewTemporary(Handle<String> name);
// Adds the specific declaration node to the list of declarations in // Adds the specific declaration node to the list of declarations in
// this scope. The declarations are processed as part of entering // this scope. The declarations are processed as part of entering
...@@ -269,7 +262,6 @@ class Scope: public ZoneObject { ...@@ -269,7 +262,6 @@ class Scope: public ZoneObject {
ZoneList<Declaration*>* declarations() { return &decls_; } ZoneList<Declaration*>* declarations() { return &decls_; }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Variable allocation. // Variable allocation.
...@@ -301,7 +293,7 @@ class Scope: public ZoneObject { ...@@ -301,7 +293,7 @@ class Scope: public ZoneObject {
bool AllowsLazyCompilation() const; bool AllowsLazyCompilation() const;
// True if the outer context of this scope is always the global context. // True if the outer context of this scope is always the global context.
virtual bool HasTrivialOuterContext() const; bool HasTrivialOuterContext() const;
// The number of contexts between this and scope; zero if this == scope. // The number of contexts between this and scope; zero if this == scope.
int ContextChainLength(Scope* scope); int ContextChainLength(Scope* scope);
...@@ -441,59 +433,6 @@ class Scope: public ZoneObject { ...@@ -441,59 +433,6 @@ class Scope: public ZoneObject {
Handle<SerializedScopeInfo> scope_info); Handle<SerializedScopeInfo> scope_info);
}; };
// Scope used during pre-parsing.
class DummyScope : public Scope {
public:
DummyScope()
: Scope(GLOBAL_SCOPE),
nesting_level_(1), // Allows us to Leave the initial scope.
inside_with_level_(kNotInsideWith) {
outer_scope_ = this;
scope_inside_with_ = false;
}
virtual void Initialize(bool inside_with) {
nesting_level_++;
if (inside_with && inside_with_level_ == kNotInsideWith) {
inside_with_level_ = nesting_level_;
}
ASSERT(inside_with_level_ <= nesting_level_);
}
virtual void Leave() {
nesting_level_--;
ASSERT(nesting_level_ >= 0);
if (nesting_level_ < inside_with_level_) {
inside_with_level_ = kNotInsideWith;
}
ASSERT(inside_with_level_ <= nesting_level_);
}
virtual Variable* Lookup(Handle<String> name) { return NULL; }
virtual VariableProxy* NewUnresolved(Handle<String> name,
bool inside_with,
int position = RelocInfo::kNoPosition) {
return NULL;
}
virtual Variable* NewTemporary(Handle<String> name) { return NULL; }
virtual bool HasTrivialOuterContext() const {
return (nesting_level_ == 0 || inside_with_level_ <= 0);
}
private:
static const int kNotInsideWith = -1;
// Number of surrounding scopes of the current scope.
int nesting_level_;
// Nesting level of outermost scope that is contained in a with statement,
// or kNotInsideWith if there are no with's around the current scope.
int inside_with_level_;
};
} } // namespace v8::internal } } // namespace v8::internal
#endif // V8_SCOPES_H_ #endif // V8_SCOPES_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment