Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1954 ExpressionT name_expression = ParsePropertyName( | 1954 ExpressionT name_expression = ParsePropertyName( |
| 1955 name, &is_get, &is_set, &is_await, is_computed_name, classifier, | 1955 name, &is_get, &is_set, &is_await, is_computed_name, classifier, |
| 1956 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 1956 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 1957 | 1957 |
| 1958 if (fni_ != nullptr && !*is_computed_name) { | 1958 if (fni_ != nullptr && !*is_computed_name) { |
| 1959 this->PushLiteralName(fni_, *name); | 1959 this->PushLiteralName(fni_, *name); |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 if (!in_class && !is_generator) { | 1962 if (!in_class && !is_generator) { |
| 1963 DCHECK(!IsStaticMethod(method_kind)); | 1963 DCHECK(!IsStaticMethod(method_kind)); |
| 1964 | |
| 1965 if (peek() == Token::COLON) { | 1964 if (peek() == Token::COLON) { |
| 1966 // PropertyDefinition | 1965 // PropertyDefinition |
| 1967 // PropertyName ':' AssignmentExpression | 1966 // PropertyName ':' AssignmentExpression |
| 1968 if (!*is_computed_name) { | 1967 if (!*is_computed_name) { |
| 1969 checker->CheckProperty(name_token, kValueProperty, MethodKind::Normal, | 1968 checker->CheckProperty(name_token, kValueProperty, MethodKind::Normal, |
| 1970 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 1969 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
| 1971 } | 1970 } |
| 1972 Consume(Token::COLON); | 1971 Consume(Token::COLON); |
| 1973 int beg_pos = peek_position(); | 1972 int beg_pos = peek_position(); |
| 1974 ExpressionT value = this->ParseAssignmentExpression( | 1973 ExpressionT value = this->ParseAssignmentExpression( |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1987 // PropertyDefinition | 1986 // PropertyDefinition |
| 1988 // IdentifierReference | 1987 // IdentifierReference |
| 1989 // CoverInitializedName | 1988 // CoverInitializedName |
| 1990 // | 1989 // |
| 1991 // CoverInitializedName | 1990 // CoverInitializedName |
| 1992 // IdentifierReference Initializer? | 1991 // IdentifierReference Initializer? |
| 1993 if (classifier->duplicate_finder() != nullptr && | 1992 if (classifier->duplicate_finder() != nullptr && |
| 1994 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { | 1993 scanner()->FindSymbol(classifier->duplicate_finder(), 1) != 0) { |
| 1995 classifier->RecordDuplicateFormalParameterError(scanner()->location()); | 1994 classifier->RecordDuplicateFormalParameterError(scanner()->location()); |
| 1996 } | 1995 } |
| 1996 | |
| 1997 if (this->IsEvalOrArguments(*name)) { | |
| 1998 classifier->RecordStrictModeFormalParameterError( | |
|
adamk
2016/08/17 19:32:51
Can you explain why this is needed? In particular,
lpy
2016/08/19 17:00:40
My mistakes. My understanding is when we enter Pro
| |
| 1999 scanner()->location(), MessageTemplate::kStrictEvalArguments); | |
| 2000 if (is_strict(language_mode())) { | |
| 2001 classifier->RecordBindingPatternError( | |
| 2002 scanner()->location(), MessageTemplate::kStrictEvalArguments); | |
| 2003 } | |
| 2004 } | |
| 2005 | |
| 1997 if (name_token == Token::LET) { | 2006 if (name_token == Token::LET) { |
| 1998 classifier->RecordLetPatternError( | 2007 classifier->RecordLetPatternError( |
| 1999 scanner()->location(), MessageTemplate::kLetInLexicalBinding); | 2008 scanner()->location(), MessageTemplate::kLetInLexicalBinding); |
| 2000 } | 2009 } |
| 2001 if (is_await) { | 2010 if (is_await) { |
| 2002 if (is_async_function()) { | 2011 if (is_async_function()) { |
| 2003 classifier->RecordPatternError( | 2012 classifier->RecordPatternError( |
| 2004 Scanner::Location(next_beg_pos, next_end_pos), | 2013 Scanner::Location(next_beg_pos, next_end_pos), |
| 2005 MessageTemplate::kAwaitBindingIdentifier); | 2014 MessageTemplate::kAwaitBindingIdentifier); |
| 2006 } else { | 2015 } else { |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3734 has_seen_constructor_ = true; | 3743 has_seen_constructor_ = true; |
| 3735 return; | 3744 return; |
| 3736 } | 3745 } |
| 3737 } | 3746 } |
| 3738 | 3747 |
| 3739 | 3748 |
| 3740 } // namespace internal | 3749 } // namespace internal |
| 3741 } // namespace v8 | 3750 } // namespace v8 |
| 3742 | 3751 |
| 3743 #endif // V8_PARSING_PARSER_BASE_H | 3752 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |