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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 ParserBase* parser_; | 637 ParserBase* parser_; |
638 }; | 638 }; |
639 | 639 |
640 // Validation per ES6 object literals. | 640 // Validation per ES6 object literals. |
641 class ObjectLiteralChecker : public ObjectLiteralCheckerBase { | 641 class ObjectLiteralChecker : public ObjectLiteralCheckerBase { |
642 public: | 642 public: |
643 explicit ObjectLiteralChecker(ParserBase* parser) | 643 explicit ObjectLiteralChecker(ParserBase* parser) |
644 : ObjectLiteralCheckerBase(parser), has_seen_proto_(false) {} | 644 : ObjectLiteralCheckerBase(parser), has_seen_proto_(false) {} |
645 | 645 |
646 void CheckProperty(Token::Value property, PropertyKind type, bool is_static, | 646 void CheckProperty(Token::Value property, PropertyKind type, bool is_static, |
647 bool is_generator, bool* ok) OVERRIDE; | 647 bool is_generator, bool* ok) override; |
648 | 648 |
649 private: | 649 private: |
650 bool IsProto() { return this->scanner()->LiteralMatches("__proto__", 9); } | 650 bool IsProto() { return this->scanner()->LiteralMatches("__proto__", 9); } |
651 | 651 |
652 bool has_seen_proto_; | 652 bool has_seen_proto_; |
653 }; | 653 }; |
654 | 654 |
655 // Validation per ES6 class literals. | 655 // Validation per ES6 class literals. |
656 class ClassLiteralChecker : public ObjectLiteralCheckerBase { | 656 class ClassLiteralChecker : public ObjectLiteralCheckerBase { |
657 public: | 657 public: |
658 explicit ClassLiteralChecker(ParserBase* parser) | 658 explicit ClassLiteralChecker(ParserBase* parser) |
659 : ObjectLiteralCheckerBase(parser), has_seen_constructor_(false) {} | 659 : ObjectLiteralCheckerBase(parser), has_seen_constructor_(false) {} |
660 | 660 |
661 void CheckProperty(Token::Value property, PropertyKind type, bool is_static, | 661 void CheckProperty(Token::Value property, PropertyKind type, bool is_static, |
662 bool is_generator, bool* ok) OVERRIDE; | 662 bool is_generator, bool* ok) override; |
663 | 663 |
664 private: | 664 private: |
665 bool IsConstructor() { | 665 bool IsConstructor() { |
666 return this->scanner()->LiteralMatches("constructor", 11); | 666 return this->scanner()->LiteralMatches("constructor", 11); |
667 } | 667 } |
668 bool IsPrototype() { | 668 bool IsPrototype() { |
669 return this->scanner()->LiteralMatches("prototype", 9); | 669 return this->scanner()->LiteralMatches("prototype", 9); |
670 } | 670 } |
671 | 671 |
672 bool has_seen_constructor_; | 672 bool has_seen_constructor_; |
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3341 *ok = false; | 3341 *ok = false; |
3342 return; | 3342 return; |
3343 } | 3343 } |
3344 has_seen_constructor_ = true; | 3344 has_seen_constructor_ = true; |
3345 return; | 3345 return; |
3346 } | 3346 } |
3347 } | 3347 } |
3348 } } // v8::internal | 3348 } } // v8::internal |
3349 | 3349 |
3350 #endif // V8_PREPARSER_H | 3350 #endif // V8_PREPARSER_H |
OLD | NEW |