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

Side by Side Diff: src/parsing/parser-base.h

Issue 2185223002: Fix not throwing error when redefine eval or arguments in strict mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Clean up tests Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 ExpressionT name_expression = ParsePropertyName( 1948 ExpressionT name_expression = ParsePropertyName(
1949 name, &is_get, &is_set, &is_await, is_computed_name, classifier, 1949 name, &is_get, &is_set, &is_await, is_computed_name, classifier,
1950 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); 1950 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
1951 1951
1952 if (fni_ != nullptr && !*is_computed_name) { 1952 if (fni_ != nullptr && !*is_computed_name) {
1953 this->PushLiteralName(fni_, *name); 1953 this->PushLiteralName(fni_, *name);
1954 } 1954 }
1955 1955
1956 if (!in_class && !is_generator) { 1956 if (!in_class && !is_generator) {
1957 DCHECK(!IsStaticMethod(method_kind)); 1957 DCHECK(!IsStaticMethod(method_kind));
1958
1959 if (peek() == Token::COLON) { 1958 if (peek() == Token::COLON) {
1960 // PropertyDefinition 1959 // PropertyDefinition
1961 // PropertyName ':' AssignmentExpression 1960 // PropertyName ':' AssignmentExpression
1962 if (!*is_computed_name) { 1961 if (!*is_computed_name) {
1963 checker->CheckProperty(name_token, kValueProperty, MethodKind::kNormal, 1962 checker->CheckProperty(name_token, kValueProperty, MethodKind::kNormal,
1964 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); 1963 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
1965 } 1964 }
1966 Consume(Token::COLON); 1965 Consume(Token::COLON);
1967 int beg_pos = peek_position(); 1966 int beg_pos = peek_position();
1968 ExpressionT value = this->ParseAssignmentExpression( 1967 ExpressionT value = this->ParseAssignmentExpression(
(...skipping 12 matching lines...) Expand all
1981 // PropertyDefinition 1980 // PropertyDefinition
1982 // IdentifierReference 1981 // IdentifierReference
1983 // CoverInitializedName 1982 // CoverInitializedName
1984 // 1983 //
1985 // CoverInitializedName 1984 // CoverInitializedName
1986 // IdentifierReference Initializer? 1985 // IdentifierReference Initializer?
1987 if (classifier->duplicate_finder() != nullptr && 1986 if (classifier->duplicate_finder() != nullptr &&
1988 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { 1987 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) {
1989 classifier->RecordDuplicateFormalParameterError(scanner()->location()); 1988 classifier->RecordDuplicateFormalParameterError(scanner()->location());
1990 } 1989 }
1990
1991 if (this->IsEvalOrArguments(*name) && is_strict(language_mode())) {
1992 classifier->RecordBindingPatternError(
1993 scanner()->location(), MessageTemplate::kStrictEvalArguments);
1994 }
1995
1991 if (name_token == Token::LET) { 1996 if (name_token == Token::LET) {
1992 classifier->RecordLetPatternError( 1997 classifier->RecordLetPatternError(
1993 scanner()->location(), MessageTemplate::kLetInLexicalBinding); 1998 scanner()->location(), MessageTemplate::kLetInLexicalBinding);
1994 } 1999 }
1995 if (is_await) { 2000 if (is_await) {
1996 if (is_async_function()) { 2001 if (is_async_function()) {
1997 classifier->RecordPatternError( 2002 classifier->RecordPatternError(
1998 Scanner::Location(next_beg_pos, next_end_pos), 2003 Scanner::Location(next_beg_pos, next_end_pos),
1999 MessageTemplate::kAwaitBindingIdentifier); 2004 MessageTemplate::kAwaitBindingIdentifier);
2000 } else { 2005 } else {
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
3728 has_seen_constructor_ = true; 3733 has_seen_constructor_ = true;
3729 return; 3734 return;
3730 } 3735 }
3731 } 3736 }
3732 3737
3733 3738
3734 } // namespace internal 3739 } // namespace internal
3735 } // namespace v8 3740 } // namespace v8
3736 3741
3737 #endif // V8_PARSING_PARSER_BASE_H 3742 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698