diff --git a/GenC.fu b/GenC.fu index 574a629c..bc165dab 100644 --- a/GenC.fu +++ b/GenC.fu @@ -2027,8 +2027,8 @@ public class GenC : GenCCpp if (parent > FuPriority.Add) WriteChar('('); Write("(const "); - FuType elementType2 = obj.Type.AsClassType().GetElementType(); - WriteType(elementType2, false); + FuType elementType = obj.Type.AsClassType().GetElementType(); + WriteType(elementType, false); Write(" *) bsearch(&"); args[0].Accept(this, FuPriority.Primary); // TODO: not lvalue, promoted Write(", "); @@ -2041,7 +2041,7 @@ public class GenC : GenCCpp WriteArrayStorageLength(obj); else args[2].Accept(this, FuPriority.Argument); - WriteSizeofCompare(elementType2); + WriteSizeofCompare(elementType); Write(" - "); WriteArrayPtr(obj, FuPriority.Mul); if (parent > FuPriority.Add) @@ -2059,20 +2059,20 @@ public class GenC : GenCCpp case FuId.ArrayCopyTo: case FuId.ListCopyTo: Include("string.h"); - FuType elementType = obj.Type.AsClassType().GetElementType(); - if (IsHeapAllocated(elementType)) + FuType elementType2 = obj.Type.AsClassType().GetElementType(); + if (IsHeapAllocated(elementType2)) NotYet(obj, "CopyTo for this type"); // TODO Write("memcpy("); WriteArrayPtrAdd(args[1], args[2]); Write(", "); WriteArrayPtrAdd(obj, args[0]); Write(", "); - if (elementType.Id == FuId.SByteRange || elementType.Id == FuId.ByteRange) + if (elementType2.Id == FuId.SByteRange || elementType2.Id == FuId.ByteRange) args[3].Accept(this, FuPriority.Argument); else { args[3].Accept(this, FuPriority.Mul); Write(" * sizeof("); - WriteType(elementType, false); + WriteType(elementType2, false); WriteChar(')'); } WriteChar(')'); @@ -2166,12 +2166,12 @@ public class GenC : GenCCpp this.Compares.Add(typeId2); break; case FuId.QueueClear: - FuType elementType = obj.Type.AsClassType().GetElementType(); - if (HasDictionaryDestroy(elementType)) { + FuType elementType3 = obj.Type.AsClassType().GetElementType(); + if (HasDictionaryDestroy(elementType3)) { Write("g_queue_clear_full("); WriteUnstorage(obj); Write(", "); - WriteDictionaryDestroy(elementType); + WriteDictionaryDestroy(elementType3); } else { Write("g_queue_clear("); diff --git a/libfut.cpp b/libfut.cpp index fe565b03..7e5c5048 100644 --- a/libfut.cpp +++ b/libfut.cpp @@ -10892,8 +10892,8 @@ void GenC::writeCallExpr(const FuExpr * obj, const FuMethod * method, const std: writeChar('('); write("(const "); { - const FuType * elementType2 = obj->type->asClassType()->getElementType().get(); - writeType(elementType2, false); + const FuType * elementType = obj->type->asClassType()->getElementType().get(); + writeType(elementType, false); write(" *) bsearch(&"); (*args)[0]->accept(this, FuPriority::primary); write(", "); @@ -10906,7 +10906,7 @@ void GenC::writeCallExpr(const FuExpr * obj, const FuMethod * method, const std: writeArrayStorageLength(obj); else (*args)[2]->accept(this, FuPriority::argument); - writeSizeofCompare(elementType2); + writeSizeofCompare(elementType); write(" - "); writeArrayPtr(obj, FuPriority::mul); if (parent > FuPriority::add) @@ -10926,20 +10926,20 @@ void GenC::writeCallExpr(const FuExpr * obj, const FuMethod * method, const std: case FuId::listCopyTo: include("string.h"); { - const FuType * elementType = obj->type->asClassType()->getElementType().get(); - if (isHeapAllocated(elementType)) + const FuType * elementType2 = obj->type->asClassType()->getElementType().get(); + if (isHeapAllocated(elementType2)) notYet(obj, "CopyTo for this type"); write("memcpy("); writeArrayPtrAdd((*args)[1].get(), (*args)[2].get()); write(", "); writeArrayPtrAdd(obj, (*args)[0].get()); write(", "); - if (elementType->id == FuId::sByteRange || elementType->id == FuId::byteRange) + if (elementType2->id == FuId::sByteRange || elementType2->id == FuId::byteRange) (*args)[3]->accept(this, FuPriority::argument); else { (*args)[3]->accept(this, FuPriority::mul); write(" * sizeof("); - writeType(elementType, false); + writeType(elementType2, false); writeChar(')'); } writeChar(')'); @@ -11041,12 +11041,12 @@ void GenC::writeCallExpr(const FuExpr * obj, const FuMethod * method, const std: } case FuId::queueClear: { - const FuType * elementType = obj->type->asClassType()->getElementType().get(); - if (hasDictionaryDestroy(elementType)) { + const FuType * elementType3 = obj->type->asClassType()->getElementType().get(); + if (hasDictionaryDestroy(elementType3)) { write("g_queue_clear_full("); writeUnstorage(obj); write(", "); - writeDictionaryDestroy(elementType); + writeDictionaryDestroy(elementType3); } else { write("g_queue_clear("); diff --git a/libfut.cs b/libfut.cs index e2e7922c..1048873e 100644 --- a/libfut.cs +++ b/libfut.cs @@ -11191,8 +11191,8 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List if (parent > FuPriority.Add) WriteChar('('); Write("(const "); - FuType elementType2 = obj.Type.AsClassType().GetElementType(); - WriteType(elementType2, false); + FuType elementType = obj.Type.AsClassType().GetElementType(); + WriteType(elementType, false); Write(" *) bsearch(&"); args[0].Accept(this, FuPriority.Primary); Write(", "); @@ -11205,7 +11205,7 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List WriteArrayStorageLength(obj); else args[2].Accept(this, FuPriority.Argument); - WriteSizeofCompare(elementType2); + WriteSizeofCompare(elementType); Write(" - "); WriteArrayPtr(obj, FuPriority.Mul); if (parent > FuPriority.Add) @@ -11223,20 +11223,20 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List case FuId.ArrayCopyTo: case FuId.ListCopyTo: Include("string.h"); - FuType elementType = obj.Type.AsClassType().GetElementType(); - if (IsHeapAllocated(elementType)) + FuType elementType2 = obj.Type.AsClassType().GetElementType(); + if (IsHeapAllocated(elementType2)) NotYet(obj, "CopyTo for this type"); Write("memcpy("); WriteArrayPtrAdd(args[1], args[2]); Write(", "); WriteArrayPtrAdd(obj, args[0]); Write(", "); - if (elementType.Id == FuId.SByteRange || elementType.Id == FuId.ByteRange) + if (elementType2.Id == FuId.SByteRange || elementType2.Id == FuId.ByteRange) args[3].Accept(this, FuPriority.Argument); else { args[3].Accept(this, FuPriority.Mul); Write(" * sizeof("); - WriteType(elementType, false); + WriteType(elementType2, false); WriteChar(')'); } WriteChar(')'); @@ -11328,12 +11328,12 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List this.Compares.Add(typeId2); break; case FuId.QueueClear: - FuType elementType = obj.Type.AsClassType().GetElementType(); - if (HasDictionaryDestroy(elementType)) { + FuType elementType3 = obj.Type.AsClassType().GetElementType(); + if (HasDictionaryDestroy(elementType3)) { Write("g_queue_clear_full("); WriteUnstorage(obj); Write(", "); - WriteDictionaryDestroy(elementType); + WriteDictionaryDestroy(elementType3); } else { Write("g_queue_clear("); diff --git a/libfut.js b/libfut.js index 03d59312..9ddf5b9d 100644 --- a/libfut.js +++ b/libfut.js @@ -11577,8 +11577,8 @@ export class GenC extends GenCCpp if (parent > FuPriority.ADD) this.writeChar(40); this.write("(const "); - let elementType2 = obj.type.asClassType().getElementType(); - this.writeType(elementType2, false); + let elementType = obj.type.asClassType().getElementType(); + this.writeType(elementType, false); this.write(" *) bsearch(&"); args[0].accept(this, FuPriority.PRIMARY); this.write(", "); @@ -11591,7 +11591,7 @@ export class GenC extends GenCCpp this.writeArrayStorageLength(obj); else args[2].accept(this, FuPriority.ARGUMENT); - this.#writeSizeofCompare(elementType2); + this.#writeSizeofCompare(elementType); this.write(" - "); this.writeArrayPtr(obj, FuPriority.MUL); if (parent > FuPriority.ADD) @@ -11609,20 +11609,20 @@ export class GenC extends GenCCpp case FuId.ARRAY_COPY_TO: case FuId.LIST_COPY_TO: this.include("string.h"); - let elementType = obj.type.asClassType().getElementType(); - if (GenC.#isHeapAllocated(elementType)) + let elementType2 = obj.type.asClassType().getElementType(); + if (GenC.#isHeapAllocated(elementType2)) this.notYet(obj, "CopyTo for this type"); this.write("memcpy("); this.writeArrayPtrAdd(args[1], args[2]); this.write(", "); this.writeArrayPtrAdd(obj, args[0]); this.write(", "); - if (elementType.id == FuId.S_BYTE_RANGE || elementType.id == FuId.BYTE_RANGE) + if (elementType2.id == FuId.S_BYTE_RANGE || elementType2.id == FuId.BYTE_RANGE) args[3].accept(this, FuPriority.ARGUMENT); else { args[3].accept(this, FuPriority.MUL); this.write(" * sizeof("); - this.writeType(elementType, false); + this.writeType(elementType2, false); this.writeChar(41); } this.writeChar(41); @@ -11716,12 +11716,12 @@ export class GenC extends GenCCpp this.#compares.add(typeId2); break; case FuId.QUEUE_CLEAR: - let elementType = obj.type.asClassType().getElementType(); - if (GenC.#hasDictionaryDestroy(elementType)) { + let elementType3 = obj.type.asClassType().getElementType(); + if (GenC.#hasDictionaryDestroy(elementType3)) { this.write("g_queue_clear_full("); this.#writeUnstorage(obj); this.write(", "); - this.#writeDictionaryDestroy(elementType); + this.#writeDictionaryDestroy(elementType3); } else { this.write("g_queue_clear(");