Skip to content

Commit

Permalink
[c] Avoid a space between "*" and "futemp".
Browse files Browse the repository at this point in the history
  • Loading branch information
pfusik committed Jan 24, 2024
1 parent 05b1dec commit eb47ff1
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions GenC.fu
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ public class GenC : GenCCpp
&& dict.GetValueType() is FuStorageType;
}

protected override void StartTemporaryVar!(FuType type)
{
// overridden just to avoid the unnecessary space
StartDefinition(type, true, true);
}

void WriteTemporaryName!(int id)
{
Write("futemp");
Expand Down
5 changes: 5 additions & 0 deletions libfut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9079,6 +9079,11 @@ bool GenC::isDictionaryClassStgIndexing(const FuExpr * expr)
return (indexing = dynamic_cast<const FuBinaryExpr *>(expr)) && indexing->op == FuToken::leftBracket && (dict = dynamic_cast<const FuClassType *>(indexing->left->type.get())) && dict->class_->typeParameterCount == 2 && dynamic_cast<const FuStorageType *>(dict->getValueType().get());
}

void GenC::startTemporaryVar(const FuType * type)
{
startDefinition(type, true, true);
}

void GenC::writeTemporaryName(int id)
{
write("futemp");
Expand Down
5 changes: 5 additions & 0 deletions libfut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9316,6 +9316,11 @@ static bool IsDictionaryClassStgIndexing(FuExpr expr)
return expr is FuBinaryExpr indexing && indexing.Op == FuToken.LeftBracket && indexing.Left.Type is FuClassType dict && dict.Class.TypeParameterCount == 2 && dict.GetValueType() is FuStorageType;
}

protected override void StartTemporaryVar(FuType type)
{
StartDefinition(type, true, true);
}

void WriteTemporaryName(int id)
{
Write("futemp");
Expand Down
1 change: 1 addition & 0 deletions libfut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2033,6 +2033,7 @@ class GenC : public GenCCpp
virtual void writePrintfLongPrefix();
void writePrintfWidth(const FuInterpolatedPart * part) override;
virtual void writeInterpolatedStringArgBase(const FuExpr * expr);
void startTemporaryVar(const FuType * type) override;
void writeInterpolatedStringArg(const FuExpr * expr) override;
virtual void writeCamelCaseNotKeyword(std::string_view name);
void writeName(const FuSymbol * symbol) override;
Expand Down
5 changes: 5 additions & 0 deletions libfut.js
Original file line number Diff line number Diff line change
Expand Up @@ -9653,6 +9653,11 @@ export class GenC extends GenCCpp
return (indexing = expr) instanceof FuBinaryExpr && indexing.op == FuToken.LEFT_BRACKET && (dict = indexing.left.type) instanceof FuClassType && dict.class.typeParameterCount == 2 && dict.getValueType() instanceof FuStorageType;
}

startTemporaryVar(type)
{
this.#startDefinition(type, true, true);
}

#writeTemporaryName(id)
{
this.write("futemp");
Expand Down

0 comments on commit eb47ff1

Please sign in to comment.