Maybe I try to redesign the way our types are organized. I'd propose the following approach:
Make BasicType a direct subclass of ASTNode (no inheritance from Type anymore)
Use it only where a basic type is expected: in the NewArrayDeclaration and as base type for arrays
Merge ArrayType into Type. Dimension should be allowed to be 0, signifying a non-array type
While this would cost more space overhead for non-array types and could complicate some future functions, several other parts get easier: We need no special cases in Parser::parseType() and we could have easier equality checks.
Or is there any reason to separate ArrayType on the on side and BasicType on the other?
If I get an OK, I'd do the remodelling and implement the equality checks.
Maybe I try to redesign the way our types are organized. I'd propose the following approach:
While this would cost more space overhead for non-array types and could complicate some future functions, several other parts get easier: We need no special cases in Parser::parseType() and we could have easier equality checks.
Or is there any reason to separate ArrayType on the on side and BasicType on the other?
If I get an OK, I'd do the remodelling and implement the equality checks.