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

Side by Side Diff: src/ast/scopes.cc

Issue 2253093002: Always inherit language-mode from the outer scope, modules initialize language-mode later (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Actually inherit the language mode :) Created 4 years, 4 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 | « no previous file | no next file » | 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 #include "src/ast/scopes.h" 5 #include "src/ast/scopes.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "src/accessors.h" 9 #include "src/accessors.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 decls_(4, zone), 82 decls_(4, zone),
83 scope_type_(scope_type), 83 scope_type_(scope_type),
84 already_resolved_(false) { 84 already_resolved_(false) {
85 SetDefaults(); 85 SetDefaults();
86 if (outer_scope == nullptr) { 86 if (outer_scope == nullptr) {
87 // If the outer scope is null, this cannot be a with scope. The outermost 87 // If the outer scope is null, this cannot be a with scope. The outermost
88 // scope must be a script scope. 88 // scope must be a script scope.
89 DCHECK_EQ(SCRIPT_SCOPE, scope_type); 89 DCHECK_EQ(SCRIPT_SCOPE, scope_type);
90 } else { 90 } else {
91 asm_function_ = outer_scope_->asm_module_; 91 asm_function_ = outer_scope_->asm_module_;
92 // Inherit the language mode from the parent scope unless we're a module 92 // Inherit the language mode from the parent scope.
neis 2016/08/17 15:22:52 Feel free to remove the comment completely.
93 // scope. 93 language_mode_ = outer_scope->language_mode_;
94 if (!is_module_scope()) language_mode_ = outer_scope->language_mode_;
95 force_context_allocation_ = 94 force_context_allocation_ =
96 !is_function_scope() && outer_scope->has_forced_context_allocation(); 95 !is_function_scope() && outer_scope->has_forced_context_allocation();
97 outer_scope_->AddInnerScope(this); 96 outer_scope_->AddInnerScope(this);
98 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope(); 97 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope();
99 } 98 }
100 } 99 }
101 100
102 Scope::Snapshot::Snapshot(Scope* scope) 101 Scope::Snapshot::Snapshot(Scope* scope)
103 : outer_scope_(scope), 102 : outer_scope_(scope),
104 top_inner_scope_(scope->inner_scope_), 103 top_inner_scope_(scope->inner_scope_),
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1767 function != nullptr && function->IsContextSlot(); 1766 function != nullptr && function->IsContextSlot();
1768 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - 1767 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() -
1769 (is_function_var_in_context ? 1 : 0); 1768 (is_function_var_in_context ? 1 : 0);
1770 } 1769 }
1771 1770
1772 1771
1773 int Scope::ContextGlobalCount() const { return num_global_slots(); } 1772 int Scope::ContextGlobalCount() const { return num_global_slots(); }
1774 1773
1775 } // namespace internal 1774 } // namespace internal
1776 } // namespace v8 1775 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698