// Dummy constructor
-Scope::Scope()
- : inner_scopes_(0),
+Scope::Scope(Type type)
+ : outer_scope_(NULL),
+ inner_scopes_(0),
+ type_(type),
+ scope_name_(Factory::empty_symbol()),
variables_(false),
temps_(0),
params_(0),
dynamics_(NULL),
unresolved_(0),
- decls_(0) {
+ decls_(0),
+ receiver_(NULL),
+ function_(NULL),
+ arguments_(NULL),
+ arguments_shadow_(NULL),
+ illegal_redecl_(NULL),
+ scope_inside_with_(false),
+ scope_contains_with_(false),
+ scope_calls_eval_(false),
+ outer_scope_calls_eval_(false),
+ inner_scope_calls_eval_(false),
+ outer_scope_is_eval_scope_(false),
+ force_eager_compilation_(false),
+ num_stack_slots_(0),
+ num_heap_slots_(0) {
}
GLOBAL_SCOPE // the top-level scope for a program or a top-level eval
};
- Scope();
Scope(Scope* outer_scope, Type type);
virtual ~Scope() { }
Variable* DeclareGlobal(Handle<String> name);
// Add a parameter to the parameter list. The parameter must have been
- // declared via Declare. The same parameter may occur more then once in
+ // declared via Declare. The same parameter may occur more than once in
// the parameter list; they must be added in source order, from left to
// right.
void AddParameter(Variable* var);
protected:
friend class ParserFactory;
+ explicit Scope(Type type);
+
// Scope tree.
Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
class DummyScope : public Scope {
public:
- DummyScope() {
+ DummyScope() : Scope(GLOBAL_SCOPE) {
outer_scope_ = this;
}