Code::is_equal reduction

This commit is contained in:
2024-12-02 00:34:40 -05:00
parent 5cd69e1742
commit 2b24511f7d
5 changed files with 42 additions and 300 deletions

View File

@ -7,15 +7,6 @@
#pragma region generated code inline implementation
inline bool Code::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool Code::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -47,15 +38,6 @@ inline Code::operator bool()
return ast != nullptr;
}
inline bool CodeBody::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeBody::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -87,15 +69,6 @@ inline CodeBody::operator bool()
return ast != nullptr;
}
inline bool CodeAttributes::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeAttributes::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -147,15 +120,6 @@ inline AST_Attributes* CodeAttributes::operator->()
return ast;
}
inline bool CodeComment::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeComment::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -207,15 +171,6 @@ inline AST_Comment* CodeComment::operator->()
return ast;
}
inline bool CodeConstructor::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeConstructor::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -267,15 +222,6 @@ inline AST_Constructor* CodeConstructor::operator->()
return ast;
}
inline bool CodeClass::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeClass::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -307,15 +253,6 @@ inline CodeClass::operator bool()
return ast != nullptr;
}
inline bool CodeDefine::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeDefine::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -367,15 +304,6 @@ inline AST_Define* CodeDefine::operator->()
return ast;
}
inline bool CodeDestructor::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeDestructor::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -427,15 +355,6 @@ inline AST_Destructor* CodeDestructor::operator->()
return ast;
}
inline bool CodeEnum::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeEnum::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -487,15 +406,6 @@ inline AST_Enum* CodeEnum::operator->()
return ast;
}
inline bool CodeExec::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeExec::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -547,15 +457,6 @@ inline AST_Exec* CodeExec::operator->()
return ast;
}
inline bool CodeExtern::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeExtern::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -607,15 +508,6 @@ inline AST_Extern* CodeExtern::operator->()
return ast;
}
inline bool CodeFriend::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeFriend::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -667,15 +559,6 @@ inline AST_Friend* CodeFriend::operator->()
return ast;
}
inline bool CodeFn::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeFn::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -727,15 +610,6 @@ inline AST_Fn* CodeFn::operator->()
return ast;
}
inline bool CodeInclude::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeInclude::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -787,15 +661,6 @@ inline AST_Include* CodeInclude::operator->()
return ast;
}
inline bool CodeModule::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeModule::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -847,15 +712,6 @@ inline AST_Module* CodeModule::operator->()
return ast;
}
inline bool CodeNS::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeNS::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -907,15 +763,6 @@ inline AST_NS* CodeNS::operator->()
return ast;
}
inline bool CodeOperator::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeOperator::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -967,15 +814,6 @@ inline AST_Operator* CodeOperator::operator->()
return ast;
}
inline bool CodeOpCast::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeOpCast::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1027,15 +865,6 @@ inline AST_OpCast* CodeOpCast::operator->()
return ast;
}
inline bool CodeParam::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeParam::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1067,15 +896,6 @@ inline CodeParam::operator bool()
return ast != nullptr;
}
inline bool CodePragma::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodePragma::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1127,15 +947,6 @@ inline AST_Pragma* CodePragma::operator->()
return ast;
}
inline bool CodePreprocessCond::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodePreprocessCond::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1187,15 +998,6 @@ inline AST_PreprocessCond* CodePreprocessCond::operator->()
return ast;
}
inline bool CodeSpecifiers::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeSpecifiers::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1227,15 +1029,6 @@ inline CodeSpecifiers::operator bool()
return ast != nullptr;
}
inline bool CodeStruct::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeStruct::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1267,15 +1060,6 @@ inline CodeStruct::operator bool()
return ast != nullptr;
}
inline bool CodeTemplate::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeTemplate::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1327,15 +1111,6 @@ inline AST_Template* CodeTemplate::operator->()
return ast;
}
inline bool CodeType::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeType::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1387,15 +1162,6 @@ inline AST_Type* CodeType::operator->()
return ast;
}
inline bool CodeTypedef::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeTypedef::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1447,15 +1213,6 @@ inline AST_Typedef* CodeTypedef::operator->()
return ast;
}
inline bool CodeUnion::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeUnion::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1507,15 +1264,6 @@ inline AST_Union* CodeUnion::operator->()
return ast;
}
inline bool CodeUsing::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeUsing::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;
@ -1567,15 +1315,6 @@ inline AST_Using* CodeUsing::operator->()
return ast;
}
inline bool CodeVar::is_equal( Code other )
{
if ( ast == nullptr || other.ast == nullptr )
{
return ast == nullptr && other.ast == nullptr;
}
return rcast( AST*, ast )->is_equal( other.ast );
}
inline bool CodeVar::is_valid()
{
return (AST*)ast != nullptr && rcast( AST*, ast )->Type != CodeT::Invalid;