1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Changed "IsTypeStruct() || IsTypeUnion()" expressions into shorter "IsClassStruct()" expressions.

Type-classes are groups of types that can be handled in the same way (similar syntax).
This commit is contained in:
Greg King 2020-07-19 14:30:22 -04:00
parent ee208aecd6
commit fd0a6955da
3 changed files with 5 additions and 5 deletions

View File

@ -396,7 +396,7 @@ static unsigned FunctionParamList (FuncDesc* Func, int IsFastcall)
}
/* Handle struct/union specially */
if (IsTypeStruct (Expr.Type) || IsTypeUnion (Expr.Type)) {
if (IsClassStruct (Expr.Type)) {
/* Use the replacement type */
Flags |= TypeOf (GetStructReplacementType (Expr.Type));
} else {
@ -658,7 +658,7 @@ static void FunctionCall (ExprDesc* Expr)
ReturnType = GetFuncReturn (Expr->Type);
/* Handle struct/union specially */
if (IsTypeStruct (ReturnType) || IsTypeUnion (ReturnType)) {
if (IsClassStruct (ReturnType)) {
/* If there is no replacement type, then it is just the address */
if (ReturnType == GetStructReplacementType (ReturnType)) {
/* Dereference it */

View File

@ -477,7 +477,7 @@ void NewFunc (SymEntry* Func)
Flags = CF_PTR;
} else {
/* Handle struct/union specially */
if (IsTypeStruct (D->LastParam->Type) || IsTypeUnion (D->LastParam->Type)) {
if (IsClassStruct (D->LastParam->Type)) {
Flags = TypeOf (GetStructReplacementType (D->LastParam->Type)) | CF_FORCECHAR;
} else {
Flags = TypeOf (D->LastParam->Type) | CF_FORCECHAR;
@ -506,7 +506,7 @@ void NewFunc (SymEntry* Func)
/* Check if we need copy for struct/union type */
RType = Param->Type;
if (IsTypeStruct (RType) || IsTypeUnion (RType)) {
if (IsClassStruct (RType)) {
RType = GetStructReplacementType (RType);
/* If there is no replacement type, then it is just the address.

View File

@ -329,7 +329,7 @@ static void ReturnStatement (void)
TypeConversion (&Expr, F_GetReturnType (CurrentFunc));
/* Load the value into the primary */
if (IsTypeStruct (Expr.Type) || IsTypeUnion (Expr.Type)) {
if (IsClassStruct (Expr.Type)) {
/* Handle struct/union specially */
ReturnType = GetStructReplacementType (Expr.Type);
if (ReturnType == Expr.Type) {