Skip to content

Commit

Permalink
[cleanup] Fix conflicting variable names.
Browse files Browse the repository at this point in the history
  • Loading branch information
pfusik committed Jan 15, 2024
1 parent 83c11b1 commit 208b164
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 40 deletions.
20 changes: 10 additions & 10 deletions GenC.fu
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ");
Expand All @@ -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)
Expand All @@ -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(')');
Expand Down Expand Up @@ -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(");
Expand Down
20 changes: 10 additions & 10 deletions libfut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ");
Expand All @@ -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)
Expand All @@ -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(')');
Expand Down Expand Up @@ -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(");
Expand Down
20 changes: 10 additions & 10 deletions libfut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11191,8 +11191,8 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List<FuExpr>
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(", ");
Expand All @@ -11205,7 +11205,7 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List<FuExpr>
WriteArrayStorageLength(obj);
else
args[2].Accept(this, FuPriority.Argument);
WriteSizeofCompare(elementType2);
WriteSizeofCompare(elementType);
Write(" - ");
WriteArrayPtr(obj, FuPriority.Mul);
if (parent > FuPriority.Add)
Expand All @@ -11223,20 +11223,20 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List<FuExpr>
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(')');
Expand Down Expand Up @@ -11328,12 +11328,12 @@ protected override void WriteCallExpr(FuExpr obj, FuMethod method, List<FuExpr>
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(");
Expand Down
20 changes: 10 additions & 10 deletions libfut.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ");
Expand All @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -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(");
Expand Down

0 comments on commit 208b164

Please sign in to comment.