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

Unified Diff: src/parser.h

Issue 1259013003: [es6] Refactor FormalParameter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comments 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
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 733665c519ea54ff36073ed82b4a920393625875..2086ee96a786a6d573a8a4d63393527b05194fe0 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -541,10 +541,11 @@ class SingletonLogger;
struct ParserFormalParameters : public PreParserFormalParameters {
struct Parameter {
- Parameter(Variable* var, Expression* pattern)
- : var(var), pattern(pattern) {}
- Variable* var;
+ Parameter(const AstRawString* name, Expression* pattern, bool is_rest)
+ : name(name), pattern(pattern), is_rest(is_rest) {}
+ const AstRawString* name;
Expression* pattern;
+ bool is_rest;
};
explicit ParserFormalParameters(Scope* scope)
@@ -552,8 +553,10 @@ struct ParserFormalParameters : public PreParserFormalParameters {
ZoneList<Parameter> params;
- void AddParameter(Variable* var, Expression* pattern) {
- params.Add(Parameter(var, pattern), scope->zone());
+ void AddParameter(
+ const AstRawString* name, Expression* pattern, bool is_rest) {
+ params.Add(Parameter(name, pattern, is_rest), scope->zone());
+ DCHECK_EQ(arity, params.length());
}
};
@@ -579,7 +582,7 @@ class ParserTraits {
typedef ObjectLiteral::Property* ObjectLiteralProperty;
typedef ZoneList<v8::internal::Expression*>* ExpressionList;
typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
- typedef const v8::internal::AstRawString* FormalParameter;
+ typedef ParserFormalParameters::Parameter FormalParameter;
typedef ParserFormalParameters FormalParameters;
typedef ZoneList<v8::internal::Statement*>* StatementList;
@@ -1320,7 +1323,7 @@ void ParserTraits::DeclareFormalParameter(
VariableMode mode = is_simple ? VAR : TEMPORARY;
Variable* var =
parameters->scope->DeclareParameter(name, mode, is_rest, &is_duplicate);
- parameters->AddParameter(var, is_simple ? nullptr : pattern);
+ parameters->AddParameter(name, is_simple ? nullptr : pattern, is_rest);
if (is_duplicate) {
classifier->RecordDuplicateFormalParameterError(
parser_->scanner()->location());
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698