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

Unified Diff: src/parser.h

Issue 1127063003: [es6] implement default parameters via desugaring (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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') | src/parser.cc » ('J')
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 58253e1bb6919309a444864f10bfff904efb837f..0a46eb3e2d726b1cbc2c999637c6fde9c207c658 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -746,9 +746,10 @@ class ParserTraits {
FunctionKind kind = kNormalFunction);
bool DeclareFormalParameter(Scope* scope, const AstRawString* name,
- bool is_rest) {
+ bool is_rest, int pos) {
bool is_duplicate = false;
- Variable* var = scope->DeclareParameter(name, VAR, is_rest, &is_duplicate);
+ Variable* var =
+ scope->DeclareParameter(name, VAR, pos, is_rest, &is_duplicate);
arv (Not doing code reviews) 2015/05/06 20:32:38 keep pos at end?
if (is_sloppy(scope->language_mode())) {
// TODO(sigurds) Mark every parameter as maybe assigned. This is a
// conservative approximation necessary to account for parameters
@@ -978,6 +979,9 @@ class Parser : public ParserBase<ParserTraits> {
ForStatement* loop, Statement* init, Expression* cond, Statement* next,
Statement* body, bool* ok);
+ ZoneList<Statement*>* DesugarInitializeParameters(
+ Scope* scope, bool has_initializers, ZoneList<Expression*>* initializers);
+
FunctionLiteral* ParseFunctionLiteral(
const AstRawString* name, Scanner::Location function_name_location,
bool name_is_strict_reserved, FunctionKind kind,
@@ -1011,6 +1015,10 @@ class Parser : public ParserBase<ParserTraits> {
VariableProxy* NewUnresolved(const AstRawString* name, VariableMode mode);
Variable* Declare(Declaration* declaration, bool resolve, bool* ok);
+ // Parameters have expressions --- ensure that the declared parameters can
+ // never be resolved
+ void ShadowParametersForExpressions(Scope* scope);
+
bool TargetStackContainsLabel(const AstRawString* label);
BreakableStatement* LookupBreakTarget(const AstRawString* label, bool* ok);
IterationStatement* LookupContinueTarget(const AstRawString* label, bool* ok);
« no previous file with comments | « no previous file | src/parser.cc » ('j') | src/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698