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

Side by Side Diff: src/scopes.h

Issue 1386253002: Use Scope::function_kind_ to distinguish arrow function scopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } 295 }
296 bool has_forced_context_allocation() const { 296 bool has_forced_context_allocation() const {
297 return force_context_allocation_; 297 return force_context_allocation_;
298 } 298 }
299 299
300 // --------------------------------------------------------------------------- 300 // ---------------------------------------------------------------------------
301 // Predicates. 301 // Predicates.
302 302
303 // Specific scope types. 303 // Specific scope types.
304 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; } 304 bool is_eval_scope() const { return scope_type_ == EVAL_SCOPE; }
305 bool is_function_scope() const { 305 bool is_function_scope() const { return scope_type_ == FUNCTION_SCOPE; }
306 return scope_type_ == FUNCTION_SCOPE || scope_type_ == ARROW_SCOPE;
307 }
308 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; } 306 bool is_module_scope() const { return scope_type_ == MODULE_SCOPE; }
309 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; } 307 bool is_script_scope() const { return scope_type_ == SCRIPT_SCOPE; }
310 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; } 308 bool is_catch_scope() const { return scope_type_ == CATCH_SCOPE; }
311 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } 309 bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
312 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } 310 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
313 bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; } 311 bool is_arrow_scope() const {
312 return is_function_scope() && IsArrowFunction(function_kind_);
313 }
314 bool is_declaration_scope() const { return is_declaration_scope_; } 314 bool is_declaration_scope() const { return is_declaration_scope_; }
315 315
316 void set_is_declaration_scope() { is_declaration_scope_ = true; } 316 void set_is_declaration_scope() { is_declaration_scope_ = true; }
317 317
318 // Information about which scopes calls eval. 318 // Information about which scopes calls eval.
319 bool calls_eval() const { return scope_calls_eval_; } 319 bool calls_eval() const { return scope_calls_eval_; }
320 bool calls_sloppy_eval() const { 320 bool calls_sloppy_eval() const {
321 return scope_calls_eval_ && is_sloppy(language_mode_); 321 return scope_calls_eval_ && is_sloppy(language_mode_);
322 } 322 }
323 bool outer_scope_calls_sloppy_eval() const { 323 bool outer_scope_calls_sloppy_eval() const {
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 // For tracking which classes are declared consecutively. Needed for strong 819 // For tracking which classes are declared consecutively. Needed for strong
820 // mode. 820 // mode.
821 int class_declaration_group_start_; 821 int class_declaration_group_start_;
822 }; 822 };
823 823
824 } // namespace internal 824 } // namespace internal
825 } // namespace v8 825 } // namespace v8
826 826
827 #endif // V8_SCOPES_H_ 827 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/scopeinfo.cc ('k') | src/scopes.cc » ('j') | test/mjsunit/es6/regress/regress-4466.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698