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/func-name-inferrer.h" | 10 #include "src/func-name-inferrer.h" |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
669 PreParserIdentifier AsIdentifier() const { | 669 PreParserIdentifier AsIdentifier() const { |
670 ASSERT(IsIdentifier()); | 670 ASSERT(IsIdentifier()); |
671 return PreParserIdentifier( | 671 return PreParserIdentifier( |
672 static_cast<PreParserIdentifier::Type>(code_ >> kIdentifierShift)); | 672 static_cast<PreParserIdentifier::Type>(code_ >> kIdentifierShift)); |
673 } | 673 } |
674 | 674 |
675 bool IsStringLiteral() const { | 675 bool IsStringLiteral() const { |
676 return (code_ & kTypeMask) == kTypeStringLiteral; | 676 return (code_ & kTypeMask) == kTypeStringLiteral; |
677 } | 677 } |
678 | 678 |
679 bool IsUseStrictLiteral() { | 679 bool IsUseStrictLiteral() const { |
680 return (code_ & kUseStrictString) == kUseStrictString; | 680 return (code_ & kUseStrictString) == kUseStrictString; |
681 } | 681 } |
682 | 682 |
683 bool IsThis() { return code_ == kThisExpression; } | 683 bool IsThis() const { return (code_ & kThisExpression) == kThisExpression; } |
wingo
2014/07/23 12:54:55
Since the kThisExpression et al are just bitflags
Sven Panne
2014/07/23 13:26:05
For consistency, I would leave it as it is. All th
| |
684 | 684 |
685 bool IsThisProperty() { return code_ == kThisPropertyExpression; } | 685 bool IsThisProperty() const { |
686 | 686 return (code_ & kThisPropertyExpression) == kThisPropertyExpression; |
687 bool IsProperty() { | |
688 return code_ == kPropertyExpression || code_ == kThisPropertyExpression; | |
689 } | 687 } |
690 | 688 |
691 bool IsCall() { return code_ == kCallExpression; } | 689 bool IsProperty() const { |
690 return (code_ & kPropertyExpression) == kPropertyExpression || | |
691 (code_ & kThisPropertyExpression) == kThisPropertyExpression; | |
692 } | |
692 | 693 |
693 bool IsValidReferenceExpression() { | 694 bool IsCall() const { return (code_ & kCallExpression) == kCallExpression; } |
695 | |
696 bool IsValidReferenceExpression() const { | |
694 return IsIdentifier() || IsProperty(); | 697 return IsIdentifier() || IsProperty(); |
695 } | 698 } |
696 | 699 |
697 bool IsValidArrowParamList() const { | 700 bool IsValidArrowParamList() const { |
698 return (ArrowParamListBit() & kBinaryOperationArrowParamList) != 0 && | 701 return (ArrowParamListBit() & kBinaryOperationArrowParamList) != 0 && |
699 (code_ & kMultiParenthesizedExpression) == 0; | 702 (code_ & kMultiParenthesizedExpression) == 0; |
700 } | 703 } |
701 | 704 |
702 // At the moment PreParser doesn't track these expression types. | 705 // At the moment PreParser doesn't track these expression types. |
703 bool IsFunctionLiteral() const { return false; } | 706 bool IsFunctionLiteral() const { return false; } |
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2616 parser()->ReportMessage("accessor_get_set"); | 2619 parser()->ReportMessage("accessor_get_set"); |
2617 } | 2620 } |
2618 *ok = false; | 2621 *ok = false; |
2619 } | 2622 } |
2620 } | 2623 } |
2621 | 2624 |
2622 | 2625 |
2623 } } // v8::internal | 2626 } } // v8::internal |
2624 | 2627 |
2625 #endif // V8_PREPARSER_H | 2628 #endif // V8_PREPARSER_H |
OLD | NEW |