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/zone.h" | 9 #include "src/zone.h" |
10 | 10 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 374 |
375 int num_parameters() const { return params_.length(); } | 375 int num_parameters() const { return params_.length(); } |
376 | 376 |
377 // A function can have at most one rest parameter. Returns Variable* or NULL. | 377 // A function can have at most one rest parameter. Returns Variable* or NULL. |
378 Variable* rest_parameter(int* index) const { | 378 Variable* rest_parameter(int* index) const { |
379 *index = rest_index_; | 379 *index = rest_index_; |
380 if (rest_index_ < 0) return NULL; | 380 if (rest_index_ < 0) return NULL; |
381 return rest_parameter_; | 381 return rest_parameter_; |
382 } | 382 } |
383 | 383 |
| 384 bool has_rest_parameter() const { |
| 385 return rest_index_ >= 0; |
| 386 } |
| 387 |
384 bool is_simple_parameter_list() const { | 388 bool is_simple_parameter_list() const { |
385 DCHECK(is_function_scope()); | 389 DCHECK(is_function_scope()); |
386 if (rest_index_ >= 0) return false; | 390 if (rest_index_ >= 0) return false; |
387 return true; | 391 return true; |
388 } | 392 } |
389 | 393 |
390 // The local variable 'arguments' if we need to allocate it; NULL otherwise. | 394 // The local variable 'arguments' if we need to allocate it; NULL otherwise. |
391 Variable* arguments() const { return arguments_; } | 395 Variable* arguments() const { return arguments_; } |
392 | 396 |
393 // Declarations list. | 397 // Declarations list. |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 Scope* outer_scope, | 706 Scope* outer_scope, |
703 Handle<ScopeInfo> scope_info); | 707 Handle<ScopeInfo> scope_info); |
704 | 708 |
705 AstValueFactory* ast_value_factory_; | 709 AstValueFactory* ast_value_factory_; |
706 Zone* zone_; | 710 Zone* zone_; |
707 }; | 711 }; |
708 | 712 |
709 } } // namespace v8::internal | 713 } } // namespace v8::internal |
710 | 714 |
711 #endif // V8_SCOPES_H_ | 715 #endif // V8_SCOPES_H_ |
OLD | NEW |