Index: src/scopes.h |
diff --git a/src/scopes.h b/src/scopes.h |
index faa6fd97efd95dc5ad859a7363d32c59acd8a180..b0fe4f5878c841ad1b826dd92f31e43a5b6b0bb7 100644 |
--- a/src/scopes.h |
+++ b/src/scopes.h |
@@ -1,4 +1,4 @@ |
-// Copyright 2010 the V8 project authors. All rights reserved. |
+// Copyright 2011 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -102,8 +102,6 @@ class Scope: public ZoneObject { |
Scope(Scope* outer_scope, Type type); |
- virtual ~Scope() { } |
- |
// Compute top scope and allocate variables. For lazy compilation the top |
// scope only contains the single lazily compiled function, so this |
// doesn't re-allocate variables repeatedly. |
@@ -115,22 +113,17 @@ class Scope: public ZoneObject { |
// The scope name is only used for printing/debugging. |
void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; } |
- virtual void Initialize(bool inside_with); |
- |
- // Called just before leaving a scope. |
- virtual void Leave() { |
- // No cleanup or fixup necessary. |
- } |
+ void Initialize(bool inside_with); |
// --------------------------------------------------------------------------- |
// Declarations |
// 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. |
// 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 |
// is in an intermediate scope between this function scope and the the |
@@ -139,9 +132,9 @@ class Scope: public ZoneObject { |
// Declare a local variable in this scope. If the variable has been |
// declared before, the previously declared variable is returned. |
- virtual Variable* DeclareLocal(Handle<String> name, |
- Variable::Mode mode, |
- LocalType type); |
+ Variable* DeclareLocal(Handle<String> name, |
+ Variable::Mode mode, |
+ LocalType type); |
// Declare an implicit global variable in this scope which must be a |
// global scope. The variable was introduced (possibly from an inner |
@@ -156,9 +149,9 @@ class Scope: public ZoneObject { |
void AddParameter(Variable* var); |
// Create a new unresolved variable. |
- virtual VariableProxy* NewUnresolved(Handle<String> name, |
- bool inside_with, |
- int position = RelocInfo::kNoPosition); |
+ VariableProxy* NewUnresolved(Handle<String> name, |
+ bool inside_with, |
+ int position = RelocInfo::kNoPosition); |
// Remove a unresolved variable. During parsing, an unresolved variable |
// may have been added optimistically, but then only the variable name |
@@ -172,7 +165,7 @@ class Scope: public ZoneObject { |
// 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* |
// around. |
- virtual Variable* NewTemporary(Handle<String> name); |
+ Variable* NewTemporary(Handle<String> name); |
// Adds the specific declaration node to the list of declarations in |
// this scope. The declarations are processed as part of entering |
@@ -277,7 +270,6 @@ class Scope: public ZoneObject { |
ZoneList<Declaration*>* declarations() { return &decls_; } |
- |
// --------------------------------------------------------------------------- |
// Variable allocation. |
@@ -309,7 +301,7 @@ class Scope: public ZoneObject { |
bool AllowsLazyCompilation() const; |
// 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. |
int ContextChainLength(Scope* scope); |
@@ -449,59 +441,6 @@ class Scope: public ZoneObject { |
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 |
#endif // V8_SCOPES_H_ |