| Index: src/preparser.h
|
| diff --git a/src/preparser.h b/src/preparser.h
|
| index f3bb292e2c5ca56afd33939d0e860091f4c0176e..abfe2f59cea36b896dbc601ca0bed2e317b29e90 100644
|
| --- a/src/preparser.h
|
| +++ b/src/preparser.h
|
| @@ -627,7 +627,9 @@ class PreParserIdentifier {
|
| return PreParserIdentifier(kConstructorIdentifier);
|
| }
|
| bool IsEval() const { return type_ == kEvalIdentifier; }
|
| - bool IsArguments() const { return type_ == kArgumentsIdentifier; }
|
| + bool IsArguments(const AstValueFactory* = NULL) const {
|
| + return type_ == kArgumentsIdentifier;
|
| + }
|
| bool IsYield() const { return type_ == kYieldIdentifier; }
|
| bool IsPrototype() const { return type_ == kPrototypeIdentifier; }
|
| bool IsConstructor() const { return type_ == kConstructorIdentifier; }
|
| @@ -968,6 +970,8 @@ class PreParserScope {
|
|
|
| bool IsDeclared(const PreParserIdentifier& identifier) const { return false; }
|
| void DeclareParameter(const PreParserIdentifier& identifier, VariableMode) {}
|
| + void RecordArgumentsUsage() {}
|
| + void RecordThisUsage() {}
|
|
|
| // Allow scope->Foo() to work.
|
| PreParserScope* operator->() { return this; }
|
| @@ -1655,6 +1659,8 @@ typename ParserBase<Traits>::IdentifierT ParserBase<Traits>::ParseIdentifier(
|
| ReportMessage("strict_eval_arguments");
|
| *ok = false;
|
| }
|
| + if (name->IsArguments(this->ast_value_factory()))
|
| + scope_->RecordArgumentsUsage();
|
| return name;
|
| } else if (strict_mode() == SLOPPY &&
|
| (next == Token::FUTURE_STRICT_RESERVED_WORD ||
|
| @@ -1685,7 +1691,11 @@ typename ParserBase<Traits>::IdentifierT ParserBase<
|
| *ok = false;
|
| return Traits::EmptyIdentifier();
|
| }
|
| - return this->GetSymbol(scanner());
|
| +
|
| + IdentifierT name = this->GetSymbol(scanner());
|
| + if (name->IsArguments(this->ast_value_factory()))
|
| + scope_->RecordArgumentsUsage();
|
| + return name;
|
| }
|
|
|
|
|
| @@ -1700,7 +1710,11 @@ ParserBase<Traits>::ParseIdentifierName(bool* ok) {
|
| *ok = false;
|
| return Traits::EmptyIdentifier();
|
| }
|
| - return this->GetSymbol(scanner());
|
| +
|
| + IdentifierT name = this->GetSymbol(scanner());
|
| + if (name->IsArguments(this->ast_value_factory()))
|
| + scope_->RecordArgumentsUsage();
|
| + return name;
|
| }
|
|
|
|
|
| @@ -1778,6 +1792,7 @@ ParserBase<Traits>::ParsePrimaryExpression(bool* ok) {
|
| switch (token) {
|
| case Token::THIS: {
|
| Consume(Token::THIS);
|
| + scope_->RecordThisUsage();
|
| result = this->ThisExpression(scope_, factory());
|
| break;
|
| }
|
| @@ -2625,9 +2640,7 @@ template <class Traits>
|
| typename ParserBase<Traits>::ExpressionT ParserBase<
|
| Traits>::ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast,
|
| bool* ok) {
|
| - // TODO(aperez): Change this to use ARROW_SCOPE
|
| - typename Traits::Type::ScopePtr scope =
|
| - this->NewScope(scope_, FUNCTION_SCOPE);
|
| + typename Traits::Type::ScopePtr scope = this->NewScope(scope_, ARROW_SCOPE);
|
| typename Traits::Type::StatementList body;
|
| typename Traits::Type::AstProperties ast_properties;
|
| BailoutReason dont_optimize_reason = kNoReason;
|
|
|