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