Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: src/scopes.h

Issue 1240463002: [es6] Implement inner scope for functions with destructuring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add tests for function name Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } 273 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; }
274 bool is_function_scope() const { 274 bool is_function_scope() const {
275 return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE; 275 return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE;
276 } 276 }
277 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } 277 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; }
278 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } 278 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; }
279 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } 279 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; }
280 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } 280 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
281 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } 281 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
282 bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; } 282 bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; }
283 bool is_declaration_scope() const { 283 bool is_declaration_scope() const { return is_declaration_scope_; }
284 return is_eval_scope() || is_function_scope() ||
285 is_module_scope() || is_script_scope();
286 }
287 bool is_strict_eval_scope() const { 284 bool is_strict_eval_scope() const {
288 return is_eval_scope() && is_strict(language_mode_); 285 return is_eval_scope() && is_strict(language_mode_);
289 } 286 }
290 287
288 void set_is_declaration_scope() { is_declaration_scope_ = true; }
289
291 // Information about which scopes calls eval. 290 // Information about which scopes calls eval.
292 bool calls_eval() const { return scope_calls_eval_; } 291 bool calls_eval() const { return scope_calls_eval_; }
293 bool calls_sloppy_eval() { 292 bool calls_sloppy_eval() {
294 return scope_calls_eval_ && is_sloppy(language_mode_); 293 return scope_calls_eval_ && is_sloppy(language_mode_);
295 } 294 }
296 bool outer_scope_calls_sloppy_eval() const { 295 bool outer_scope_calls_sloppy_eval() const {
297 return outer_scope_calls_sloppy_eval_; 296 return outer_scope_calls_sloppy_eval_;
298 } 297 }
299 bool asm_module() const { return asm_module_; } 298 bool asm_module() const { return asm_module_; }
300 bool asm_function() const { return asm_function_; } 299 bool asm_function() const { return asm_function_; }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 bool outer_scope_calls_sloppy_eval_; 606 bool outer_scope_calls_sloppy_eval_;
608 bool inner_scope_calls_eval_; 607 bool inner_scope_calls_eval_;
609 bool inner_scope_uses_arguments_; 608 bool inner_scope_uses_arguments_;
610 bool force_eager_compilation_; 609 bool force_eager_compilation_;
611 bool force_context_allocation_; 610 bool force_context_allocation_;
612 611
613 // True if it doesn't need scope resolution (e.g., if the scope was 612 // True if it doesn't need scope resolution (e.g., if the scope was
614 // constructed based on a serialized scope info or a catch context). 613 // constructed based on a serialized scope info or a catch context).
615 bool already_resolved_; 614 bool already_resolved_;
616 615
616 // True if it holds 'var' declarations.
617 bool is_declaration_scope_;
618
617 // Computed as variables are declared. 619 // Computed as variables are declared.
618 int num_var_or_const_; 620 int num_var_or_const_;
619 621
620 // Computed via AllocateVariables; function, block and catch scopes only. 622 // Computed via AllocateVariables; function, block and catch scopes only.
621 int num_stack_slots_; 623 int num_stack_slots_;
622 int num_heap_slots_; 624 int num_heap_slots_;
623 int num_global_slots_; 625 int num_global_slots_;
624 626
625 // The number of modules (including nested ones). 627 // The number of modules (including nested ones).
626 int num_modules_; 628 int num_modules_;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 PendingCompilationErrorHandler pending_error_handler_; 763 PendingCompilationErrorHandler pending_error_handler_;
762 764
763 // For tracking which classes are declared consecutively. Needed for strong 765 // For tracking which classes are declared consecutively. Needed for strong
764 // mode. 766 // mode.
765 int class_declaration_group_start_; 767 int class_declaration_group_start_;
766 }; 768 };
767 769
768 } } // namespace v8::internal 770 } } // namespace v8::internal
769 771
770 #endif // V8_SCOPES_H_ 772 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698