| 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" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // Lookup a variable in this scope or outer scopes. | 113 // Lookup a variable in this scope or outer scopes. |
| 114 // Returns the variable or NULL if not found. | 114 // Returns the variable or NULL if not found. |
| 115 Variable* Lookup(const AstRawString* name); | 115 Variable* Lookup(const AstRawString* name); |
| 116 | 116 |
| 117 // Declare the function variable for a function literal. This variable | 117 // Declare the function variable for a function literal. This variable |
| 118 // is in an intermediate scope between this function scope and the the | 118 // is in an intermediate scope between this function scope and the the |
| 119 // outer scope. Only possible for function scopes; at most one variable. | 119 // outer scope. Only possible for function scopes; at most one variable. |
| 120 void DeclareFunctionVar(VariableDeclaration* declaration) { | 120 void DeclareFunctionVar(VariableDeclaration* declaration) { |
| 121 DCHECK(is_function_scope()); | 121 DCHECK(is_function_scope()); |
| 122 // Handle implicit declaration of the function name in named function |
| 123 // expressions before other declarations. |
| 124 decls_.InsertAt(0, declaration, zone()); |
| 122 function_ = declaration; | 125 function_ = declaration; |
| 123 } | 126 } |
| 124 | 127 |
| 125 // Declare a parameter in this scope. When there are duplicated | 128 // Declare a parameter in this scope. When there are duplicated |
| 126 // parameters the rightmost one 'wins'. However, the implementation | 129 // parameters the rightmost one 'wins'. However, the implementation |
| 127 // expects all parameters to be declared and from left to right. | 130 // expects all parameters to be declared and from left to right. |
| 128 Variable* DeclareParameter(const AstRawString* name, VariableMode mode, | 131 Variable* DeclareParameter(const AstRawString* name, VariableMode mode, |
| 129 bool is_rest, bool* is_duplicate); | 132 bool is_rest, bool* is_duplicate); |
| 130 | 133 |
| 131 // Declare a local variable in this scope. If the variable has been | 134 // Declare a local variable in this scope. If the variable has been |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 PendingCompilationErrorHandler pending_error_handler_; | 766 PendingCompilationErrorHandler pending_error_handler_; |
| 764 | 767 |
| 765 // For tracking which classes are declared consecutively. Needed for strong | 768 // For tracking which classes are declared consecutively. Needed for strong |
| 766 // mode. | 769 // mode. |
| 767 int class_declaration_group_start_; | 770 int class_declaration_group_start_; |
| 768 }; | 771 }; |
| 769 | 772 |
| 770 } } // namespace v8::internal | 773 } } // namespace v8::internal |
| 771 | 774 |
| 772 #endif // V8_SCOPES_H_ | 775 #endif // V8_SCOPES_H_ |
| OLD | NEW |