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 ++use_counts[v8::Isolate::kDecimalWithLeadingZeroInStrictMode]; |
| 630 } |
| 631 } |
621 | 632 |
622 inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) { | 633 inline void CheckStrictOctalLiteral(int beg_pos, int end_pos, bool* ok) { |
623 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kStrictOctalLiteral, | 634 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kStrictOctalLiteral, |
624 ok); | 635 ok); |
625 } | 636 } |
626 | 637 |
627 inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) { | 638 inline void CheckTemplateOctalLiteral(int beg_pos, int end_pos, bool* ok) { |
628 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kTemplateOctalLiteral, | 639 CheckOctalLiteral(beg_pos, end_pos, MessageTemplate::kTemplateOctalLiteral, |
629 ok); | 640 ok); |
630 } | 641 } |
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3311 has_seen_constructor_ = true; | 3322 has_seen_constructor_ = true; |
3312 return; | 3323 return; |
3313 } | 3324 } |
3314 } | 3325 } |
3315 | 3326 |
3316 | 3327 |
3317 } // namespace internal | 3328 } // namespace internal |
3318 } // namespace v8 | 3329 } // namespace v8 |
3319 | 3330 |
3320 #endif // V8_PARSING_PARSER_BASE_H | 3331 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |