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 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1963 classifier->RecordAsyncArrowFormalParametersError( | 1963 classifier->RecordAsyncArrowFormalParametersError( |
1964 Scanner::Location(next_beg_pos, next_end_pos), | 1964 Scanner::Location(next_beg_pos, next_end_pos), |
1965 MessageTemplate::kAwaitBindingIdentifier); | 1965 MessageTemplate::kAwaitBindingIdentifier); |
1966 } | 1966 } |
1967 } | 1967 } |
1968 ExpressionT lhs = this->ExpressionFromIdentifier( | 1968 ExpressionT lhs = this->ExpressionFromIdentifier( |
1969 *name, next_beg_pos, next_end_pos, scope(), factory()); | 1969 *name, next_beg_pos, next_end_pos, scope(), factory()); |
1970 CheckDestructuringElement(lhs, classifier, next_beg_pos, next_end_pos); | 1970 CheckDestructuringElement(lhs, classifier, next_beg_pos, next_end_pos); |
1971 | 1971 |
1972 ExpressionT value; | 1972 ExpressionT value; |
1973 if (peek() == Token::ASSIGN) { | 1973 if (IsValidReferenceExpression(lhs) && peek() == Token::ASSIGN) { |
Dan Ehrenberg
2016/07/28 00:13:38
Does the insertion of IsValidReferenceExpression(l
| |
1974 Consume(Token::ASSIGN); | 1974 Consume(Token::ASSIGN); |
1975 ExpressionClassifier rhs_classifier(this); | 1975 ExpressionClassifier rhs_classifier(this); |
1976 ExpressionT rhs = this->ParseAssignmentExpression( | 1976 ExpressionT rhs = this->ParseAssignmentExpression( |
1977 true, &rhs_classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 1977 true, &rhs_classifier, CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
1978 Traits::RewriteNonPattern(&rhs_classifier, | 1978 Traits::RewriteNonPattern(&rhs_classifier, |
1979 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); | 1979 CHECK_OK_CUSTOM(EmptyObjectLiteralProperty)); |
1980 classifier->Accumulate(&rhs_classifier, | 1980 classifier->Accumulate(&rhs_classifier, |
1981 ExpressionClassifier::ExpressionProductions); | 1981 ExpressionClassifier::ExpressionProductions); |
1982 value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs, | 1982 value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs, |
1983 kNoSourcePosition); | 1983 kNoSourcePosition); |
1984 classifier->RecordCoverInitializedNameError( | 1984 classifier->RecordCoverInitializedNameError( |
1985 Scanner::Location(next_beg_pos, scanner()->location().end_pos), | 1985 Scanner::Location(next_beg_pos, scanner()->location().end_pos), |
1986 MessageTemplate::kInvalidCoverInitializedName); | 1986 MessageTemplate::kInvalidCoverInitializedName); |
1987 | 1987 |
1988 Traits::SetFunctionNameFromIdentifierRef(rhs, lhs); | 1988 Traits::SetFunctionNameFromIdentifierRef(rhs, lhs); |
1989 } else { | 1989 } else { |
1990 if (this->IsIdentifier(lhs) && is_strict(language_mode()) && | |
1991 this->IsEvalOrArguments(this->AsIdentifier(lhs))) { | |
1992 ReportMessageAt(Scanner::Location(next_beg_pos, next_end_pos), | |
adamk
2016/07/28 18:46:55
I think you should be able to detect this when par
lpy
2016/08/05 22:15:41
Done.
| |
1993 MessageTemplate::kStrictEvalArguments, kSyntaxError); | |
1994 } | |
1990 value = lhs; | 1995 value = lhs; |
1991 } | 1996 } |
1992 | 1997 |
1993 return factory()->NewObjectLiteralProperty( | 1998 return factory()->NewObjectLiteralProperty( |
1994 name_expression, value, ObjectLiteralProperty::COMPUTED, is_static, | 1999 name_expression, value, ObjectLiteralProperty::COMPUTED, is_static, |
1995 false); | 2000 false); |
1996 } | 2001 } |
1997 } | 2002 } |
1998 | 2003 |
1999 // Method definitions are never valid in patterns. | 2004 // Method definitions are never valid in patterns. |
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3657 has_seen_constructor_ = true; | 3662 has_seen_constructor_ = true; |
3658 return; | 3663 return; |
3659 } | 3664 } |
3660 } | 3665 } |
3661 | 3666 |
3662 | 3667 |
3663 } // namespace internal | 3668 } // namespace internal |
3664 } // namespace v8 | 3669 } // namespace v8 |
3665 | 3670 |
3666 #endif // V8_PARSING_PARSER_BASE_H | 3671 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |