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

Unified Diff: src/parser.h

Issue 1300103005: [parser] disallow language mode directive in body of function with non-simple parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor test cleanup Created 5 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
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 602b5278ea813cb20083df5e99465c7466975abd..26a4b66a08d966f0246e866e8331d2671c7019ba 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -783,11 +783,11 @@ class ParserTraits {
Expression* initializer, bool is_rest);
V8_INLINE void DeclareFormalParameter(
Scope* scope, const ParserFormalParameters::Parameter& parameter,
- bool is_simple, ExpressionClassifier* classifier);
- void ParseArrowFunctionFormalParameters(
- ParserFormalParameters* parameters, Expression* params,
- const Scanner::Location& params_loc,
- Scanner::Location* duplicate_loc, bool* ok);
+ ExpressionClassifier* classifier);
+ void ParseArrowFunctionFormalParameters(ParserFormalParameters* parameters,
+ Expression* params,
+ const Scanner::Location& params_loc,
+ bool* ok);
void ParseArrowFunctionFormalParameterList(
ParserFormalParameters* parameters, Expression* params,
const Scanner::Location& params_loc,
@@ -1332,12 +1332,14 @@ void ParserTraits::AddFormalParameter(
void ParserTraits::DeclareFormalParameter(
Scope* scope, const ParserFormalParameters::Parameter& parameter,
- bool is_simple, ExpressionClassifier* classifier) {
+ ExpressionClassifier* classifier) {
bool is_duplicate = false;
+ bool is_simple = classifier->is_simple_parameter_list();
// TODO(caitp): Remove special handling for rest once desugaring is in.
auto name = is_simple || parameter.is_rest
? parameter.name : parser_->ast_value_factory()->empty_string();
auto mode = is_simple || parameter.is_rest ? VAR : TEMPORARY;
+ if (!is_simple) scope->SetHasNonSimpleParameters();
Variable* var =
scope->DeclareParameter(name, mode, parameter.is_rest, &is_duplicate);
if (is_duplicate) {

Powered by Google App Engine
This is Rietveld 408576698