C++: Un-nest the if-then-else sequence.

This commit is contained in:
Anders Schack-Mulligen
2025-01-30 13:28:44 +01:00
parent d6f9eb2953
commit 15171eb1a5

View File

@@ -148,119 +148,81 @@ class HashCons extends HCBase {
/** Gets the kind of the HC. This can be useful for debugging. */ /** Gets the kind of the HC. This can be useful for debugging. */
string getKind() { string getKind() {
if this instanceof HC_IntLiteral result = this.getKind0()
then result = "IntLiteral" or
else not exists(this.getKind0()) and result = "error"
if this instanceof HC_EnumConstantAccess }
then result = "EnumConstantAccess"
else private string getKind0() {
if this instanceof HC_FloatLiteral this instanceof HC_IntLiteral and result = "IntLiteral"
then result = "FloatLiteral" or
else this instanceof HC_EnumConstantAccess and result = "EnumConstantAccess"
if this instanceof HC_StringLiteral or
then result = "StringLiteral" this instanceof HC_FloatLiteral and result = "FloatLiteral"
else or
if this instanceof HC_Nullptr this instanceof HC_StringLiteral and result = "StringLiteral"
then result = "Nullptr" or
else this instanceof HC_Nullptr and result = "Nullptr"
if this instanceof HC_Variable or
then result = "Variable" this instanceof HC_Variable and result = "Variable"
else or
if this instanceof HC_FieldAccess this instanceof HC_FieldAccess and result = "FieldAccess"
then result = "FieldAccess" or
else this instanceof HC_Deref and result = "Deref"
if this instanceof HC_Deref or
then result = "Deref" this instanceof HC_ThisExpr and result = "ThisExpr"
else or
if this instanceof HC_ThisExpr this instanceof HC_Conversion and result = "Conversion"
then result = "ThisExpr" or
else this instanceof HC_BinaryOp and result = "BinaryOp"
if this instanceof HC_Conversion or
then result = "Conversion" this instanceof HC_UnaryOp and result = "UnaryOp"
else or
if this instanceof HC_BinaryOp this instanceof HC_ArrayAccess and result = "ArrayAccess"
then result = "BinaryOp" or
else this instanceof HC_Unanalyzable and result = "Unanalyzable"
if this instanceof HC_UnaryOp or
then result = "UnaryOp" this instanceof HC_NonmemberFunctionCall and result = "NonmemberFunctionCall"
else or
if this instanceof HC_ArrayAccess this instanceof HC_MemberFunctionCall and result = "MemberFunctionCall"
then result = "ArrayAccess" or
else this instanceof HC_NewExpr and result = "NewExpr"
if this instanceof HC_Unanalyzable or
then result = "Unanalyzable" this instanceof HC_NewArrayExpr and result = "NewArrayExpr"
else or
if this instanceof HC_NonmemberFunctionCall this instanceof HC_SizeofType and result = "SizeofTypeOperator"
then result = "NonmemberFunctionCall" or
else this instanceof HC_SizeofExpr and result = "SizeofExprOperator"
if this instanceof HC_MemberFunctionCall or
then result = "MemberFunctionCall" this instanceof HC_AlignofType and result = "AlignofTypeOperator"
else or
if this instanceof HC_NewExpr this instanceof HC_AlignofExpr and result = "AlignofExprOperator"
then result = "NewExpr" or
else this instanceof HC_UuidofOperator and result = "UuidofOperator"
if this instanceof HC_NewArrayExpr or
then result = "NewArrayExpr" this instanceof HC_TypeidType and result = "TypeidType"
else or
if this instanceof HC_SizeofType this instanceof HC_TypeidExpr and result = "TypeidExpr"
then result = "SizeofTypeOperator" or
else this instanceof HC_ArrayAggregateLiteral and result = "ArrayAggregateLiteral"
if this instanceof HC_SizeofExpr or
then result = "SizeofExprOperator" this instanceof HC_ClassAggregateLiteral and result = "ClassAggregateLiteral"
else or
if this instanceof HC_AlignofType this instanceof HC_DeleteExpr and result = "DeleteExpr"
then result = "AlignofTypeOperator" or
else this instanceof HC_DeleteArrayExpr and result = "DeleteArrayExpr"
if this instanceof HC_AlignofExpr or
then result = "AlignofExprOperator" this instanceof HC_ThrowExpr and result = "ThrowExpr"
else or
if this instanceof HC_UuidofOperator this instanceof HC_ReThrowExpr and result = "ReThrowExpr"
then result = "UuidofOperator" or
else this instanceof HC_ExprCall and result = "ExprCall"
if this instanceof HC_TypeidType or
then result = "TypeidType" this instanceof HC_ConditionalExpr and result = "ConditionalExpr"
else or
if this instanceof HC_TypeidExpr this instanceof HC_NoExceptExpr and result = "NoExceptExpr"
then result = "TypeidExpr" or
else this instanceof HC_AllocatorArgZero and result = "AllocatorArgZero"
if this instanceof HC_ArrayAggregateLiteral
then result = "ArrayAggregateLiteral"
else
if this instanceof HC_ClassAggregateLiteral
then result = "ClassAggregateLiteral"
else
if this instanceof HC_DeleteExpr
then result = "DeleteExpr"
else
if this instanceof HC_DeleteArrayExpr
then result = "DeleteArrayExpr"
else
if this instanceof HC_ThrowExpr
then result = "ThrowExpr"
else
if this instanceof HC_ReThrowExpr
then result = "ReThrowExpr"
else
if this instanceof HC_ExprCall
then result = "ExprCall"
else
if
this instanceof
HC_ConditionalExpr
then result = "ConditionalExpr"
else
if
this instanceof
HC_NoExceptExpr
then result = "NoExceptExpr"
else
if
this instanceof
HC_AllocatorArgZero
then
result =
"AllocatorArgZero"
else result = "error"
} }
/** /**