blob: 2917a63bba553a3a141acae6875ab83279c0f176 [file] [log] [blame]
Ben Murdoch3fb3ca82011-12-02 17:19:32 +00001// Copyright 2011 the V8 project authors. All rights reserved.
Steve Blocka7e24c12009-10-30 11:49:00 +00002// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28#ifndef V8_SCOPES_H_
29#define V8_SCOPES_H_
30
31#include "ast.h"
32#include "hashmap.h"
33
34namespace v8 {
35namespace internal {
36
Ben Murdochf87a2032010-10-22 12:50:53 +010037class CompilationInfo;
38
Steve Blocka7e24c12009-10-30 11:49:00 +000039
40// A hash map to support fast variable declaration and lookup.
41class VariableMap: public HashMap {
42 public:
43 VariableMap();
44
45 // Dummy constructor. This constructor doesn't set up the map
46 // properly so don't use it unless you have a good reason.
47 explicit VariableMap(bool gotta_love_static_overloading);
48
49 virtual ~VariableMap();
50
51 Variable* Declare(Scope* scope,
52 Handle<String> name,
53 Variable::Mode mode,
54 bool is_valid_lhs,
55 Variable::Kind kind);
56
57 Variable* Lookup(Handle<String> name);
58};
59
60
61// The dynamic scope part holds hash maps for the variables that will
62// be looked up dynamically from within eval and with scopes. The objects
63// are allocated on-demand from Scope::NonLocal to avoid wasting memory
64// and setup time for scopes that don't need them.
65class DynamicScopePart : public ZoneObject {
66 public:
67 VariableMap* GetMap(Variable::Mode mode) {
68 int index = mode - Variable::DYNAMIC;
69 ASSERT(index >= 0 && index < 3);
70 return &maps_[index];
71 }
72
73 private:
74 VariableMap maps_[3];
75};
76
77
78// Global invariants after AST construction: Each reference (i.e. identifier)
79// to a JavaScript variable (including global properties) is represented by a
80// VariableProxy node. Immediately after AST construction and before variable
81// allocation, most VariableProxy nodes are "unresolved", i.e. not bound to a
82// corresponding variable (though some are bound during parse time). Variable
83// allocation binds each unresolved VariableProxy to one Variable and assigns
84// a location. Note that many VariableProxy nodes may refer to the same Java-
85// Script variable.
86
87class Scope: public ZoneObject {
88 public:
89 // ---------------------------------------------------------------------------
90 // Construction
91
92 enum Type {
Ben Murdoch3fb3ca82011-12-02 17:19:32 +000093 EVAL_SCOPE, // The top-level scope for an eval source.
94 FUNCTION_SCOPE, // The top-level scope for a function.
95 GLOBAL_SCOPE, // The top-level scope for a program or a top-level eval.
Ben Murdoch69a99ed2011-11-30 16:03:39 +000096 CATCH_SCOPE, // The scope introduced by catch.
97 BLOCK_SCOPE // The scope introduced by a new block.
Steve Block053d10c2011-06-13 19:13:29 +010098 };
99
Steve Blocka7e24c12009-10-30 11:49:00 +0000100 Scope(Scope* outer_scope, Type type);
101
Ben Murdochf87a2032010-10-22 12:50:53 +0100102 // Compute top scope and allocate variables. For lazy compilation the top
103 // scope only contains the single lazily compiled function, so this
104 // doesn't re-allocate variables repeatedly.
105 static bool Analyze(CompilationInfo* info);
106
Steve Block44f0eee2011-05-26 01:26:41 +0100107 static Scope* DeserializeScopeChain(CompilationInfo* info,
108 Scope* innermost_scope);
109
Steve Blocka7e24c12009-10-30 11:49:00 +0000110 // The scope name is only used for printing/debugging.
Ben Murdochb0fe1622011-05-05 13:52:32 +0100111 void SetScopeName(Handle<String> scope_name) { scope_name_ = scope_name; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000112
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000113 void Initialize(bool inside_with);
Steve Blocka7e24c12009-10-30 11:49:00 +0000114
Ben Murdoch589d6972011-11-30 16:04:58 +0000115 // Checks if the block scope is redundant, i.e. it does not contain any
116 // block scoped declarations. In that case it is removed from the scope
117 // tree and its children are reparented.
118 Scope* FinalizeBlockScope();
119
Steve Blocka7e24c12009-10-30 11:49:00 +0000120 // ---------------------------------------------------------------------------
121 // Declarations
122
123 // Lookup a variable in this scope. Returns the variable or NULL if not found.
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000124 Variable* LocalLookup(Handle<String> name);
Steve Blocka7e24c12009-10-30 11:49:00 +0000125
126 // Lookup a variable in this scope or outer scopes.
127 // Returns the variable or NULL if not found.
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000128 Variable* Lookup(Handle<String> name);
Steve Blocka7e24c12009-10-30 11:49:00 +0000129
130 // Declare the function variable for a function literal. This variable
131 // is in an intermediate scope between this function scope and the the
132 // outer scope. Only possible for function scopes; at most one variable.
133 Variable* DeclareFunctionVar(Handle<String> name);
134
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000135 // Declare a parameter in this scope. When there are duplicated
136 // parameters the rightmost one 'wins'. However, the implementation
137 // expects all parameters to be declared and from left to right.
Ben Murdoch589d6972011-11-30 16:04:58 +0000138 void DeclareParameter(Handle<String> name, Variable::Mode mode);
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000139
Steve Blocka7e24c12009-10-30 11:49:00 +0000140 // Declare a local variable in this scope. If the variable has been
141 // declared before, the previously declared variable is returned.
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000142 Variable* DeclareLocal(Handle<String> name, Variable::Mode mode);
Steve Blocka7e24c12009-10-30 11:49:00 +0000143
144 // Declare an implicit global variable in this scope which must be a
145 // global scope. The variable was introduced (possibly from an inner
146 // scope) by a reference to an unresolved variable with no intervening
147 // with statements or eval calls.
148 Variable* DeclareGlobal(Handle<String> name);
149
Steve Blocka7e24c12009-10-30 11:49:00 +0000150 // Create a new unresolved variable.
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000151 VariableProxy* NewUnresolved(Handle<String> name,
152 bool inside_with,
153 int position = RelocInfo::kNoPosition);
Steve Blocka7e24c12009-10-30 11:49:00 +0000154
155 // Remove a unresolved variable. During parsing, an unresolved variable
156 // may have been added optimistically, but then only the variable name
157 // was used (typically for labels). If the variable was not declared, the
158 // addition introduced a new unresolved variable which may end up being
159 // allocated globally as a "ghost" variable. RemoveUnresolved removes
160 // such a variable again if it was added; otherwise this is a no-op.
161 void RemoveUnresolved(VariableProxy* var);
162
Ben Murdochb0fe1622011-05-05 13:52:32 +0100163 // Creates a new temporary variable in this scope. The name is only used
164 // for printing and cannot be used to find the variable. In particular,
165 // the only way to get hold of the temporary is by keeping the Variable*
166 // around.
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000167 Variable* NewTemporary(Handle<String> name);
Steve Blocka7e24c12009-10-30 11:49:00 +0000168
169 // Adds the specific declaration node to the list of declarations in
170 // this scope. The declarations are processed as part of entering
171 // the scope; see codegen.cc:ProcessDeclarations.
172 void AddDeclaration(Declaration* declaration);
173
174 // ---------------------------------------------------------------------------
175 // Illegal redeclaration support.
176
177 // Set an expression node that will be executed when the scope is
178 // entered. We only keep track of one illegal redeclaration node per
179 // scope - the first one - so if you try to set it multiple times
180 // the additional requests will be silently ignored.
181 void SetIllegalRedeclaration(Expression* expression);
182
183 // Visit the illegal redeclaration expression. Do not call if the
184 // scope doesn't have an illegal redeclaration node.
185 void VisitIllegalRedeclaration(AstVisitor* visitor);
186
187 // Check if the scope has (at least) one illegal redeclaration.
188 bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; }
189
Ben Murdoch589d6972011-11-30 16:04:58 +0000190 // For harmony block scoping mode: Check if the scope has conflicting var
191 // declarations, i.e. a var declaration that has been hoisted from a nested
192 // scope over a let binding of the same name.
193 Declaration* CheckConflictingVarDeclarations();
Steve Blocka7e24c12009-10-30 11:49:00 +0000194
195 // ---------------------------------------------------------------------------
196 // Scope-specific info.
197
198 // Inform the scope that the corresponding code contains a with statement.
Ben Murdochb0fe1622011-05-05 13:52:32 +0100199 void RecordWithStatement() { scope_contains_with_ = true; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000200
201 // Inform the scope that the corresponding code contains an eval call.
Ben Murdochb0fe1622011-05-05 13:52:32 +0100202 void RecordEvalCall() { scope_calls_eval_ = true; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000203
Steve Block44f0eee2011-05-26 01:26:41 +0100204 // Enable strict mode for the scope (unless disabled by a global flag).
205 void EnableStrictMode() {
206 strict_mode_ = FLAG_strict_mode;
207 }
Steve Blocka7e24c12009-10-30 11:49:00 +0000208
209 // ---------------------------------------------------------------------------
210 // Predicates.
211
212 // Specific scope types.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100213 bool is_eval_scope() const { return type_ == EVAL_SCOPE; }
214 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; }
215 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; }
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000216 bool is_catch_scope() const { return type_ == CATCH_SCOPE; }
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000217 bool is_block_scope() const { return type_ == BLOCK_SCOPE; }
Steve Block44f0eee2011-05-26 01:26:41 +0100218 bool is_strict_mode() const { return strict_mode_; }
Ben Murdoch257744e2011-11-30 15:57:28 +0000219 bool is_strict_mode_eval_scope() const {
220 return is_eval_scope() && is_strict_mode();
221 }
Steve Blocka7e24c12009-10-30 11:49:00 +0000222
223 // Information about which scopes calls eval.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100224 bool calls_eval() const { return scope_calls_eval_; }
225 bool outer_scope_calls_eval() const { return outer_scope_calls_eval_; }
Ben Murdoch257744e2011-11-30 15:57:28 +0000226 bool outer_scope_calls_non_strict_eval() const {
227 return outer_scope_calls_non_strict_eval_;
228 }
Steve Blocka7e24c12009-10-30 11:49:00 +0000229
230 // Is this scope inside a with statement.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100231 bool inside_with() const { return scope_inside_with_; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000232 // Does this scope contain a with statement.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100233 bool contains_with() const { return scope_contains_with_; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000234
235 // The scope immediately surrounding this scope, or NULL.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100236 Scope* outer_scope() const { return outer_scope_; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000237
238 // ---------------------------------------------------------------------------
239 // Accessors.
240
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000241 // The variable corresponding the 'this' value.
242 Variable* receiver() { return receiver_; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000243
244 // The variable holding the function literal for named function
245 // literals, or NULL.
246 // Only valid for function scopes.
Ben Murdoch589d6972011-11-30 16:04:58 +0000247 VariableProxy* function() const {
Steve Blocka7e24c12009-10-30 11:49:00 +0000248 ASSERT(is_function_scope());
249 return function_;
250 }
251
252 // Parameters. The left-most parameter has index 0.
253 // Only valid for function scopes.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100254 Variable* parameter(int index) const {
Steve Blocka7e24c12009-10-30 11:49:00 +0000255 ASSERT(is_function_scope());
256 return params_[index];
257 }
258
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100259 int num_parameters() const { return params_.length(); }
Steve Blocka7e24c12009-10-30 11:49:00 +0000260
261 // The local variable 'arguments' if we need to allocate it; NULL otherwise.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100262 Variable* arguments() const { return arguments_; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000263
Steve Blocka7e24c12009-10-30 11:49:00 +0000264 // Declarations list.
265 ZoneList<Declaration*>* declarations() { return &decls_; }
266
267
Steve Blocka7e24c12009-10-30 11:49:00 +0000268 // ---------------------------------------------------------------------------
269 // Variable allocation.
270
271 // Collect all used locals in this scope.
272 template<class Allocator>
273 void CollectUsedVariables(List<Variable*, Allocator>* locals);
274
275 // Resolve and fill in the allocation information for all variables
276 // in this scopes. Must be called *after* all scopes have been
277 // processed (parsed) to ensure that unresolved variables can be
278 // resolved properly.
279 //
280 // In the case of code compiled and run using 'eval', the context
281 // parameter is the context in which eval was called. In all other
282 // cases the context parameter is an empty handle.
283 void AllocateVariables(Handle<Context> context);
284
Steve Block053d10c2011-06-13 19:13:29 +0100285 // Current number of var or const locals.
286 int num_var_or_const() { return num_var_or_const_; }
287
Steve Blocka7e24c12009-10-30 11:49:00 +0000288 // Result of variable allocation.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100289 int num_stack_slots() const { return num_stack_slots_; }
290 int num_heap_slots() const { return num_heap_slots_; }
Steve Blocka7e24c12009-10-30 11:49:00 +0000291
292 // Make sure this scope and all outer scopes are eagerly compiled.
293 void ForceEagerCompilation() { force_eager_compilation_ = true; }
294
295 // Determine if we can use lazy compilation for this scope.
296 bool AllowsLazyCompilation() const;
297
298 // True if the outer context of this scope is always the global context.
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000299 bool HasTrivialOuterContext() const;
Steve Blocka7e24c12009-10-30 11:49:00 +0000300
301 // The number of contexts between this and scope; zero if this == scope.
302 int ContextChainLength(Scope* scope);
303
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000304 // Find the first function, global, or eval scope. This is the scope
305 // where var declarations will be hoisted to in the implementation.
306 Scope* DeclarationScope();
307
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000308 Handle<SerializedScopeInfo> GetSerializedScopeInfo();
309
Steve Blocka7e24c12009-10-30 11:49:00 +0000310 // ---------------------------------------------------------------------------
Steve Block1e0659c2011-05-24 12:43:12 +0100311 // Strict mode support.
312 bool IsDeclared(Handle<String> name) {
313 // During formal parameter list parsing the scope only contains
314 // two variables inserted at initialization: "this" and "arguments".
315 // "this" is an invalid parameter name and "arguments" is invalid parameter
316 // name in strict mode. Therefore looking up with the map which includes
317 // "this" and "arguments" in addition to all formal parameters is safe.
318 return variables_.Lookup(name) != NULL;
319 }
320
321 // ---------------------------------------------------------------------------
Steve Blocka7e24c12009-10-30 11:49:00 +0000322 // Debugging.
323
324#ifdef DEBUG
325 void Print(int n = 0); // n = indentation; n < 0 => don't print recursively
326#endif
327
328 // ---------------------------------------------------------------------------
329 // Implementation.
330 protected:
331 friend class ParserFactory;
332
333 explicit Scope(Type type);
334
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000335 Isolate* const isolate_;
336
Steve Blocka7e24c12009-10-30 11:49:00 +0000337 // Scope tree.
338 Scope* outer_scope_; // the immediately enclosing outer scope, or NULL
339 ZoneList<Scope*> inner_scopes_; // the immediately enclosed inner scopes
340
341 // The scope type.
342 Type type_;
343
344 // Debugging support.
345 Handle<String> scope_name_;
346
347 // The variables declared in this scope:
348 //
349 // All user-declared variables (incl. parameters). For global scopes
350 // variables may be implicitly 'declared' by being used (possibly in
351 // an inner scope) with no intervening with statements or eval calls.
352 VariableMap variables_;
353 // Compiler-allocated (user-invisible) temporaries.
354 ZoneList<Variable*> temps_;
355 // Parameter list in source order.
356 ZoneList<Variable*> params_;
357 // Variables that must be looked up dynamically.
358 DynamicScopePart* dynamics_;
359 // Unresolved variables referred to from this scope.
360 ZoneList<VariableProxy*> unresolved_;
361 // Declarations.
362 ZoneList<Declaration*> decls_;
363 // Convenience variable.
Leon Clarkee46be812010-01-19 14:06:41 +0000364 Variable* receiver_;
Steve Blocka7e24c12009-10-30 11:49:00 +0000365 // Function variable, if any; function scopes only.
Ben Murdoch589d6972011-11-30 16:04:58 +0000366 VariableProxy* function_;
Steve Blocka7e24c12009-10-30 11:49:00 +0000367 // Convenience variable; function scopes only.
Kristian Monsen0d5e1162010-09-30 15:31:59 +0100368 Variable* arguments_;
Steve Blocka7e24c12009-10-30 11:49:00 +0000369
370 // Illegal redeclaration.
371 Expression* illegal_redecl_;
372
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000373 // Scope-specific information computed during parsing.
374 //
375 // This scope is inside a 'with' of some outer scope.
376 bool scope_inside_with_;
377 // This scope contains a 'with' statement.
378 bool scope_contains_with_;
379 // This scope or a nested catch scope or with scope contain an 'eval' call. At
380 // the 'eval' call site this scope is the declaration scope.
381 bool scope_calls_eval_;
382 // This scope is a strict mode scope.
383 bool strict_mode_;
Steve Blocka7e24c12009-10-30 11:49:00 +0000384
385 // Computed via PropagateScopeInfo.
386 bool outer_scope_calls_eval_;
Ben Murdoch257744e2011-11-30 15:57:28 +0000387 bool outer_scope_calls_non_strict_eval_;
Steve Blocka7e24c12009-10-30 11:49:00 +0000388 bool inner_scope_calls_eval_;
389 bool outer_scope_is_eval_scope_;
390 bool force_eager_compilation_;
391
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000392 // True if it doesn't need scope resolution (e.g., if the scope was
393 // constructed based on a serialized scope info or a catch context).
394 bool already_resolved_;
395
Steve Block053d10c2011-06-13 19:13:29 +0100396 // Computed as variables are declared.
397 int num_var_or_const_;
398
Steve Blocka7e24c12009-10-30 11:49:00 +0000399 // Computed via AllocateVariables; function scopes only.
400 int num_stack_slots_;
401 int num_heap_slots_;
402
Ben Murdochb8e0da22011-05-16 14:20:40 +0100403 // Serialized scopes support.
Ben Murdoch8b112d22011-06-08 16:22:53 +0100404 Handle<SerializedScopeInfo> scope_info_;
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000405 bool already_resolved() { return already_resolved_; }
Ben Murdochb8e0da22011-05-16 14:20:40 +0100406
Steve Blocka7e24c12009-10-30 11:49:00 +0000407 // Create a non-local variable with a given name.
408 // These variables are looked up dynamically at runtime.
409 Variable* NonLocal(Handle<String> name, Variable::Mode mode);
410
411 // Variable resolution.
412 Variable* LookupRecursive(Handle<String> name,
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000413 bool from_inner_function,
Steve Blocka7e24c12009-10-30 11:49:00 +0000414 Variable** invalidated_local);
415 void ResolveVariable(Scope* global_scope,
416 Handle<Context> context,
417 VariableProxy* proxy);
418 void ResolveVariablesRecursively(Scope* global_scope,
419 Handle<Context> context);
420
421 // Scope analysis.
422 bool PropagateScopeInfo(bool outer_scope_calls_eval,
Ben Murdoch257744e2011-11-30 15:57:28 +0000423 bool outer_scope_calls_non_strict_eval,
Steve Blocka7e24c12009-10-30 11:49:00 +0000424 bool outer_scope_is_eval_scope);
425 bool HasTrivialContext() const;
426
427 // Predicates.
428 bool MustAllocate(Variable* var);
429 bool MustAllocateInContext(Variable* var);
430 bool HasArgumentsParameter();
431
432 // Variable allocation.
433 void AllocateStackSlot(Variable* var);
434 void AllocateHeapSlot(Variable* var);
435 void AllocateParameterLocals();
436 void AllocateNonParameterLocal(Variable* var);
437 void AllocateNonParameterLocals();
438 void AllocateVariablesRecursively();
Ben Murdochb8e0da22011-05-16 14:20:40 +0100439
440 private:
Ben Murdoch69a99ed2011-11-30 16:03:39 +0000441 // Construct a function or block scope based on the scope info.
442 Scope(Scope* inner_scope, Type type, Handle<SerializedScopeInfo> scope_info);
Ben Murdochb8e0da22011-05-16 14:20:40 +0100443
Ben Murdoch3fb3ca82011-12-02 17:19:32 +0000444 // Construct a catch scope with a binding for the name.
445 Scope(Scope* inner_scope, Handle<String> catch_variable_name);
446
Steve Block44f0eee2011-05-26 01:26:41 +0100447 void AddInnerScope(Scope* inner_scope) {
448 if (inner_scope != NULL) {
449 inner_scopes_.Add(inner_scope);
450 inner_scope->outer_scope_ = this;
451 }
452 }
453
Ben Murdochb8e0da22011-05-16 14:20:40 +0100454 void SetDefaults(Type type,
455 Scope* outer_scope,
Ben Murdoch8b112d22011-06-08 16:22:53 +0100456 Handle<SerializedScopeInfo> scope_info);
Steve Blocka7e24c12009-10-30 11:49:00 +0000457};
458
Steve Blocka7e24c12009-10-30 11:49:00 +0000459} } // namespace v8::internal
460
461#endif // V8_SCOPES_H_