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

Unified Diff: src/preparser.cc

Issue 898983002: Add strong mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Code review + fixes Created 5 years, 10 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 | « src/preparser.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 2bed1932710e0573a015a3503bbe2894fa23d11d..170c9e725135818e3ff81a9914b16429b387dfa1 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -80,6 +80,8 @@ PreParserExpression PreParserTraits::ExpressionFromString(
int pos, Scanner* scanner, PreParserFactory* factory) {
if (scanner->UnescapedLiteralMatches("use strict", 10)) {
return PreParserExpression::UseStrictStringLiteral();
+ } else if (scanner->UnescapedLiteralMatches("use strong", 10)) {
+ return PreParserExpression::UseStrongStringLiteral();
}
return PreParserExpression::StringLiteral();
}
@@ -212,7 +214,10 @@ PreParser::SourceElements PreParser::ParseSourceElements(int end_token,
if (directive_prologue) {
if (statement.IsUseStrictLiteral()) {
scope_->SetLanguageMode(
- static_cast<LanguageMode>(scope_->language_mode() | STRICT));
+ static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
+ } else if (statement.IsUseStrongLiteral() && allow_strong_mode()) {
+ scope_->SetLanguageMode(static_cast<LanguageMode>(
+ scope_->language_mode() | STRICT_BIT | STRONG_BIT));
} else if (!statement.IsStringLiteral()) {
directive_prologue = false;
}
@@ -1002,7 +1007,7 @@ PreParserExpression PreParser::ParseClassLiteral(
PreParserScope scope = NewScope(scope_, BLOCK_SCOPE);
BlockState block_state(&scope_, &scope);
scope_->SetLanguageMode(
- static_cast<LanguageMode>(scope_->language_mode() | STRICT));
+ static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
scope_->SetScopeName(name);
bool has_extends = Check(Token::EXTENDS);
« no previous file with comments | « src/preparser.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698