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

Unified Diff: src/parser.h

Issue 1100713002: Factor formal argument parsing into ParserBase (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Avoid DuplicateFinder creation in the full parser Created 5 years, 8 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/messages.js ('k') | 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 8d557aed53eca468795303c536bbd17252890551..a985d71e984aad23a1ae14fab423dc2eaf54b965 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -557,6 +557,8 @@ class ParserTraits {
typedef ObjectLiteral::Property* ObjectLiteralProperty;
typedef ZoneList<v8::internal::Expression*>* ExpressionList;
typedef ZoneList<ObjectLiteral::Property*>* PropertyList;
+ typedef const v8::internal::AstRawString* FormalParameter;
+ typedef Scope FormalParameterScope;
typedef ZoneList<v8::internal::Statement*>* StatementList;
// For constructing objects returned by the traversing functions.
@@ -705,6 +707,7 @@ class ParserTraits {
static ZoneList<Expression*>* NullExpressionList() {
return NULL;
}
+ static const AstRawString* EmptyFormalParameter() { return NULL; }
// Non-NULL empty string.
V8_INLINE const AstRawString* EmptyIdentifierString();
@@ -745,10 +748,22 @@ class ParserTraits {
// Utility functions
int DeclareArrowParametersFromExpression(Expression* expression, Scope* scope,
- Scanner::Location* undefined_loc,
- Scanner::Location* dupe_loc,
+ FormalParameterErrorLocations* locs,
bool* ok);
+ bool DeclareFormalParameter(Scope* scope, const AstRawString* name,
+ bool is_rest) {
+ bool is_duplicate = false;
+ Variable* var = scope->DeclareParameter(name, VAR, is_rest, &is_duplicate);
+ if (is_sloppy(scope->language_mode())) {
+ // TODO(sigurds) Mark every parameter as maybe assigned. This is a
+ // conservative approximation necessary to account for parameters
+ // that are assigned via the arguments array.
+ var->set_maybe_assigned();
+ }
+ return is_duplicate;
+ }
+
// Temporary glue; these functions will move to ParserBase.
Expression* ParseV8Intrinsic(bool* ok);
FunctionLiteral* ParseFunctionLiteral(
« no previous file with comments | « src/messages.js ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698