| OLD | NEW | 
|    1 // Copyright 2012 the V8 project authors. All rights reserved. |    1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #ifndef V8_SCOPES_H_ |    5 #ifndef V8_SCOPES_H_ | 
|    6 #define V8_SCOPES_H_ |    6 #define V8_SCOPES_H_ | 
|    7  |    7  | 
|    8 #include "src/ast.h" |    8 #include "src/ast.h" | 
|    9 #include "src/pending-compilation-error-handler.h" |    9 #include "src/pending-compilation-error-handler.h" | 
|   10 #include "src/zone.h" |   10 #include "src/zone.h" | 
|   11  |   11  | 
|   12 namespace v8 { |   12 namespace v8 { | 
|   13 namespace internal { |   13 namespace internal { | 
|   14  |   14  | 
|   15 class ParseInfo; |   15 class ParseInfo; | 
|   16  |   16  | 
|   17 // A hash map to support fast variable declaration and lookup. |   17 // A hash map to support fast variable declaration and lookup. | 
|   18 class VariableMap: public ZoneHashMap { |   18 class VariableMap: public ZoneHashMap { | 
|   19  public: |   19  public: | 
|   20   explicit VariableMap(Zone* zone); |   20   explicit VariableMap(Zone* zone); | 
|   21  |   21  | 
|   22   virtual ~VariableMap(); |   22   virtual ~VariableMap(); | 
|   23  |   23  | 
|   24   Variable* Declare(Scope* scope, const AstRawString* name, VariableMode mode, |   24   Variable* Declare(Scope* scope, const AstRawString* name, VariableMode mode, | 
|   25                     Variable::Kind kind, InitializationFlag initialization_flag, |   25                     Variable::Kind kind, InitializationFlag initialization_flag, | 
|   26                     MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); |   26                     MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, | 
 |   27                     int consecutive_declaration_batch_start = -1); | 
|   27  |   28  | 
|   28   Variable* Lookup(const AstRawString* name); |   29   Variable* Lookup(const AstRawString* name); | 
|   29  |   30  | 
|   30   Zone* zone() const { return zone_; } |   31   Zone* zone() const { return zone_; } | 
|   31  |   32  | 
|   32  private: |   33  private: | 
|   33   Zone* zone_; |   34   Zone* zone_; | 
|   34 }; |   35 }; | 
|   35  |   36  | 
|   36  |   37  | 
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  124   // Declare a parameter in this scope.  When there are duplicated |  125   // Declare a parameter in this scope.  When there are duplicated | 
|  125   // parameters the rightmost one 'wins'.  However, the implementation |  126   // parameters the rightmost one 'wins'.  However, the implementation | 
|  126   // expects all parameters to be declared and from left to right. |  127   // expects all parameters to be declared and from left to right. | 
|  127   Variable* DeclareParameter(const AstRawString* name, VariableMode mode, |  128   Variable* DeclareParameter(const AstRawString* name, VariableMode mode, | 
|  128                              bool is_rest = false); |  129                              bool is_rest = false); | 
|  129  |  130  | 
|  130   // Declare a local variable in this scope. If the variable has been |  131   // Declare a local variable in this scope. If the variable has been | 
|  131   // declared before, the previously declared variable is returned. |  132   // declared before, the previously declared variable is returned. | 
|  132   Variable* DeclareLocal(const AstRawString* name, VariableMode mode, |  133   Variable* DeclareLocal(const AstRawString* name, VariableMode mode, | 
|  133                          InitializationFlag init_flag, Variable::Kind kind, |  134                          InitializationFlag init_flag, Variable::Kind kind, | 
|  134                          MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); |  135                          MaybeAssignedFlag maybe_assigned_flag = kNotAssigned, | 
 |  136                          int consecutive_declaration_batch_start = -1); | 
|  135  |  137  | 
|  136   // Declare an implicit global variable in this scope which must be a |  138   // Declare an implicit global variable in this scope which must be a | 
|  137   // script scope.  The variable was introduced (possibly from an inner |  139   // script scope.  The variable was introduced (possibly from an inner | 
|  138   // scope) by a reference to an unresolved variable with no intervening |  140   // scope) by a reference to an unresolved variable with no intervening | 
|  139   // with statements or eval calls. |  141   // with statements or eval calls. | 
|  140   Variable* DeclareDynamicGlobal(const AstRawString* name); |  142   Variable* DeclareDynamicGlobal(const AstRawString* name); | 
|  141  |  143  | 
|  142   // Create a new unresolved variable. |  144   // Create a new unresolved variable. | 
|  143   VariableProxy* NewUnresolved(AstNodeFactory* factory, |  145   VariableProxy* NewUnresolved(AstNodeFactory* factory, | 
|  144                                const AstRawString* name, |  146                                const AstRawString* name, | 
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  730  |  732  | 
|  731   AstValueFactory* ast_value_factory_; |  733   AstValueFactory* ast_value_factory_; | 
|  732   Zone* zone_; |  734   Zone* zone_; | 
|  733  |  735  | 
|  734   PendingCompilationErrorHandler pending_error_handler_; |  736   PendingCompilationErrorHandler pending_error_handler_; | 
|  735 }; |  737 }; | 
|  736  |  738  | 
|  737 } }  // namespace v8::internal |  739 } }  // namespace v8::internal | 
|  738  |  740  | 
|  739 #endif  // V8_SCOPES_H_ |  741 #endif  // V8_SCOPES_H_ | 
| OLD | NEW |