Adjustment to AST::is_equal based on issues found with last CS.

Defined check_member_content, will spit out the strings if they aren't equivalent so the user can verify for themselves if its correct.
This commit is contained in:
Edward R. Gonzalez 2023-08-25 18:57:53 -04:00
parent 9b6dc3cbd8
commit abf51e4aa9
2 changed files with 25 additions and 12 deletions

View File

@ -1005,6 +1005,25 @@ bool AST::is_equal( AST* other )
return false; \
}
#define check_member_content( content ) \
if ( content != other->content ) \
{ \
log_fmt("AST::is_equal: Member content - "#content " failed\n" \
"AST : %S\n" \
"Other: %S\n" \
, debug_str() \
, other->debug_str() \
); \
\
log_fmt("Content cannot be trusted to be unique with this check " \
"so it must be verified by eye for now\n" \
"AST Content:\n%S\n" \
"Other Content:\n%S\n" \
, content \
, other->content \
); \
}
#define check_member_ast( ast ) \
if ( ast ) \
{ \
@ -1039,12 +1058,6 @@ bool AST::is_equal( AST* other )
} \
}
// Need to check to make sure the prev->is_equal wont lead to a recursion.
// #define check_member_prev() \
// if ( Prev ) \
// { \
case NewLine:
case Access_Public:
case Access_Protected:
@ -1058,7 +1071,7 @@ bool AST::is_equal( AST* other )
case PlatformAttributes:
case Untyped:
{
check_member_str( Content );
check_member_content( Content );
// check_member_ast( Prev );
// check_member_ast( Next );
}
@ -1340,7 +1353,7 @@ bool AST::is_equal( AST* other )
case Preprocess_Define:
{
check_member_str( Name );
check_member_str( Content );
check_member_content( Content );
// check_member_ast( Prev );
// check_member_ast( Next );
@ -1352,7 +1365,7 @@ bool AST::is_equal( AST* other )
case Preprocess_IfNotDef:
case Preprocess_ElIf:
{
check_member_str( Content );
check_member_content( Content );
// check_member_ast( Prev );
// check_member_ast( Next );
@ -1362,7 +1375,7 @@ bool AST::is_equal( AST* other )
case Preprocess_Include:
case Preprocess_Pragma:
{
check_member_str( Content );
check_member_content( Content );
// check_member_ast( Prev );
// check_member_ast( Next );

View File

@ -4502,7 +4502,7 @@ CodeType parse_type( bool* is_function )
brute_sig.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)brute_sig.Text;
is_first_capture = false;
}
bool is_param_pack = false;
if ( check(TokType::Varadic_Argument) )
{
@ -4534,7 +4534,7 @@ CodeType parse_type( bool* is_function )
if ( attributes )
result->Attributes = attributes;
if ( is_param_pack )
result->IsParamPack = true;