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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 void CheckOctalLiteral(int beg_pos, int end_pos, bool is_template, bool* ok) { | 876 void CheckOctalLiteral(int beg_pos, int end_pos, bool is_template, bool* ok) { |
877 Scanner::Location octal = scanner()->octal_position(); | 877 Scanner::Location octal = scanner()->octal_position(); |
878 if (octal.IsValid() && beg_pos <= octal.beg_pos && | 878 if (octal.IsValid() && beg_pos <= octal.beg_pos && |
879 octal.end_pos <= end_pos) { | 879 octal.end_pos <= end_pos) { |
880 MessageTemplate::Template message = | 880 MessageTemplate::Template message = |
881 is_template ? MessageTemplate::kTemplateOctalLiteral | 881 is_template ? MessageTemplate::kTemplateOctalLiteral |
882 : scanner()->octal_message(); | 882 : scanner()->octal_message(); |
883 DCHECK_NE(message, MessageTemplate::kNone); | 883 DCHECK_NE(message, MessageTemplate::kNone); |
884 impl()->ReportMessageAt(octal, message); | 884 impl()->ReportMessageAt(octal, message); |
885 scanner()->clear_octal_position(); | 885 scanner()->clear_octal_position(); |
| 886 if (message == MessageTemplate::kStrictDecimalWithLeadingZero) { |
| 887 impl()->CountUsage(v8::Isolate::kDecimalWithLeadingZeroInStrictMode); |
| 888 } |
886 *ok = false; | 889 *ok = false; |
887 } | 890 } |
888 } | 891 } |
889 // for now, this check just collects statistics. | |
890 void CheckDecimalLiteralWithLeadingZero(int beg_pos, int end_pos) { | |
891 Scanner::Location token_location = | |
892 scanner()->decimal_with_leading_zero_position(); | |
893 if (token_location.IsValid() && beg_pos <= token_location.beg_pos && | |
894 token_location.end_pos <= end_pos) { | |
895 scanner()->clear_decimal_with_leading_zero_position(); | |
896 impl()->CountUsage(v8::Isolate::kDecimalWithLeadingZeroInStrictMode); | |
897 } | |
898 } | |
899 | 892 |
900 inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) { | 893 inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) { |
901 CheckOctalLiteral(beg_pos, end_pos, false, ok); | 894 CheckOctalLiteral(beg_pos, end_pos, false, ok); |
902 } | 895 } |
903 | 896 |
904 inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) { | 897 inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) { |
905 CheckOctalLiteral(beg_pos, end_pos, true, ok); | 898 CheckOctalLiteral(beg_pos, end_pos, true, ok); |
906 } | 899 } |
907 | 900 |
908 void CheckDestructuringElement(ExpressionT element, int beg_pos, int end_pos); | 901 void CheckDestructuringElement(ExpressionT element, int beg_pos, int end_pos); |
(...skipping 4601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5510 has_seen_constructor_ = true; | 5503 has_seen_constructor_ = true; |
5511 return; | 5504 return; |
5512 } | 5505 } |
5513 } | 5506 } |
5514 | 5507 |
5515 | 5508 |
5516 } // namespace internal | 5509 } // namespace internal |
5517 } // namespace v8 | 5510 } // namespace v8 |
5518 | 5511 |
5519 #endif // V8_PARSING_PARSER_BASE_H | 5512 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |