This commit is contained in:
nub31
2025-09-20 01:48:30 +02:00
parent c9064f0a43
commit 0afd4545f5
2 changed files with 72 additions and 44 deletions

View File

@@ -126,6 +126,18 @@ public class StructTypeFunc(string name, string? hook, FuncTypeNode type)
public FuncTypeNode Type { get; } = type;
}
public class ArrayTypeNode(TypeNode elementType) : TypeNode
{
public override bool IsValueType => false;
public override bool IsScalar => true;
public TypeNode ElementType { get; } = elementType;
public override string ToString() => "[]" + ElementType;
public override bool Equals(TypeNode? other) => other is ArrayTypeNode array && ElementType.Equals(array.ElementType);
public override int GetHashCode() => HashCode.Combine(typeof(ArrayTypeNode), ElementType);
}
public class CStringTypeNode : TypeNode
{
public override bool IsValueType => false;
@@ -144,16 +156,4 @@ public class StringTypeNode : TypeNode
public override string ToString() => "string";
public override bool Equals(TypeNode? other) => other is StringTypeNode;
public override int GetHashCode() => HashCode.Combine(typeof(StringTypeNode));
}
public class ArrayTypeNode(TypeNode elementType) : TypeNode
{
public override bool IsValueType => false;
public override bool IsScalar => false;
public TypeNode ElementType { get; } = elementType;
public override string ToString() => "[]" + ElementType;
public override bool Equals(TypeNode? other) => other is ArrayTypeNode array && ElementType.Equals(array.ElementType);
public override int GetHashCode() => HashCode.Combine(typeof(ArrayTypeNode), ElementType);
}