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

Unified Diff: src/ast/scopes.h

Issue 2261463002: There are only 2 language modes, not 3 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Undo last_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.h
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index 05df42c198a84b5ddb255285cef8f13953bf09ef..fb2f9f99896a209ae8ecd1747b37c4126350fedb 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -230,7 +230,7 @@ class Scope: public ZoneObject {
// Set the language mode flag (unless disabled by a global flag).
void SetLanguageMode(LanguageMode language_mode) {
DCHECK(!is_module_scope() || is_strict(language_mode));
- language_mode_ = language_mode;
+ set_language_mode(language_mode);
}
// Set the ASM module flag.
@@ -311,7 +311,7 @@ class Scope: public ZoneObject {
// Information about which scopes calls eval.
bool calls_eval() const { return scope_calls_eval_; }
bool calls_sloppy_eval() const {
- return scope_calls_eval_ && is_sloppy(language_mode_);
+ return scope_calls_eval_ && is_sloppy(language_mode());
}
bool outer_scope_calls_sloppy_eval() const {
return outer_scope_calls_sloppy_eval_;
@@ -338,7 +338,7 @@ class Scope: public ZoneObject {
ScopeType scope_type() const { return scope_type_; }
// The language mode of this scope.
- LanguageMode language_mode() const { return language_mode_; }
+ LanguageMode language_mode() const { return is_strict_ ? STRICT : SLOPPY; }
// inner_scope() and sibling() together implement the inner scope list of a
// scope. Inner scope points to the an inner scope of the function, and
@@ -445,7 +445,7 @@ class Scope: public ZoneObject {
protected:
void set_language_mode(LanguageMode language_mode) {
- language_mode_ = language_mode;
+ is_strict_ = is_strict(language_mode);
}
private:
@@ -496,8 +496,8 @@ class Scope: public ZoneObject {
// Scope-specific information computed during parsing.
//
// The language mode of this scope.
- STATIC_ASSERT(LANGUAGE_END == 3);
- LanguageMode language_mode_ : 2;
+ STATIC_ASSERT(LANGUAGE_END == 2);
+ bool is_strict_ : 1;
// This scope is inside a 'with' of some outer scope.
bool scope_inside_with_ : 1;
// This scope or a nested catch scope or with scope contain an 'eval' call. At
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698