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/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 4313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4324 ReportMessageAt(Scanner::Location(beg_pos, end_pos), | 4324 ReportMessageAt(Scanner::Location(beg_pos, end_pos), |
4325 MessageTemplate::kStrictEvalArguments, kSyntaxError); | 4325 MessageTemplate::kStrictEvalArguments, kSyntaxError); |
4326 *ok = false; | 4326 *ok = false; |
4327 return impl()->EmptyExpression(); | 4327 return impl()->EmptyExpression(); |
4328 } | 4328 } |
4329 if (expression->IsValidReferenceExpression()) { | 4329 if (expression->IsValidReferenceExpression()) { |
4330 return expression; | 4330 return expression; |
4331 } | 4331 } |
4332 if (expression->IsCall()) { | 4332 if (expression->IsCall()) { |
4333 // If it is a call, make it a runtime error for legacy web compatibility. | 4333 // If it is a call, make it a runtime error for legacy web compatibility. |
4334 // Rewrite `expr' to `expr[throw ReferenceError]'. | 4334 // Rewrite `expr' to `expr[throw ReferenceError]'. |
Dan Ehrenberg
2016/12/23 07:56:52
Could you put a reference to https://bugs.chromium
bakkot1
2016/12/23 09:41:53
Done.
| |
4335 impl()->CountUsage( | |
4336 is_strict(language_mode()) | |
Dan Ehrenberg
2016/12/23 07:56:52
Aren't you glad we don't have strong mode?
| |
4337 ? v8::Isolate::kAssigmentExpressionLHSIsCallInStrict | |
4338 : v8::Isolate::kAssigmentExpressionLHSIsCallInNonstrict); | |
4335 ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos); | 4339 ExpressionT error = impl()->NewThrowReferenceError(message, beg_pos); |
4336 return factory()->NewProperty(expression, error, beg_pos); | 4340 return factory()->NewProperty(expression, error, beg_pos); |
4337 } | 4341 } |
4338 ReportMessageAt(Scanner::Location(beg_pos, end_pos), message, type); | 4342 ReportMessageAt(Scanner::Location(beg_pos, end_pos), message, type); |
4339 *ok = false; | 4343 *ok = false; |
4340 return impl()->EmptyExpression(); | 4344 return impl()->EmptyExpression(); |
4341 } | 4345 } |
4342 | 4346 |
4343 template <typename Impl> | 4347 template <typename Impl> |
4344 bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) { | 4348 bool ParserBase<Impl>::IsValidReferenceExpression(ExpressionT expression) { |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5493 has_seen_constructor_ = true; | 5497 has_seen_constructor_ = true; |
5494 return; | 5498 return; |
5495 } | 5499 } |
5496 } | 5500 } |
5497 | 5501 |
5498 | 5502 |
5499 } // namespace internal | 5503 } // namespace internal |
5500 } // namespace v8 | 5504 } // namespace v8 |
5501 | 5505 |
5502 #endif // V8_PARSING_PARSER_BASE_H | 5506 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |