| 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_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
| 6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
| 7 | 7 |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 10 #include "src/pending-compilation-error-handler.h" | 10 #include "src/pending-compilation-error-handler.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // Remove a temporary variable. This is for adjusting the scope of | 210 // Remove a temporary variable. This is for adjusting the scope of |
| 211 // temporaries used when desugaring parameter initializers. | 211 // temporaries used when desugaring parameter initializers. |
| 212 // Returns the index at which it was found in this scope, or -1 if | 212 // Returns the index at which it was found in this scope, or -1 if |
| 213 // it was not found. | 213 // it was not found. |
| 214 int RemoveTemporary(Variable* var); | 214 int RemoveTemporary(Variable* var); |
| 215 | 215 |
| 216 // Adds a temporary variable in this scope's TemporaryScope. This is for | 216 // Adds a temporary variable in this scope's TemporaryScope. This is for |
| 217 // adjusting the scope of temporaries used when desugaring parameter | 217 // adjusting the scope of temporaries used when desugaring parameter |
| 218 // initializers. | 218 // initializers. |
| 219 void AddTemporary(Variable* var) { temps_.Add(var, zone()); } | 219 void AddTemporary(Variable* var) { |
| 220 // Temporaries are only placed in ClosureScopes. |
| 221 DCHECK_EQ(ClosureScope(), this); |
| 222 temps_.Add(var, zone()); |
| 223 } |
| 220 | 224 |
| 221 // Adds the specific declaration node to the list of declarations in | 225 // Adds the specific declaration node to the list of declarations in |
| 222 // this scope. The declarations are processed as part of entering | 226 // this scope. The declarations are processed as part of entering |
| 223 // the scope; see codegen.cc:ProcessDeclarations. | 227 // the scope; see codegen.cc:ProcessDeclarations. |
| 224 void AddDeclaration(Declaration* declaration); | 228 void AddDeclaration(Declaration* declaration); |
| 225 | 229 |
| 226 // --------------------------------------------------------------------------- | 230 // --------------------------------------------------------------------------- |
| 227 // Illegal redeclaration support. | 231 // Illegal redeclaration support. |
| 228 | 232 |
| 229 // Check if the scope has conflicting var | 233 // Check if the scope has conflicting var |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 AstValueFactory* ast_value_factory_; | 813 AstValueFactory* ast_value_factory_; |
| 810 Zone* zone_; | 814 Zone* zone_; |
| 811 | 815 |
| 812 PendingCompilationErrorHandler pending_error_handler_; | 816 PendingCompilationErrorHandler pending_error_handler_; |
| 813 }; | 817 }; |
| 814 | 818 |
| 815 } // namespace internal | 819 } // namespace internal |
| 816 } // namespace v8 | 820 } // namespace v8 |
| 817 | 821 |
| 818 #endif // V8_AST_SCOPES_H_ | 822 #endif // V8_AST_SCOPES_H_ |
| OLD | NEW |