Skip to content

Commit

Permalink
(#72) CodeGen: StackArrayType -> InPlaceArrayType (since it may not o…
Browse files Browse the repository at this point in the history
…nly be in stack)
  • Loading branch information
ForNeVeR committed Jul 31, 2022
1 parent 930c193 commit a36985a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Cesium.CodeGen/Ir/BlockItems/DeclarationBlockItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ private static void EmitScopedIdentifier(IDeclarationScope scope, ScopedIdentifi

switch (initializer)
{
case null when type is not StackArrayType:
case null when type is not InPlaceArrayType:
return;
case null when type is StackArrayType arrayType:
case null when type is InPlaceArrayType arrayType:
arrayType.EmitInitializer(scope);
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion Cesium.CodeGen/Ir/Declarations/LocalDeclarationInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private static (IType, string? Identifier) ProcessDirectDeclarator(IDirectDeclar
!int.TryParse(constantExpression.Constant.Text, out var size))
throw new NotSupportedException($"Array size specifier is not integer {sizeExpr}.");

type = new StackArrayType(type, size);
type = new InPlaceArrayType(type, size);
}

break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Cesium.CodeGen.Ir.Types;

internal record StackArrayType(IType Base, int Size) : PointerType(Base)
internal record InPlaceArrayType(IType Base, int Size) : PointerType(Base)
{
public override TypeReference Resolve(TranslationUnitContext context)
{
Expand All @@ -26,4 +26,4 @@ public void EmitInitializer(IDeclarationScope scope)
}

public override int SizeInBytes => Base.SizeInBytes * Size;
}
}

0 comments on commit a36985a

Please sign in to comment.