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/hashmap.h" | 10 #include "src/hashmap.h" |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 void CheckOctalLiteral(int beg_pos, int end_pos, | 611 void CheckOctalLiteral(int beg_pos, int end_pos, |
612 MessageTemplate::Template message, bool* ok) { | 612 MessageTemplate::Template message, bool* ok) { |
613 Scanner::Location octal = scanner()->octal_position(); | 613 Scanner::Location octal = scanner()->octal_position(); |
614 if (octal.IsValid() && beg_pos <= octal.beg_pos && | 614 if (octal.IsValid() && beg_pos <= octal.beg_pos && |
615 octal.end_pos <= end_pos) { | 615 octal.end_pos <= end_pos) { |
616 ReportMessageAt(octal, message); | 616 ReportMessageAt(octal, message); |
617 scanner()->clear_octal_position(); | 617 scanner()->clear_octal_position(); |
618 *ok = false; | 618 *ok = false; |
619 } | 619 } |
620 } | 620 } |
621 // for now, this check just collects statistics. | |
622 void CheckDecimalLiteralWithLeadingZero(int* use_counts, int beg_pos, | |
623 int end_pos) { | |
624 Scanner::Location token_location = | |
625 scanner()->decimal_with_leading_zero_position(); | |
626 if (token_location.IsValid() && beg_pos <= token_location.beg_pos && | |
627 token_location.end_pos <= end_pos) { | |
628 scanner()->clear_decimal_with_leading_zero_position(); | |
629 if (use_counts != nullptr) | |
630 ++use_counts[v8::Isolate::kDecimalWithLeadingZeroInStrictMode]; | |
631 } | |
632 } | |
633 | 621 |
634 inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) { | 622 inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) { |
635 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kStrictOctalLiteral, | 623 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kStrictOctalLiteral, |
636 ok); | 624 ok); |
637 } | 625 } |
638 | 626 |
639 inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) { | 627 inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) { |
640 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kTemplateOctalLiteral, | 628 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kTemplateOctalLiteral, |
641 ok); | 629 ok); |
642 } | 630 } |
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3323 has_seen_constructor_ = true; | 3311 has_seen_constructor_ = true; |
3324 return; | 3312 return; |
3325 } | 3313 } |
3326 } | 3314 } |
3327 | 3315 |
3328 | 3316 |
3329 } // namespace internal | 3317 } // namespace internal |
3330 } // namespace v8 | 3318 } // namespace v8 |
3331 | 3319 |
3332 #endif // V8_PARSING_PARSER_BASE_H | 3320 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |