| 736 | using BaseType = T; |
| 737 | |
| 738 | static constexpr CTypeInfo Build() { |
| 739 | constexpr CTypeInfo::Flags kFlags = |
| 740 | MergeFlags(internal::TypeInfoHelper<T>::Flags(), Flags...); |
| 741 | constexpr CTypeInfo::Type kType = internal::TypeInfoHelper<T>::Type(); |
| 742 | constexpr CTypeInfo::SequenceType kSequenceType = |
| 743 | internal::TypeInfoHelper<T>::SequenceType(); |
| 744 | |
| 745 | STATIC_ASSERT_IMPLIES( |
| 746 | uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kAllowSharedBit), |
| 747 | (kSequenceType == CTypeInfo::SequenceType::kIsTypedArray || |
| 748 | kSequenceType == CTypeInfo::SequenceType::kIsArrayBuffer), |
| 749 | "kAllowSharedBit is only allowed for TypedArrays and ArrayBuffers."); |
| 750 | STATIC_ASSERT_IMPLIES( |
| 751 | uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kEnforceRangeBit), |
| 752 | CTypeInfo::IsIntegralType(kType), |
| 753 | "kEnforceRangeBit is only allowed for integral types."); |
| 754 | STATIC_ASSERT_IMPLIES( |
| 755 | uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kClampBit), |
| 756 | CTypeInfo::IsIntegralType(kType), |
| 757 | "kClampBit is only allowed for integral types."); |
| 758 | STATIC_ASSERT_IMPLIES( |
| 759 | uint8_t(kFlags) & uint8_t(CTypeInfo::Flags::kIsRestrictedBit), |
| 760 | CTypeInfo::IsFloatingPointType(kType), |
| 761 | "kIsRestrictedBit is only allowed for floating point types."); |
| 762 | STATIC_ASSERT_IMPLIES(kSequenceType == CTypeInfo::SequenceType::kIsSequence, |
| 763 | kType == CTypeInfo::Type::kVoid, |
| 764 | "Sequences are only supported from void type."); |
| 765 | STATIC_ASSERT_IMPLIES( |
| 766 | kSequenceType == CTypeInfo::SequenceType::kIsTypedArray, |
| 767 | CTypeInfo::IsPrimitive(kType) || kType == CTypeInfo::Type::kVoid, |
| 768 | "TypedArrays are only supported from primitive types or void."); |
| 769 | |
| 770 | // Return the same type with the merged flags. |
| 771 | return CTypeInfo(internal::TypeInfoHelper<T>::Type(), |
| 772 | internal::TypeInfoHelper<T>::SequenceType(), kFlags); |
| 773 | } |
| 774 | |
| 775 | private: |
| 776 | template <typename... Rest> |
no test coverage detected