More work on ADTs

This commit is contained in:
Nathan Braswell
2015-11-09 13:26:02 -05:00
parent 3645099bbb
commit 2ea504ffc1
5 changed files with 718 additions and 692 deletions

View File

@@ -199,7 +199,7 @@ std::string Type::toString(bool showTraits) {
if (is_reference)
typeString = "ref " + typeString;
for (int i = 0; i < indirection; i++)
typeString = "*" + typeString;
typeString += "*";
if (indirection < 0)
typeString += "negative indirection: " + intToString(indirection);
if (traits.size() && showTraits) {
@@ -240,6 +240,11 @@ Type Type::withIncreasedIndirection() {
newOne->increaseIndirection();
return *newOne;
}
Type *Type::withIncreasedIndirectionPtr() {
Type *newOne = clone();
newOne->increaseIndirection();
return newOne;
}
Type Type::withDecreasedIndirection() {
Type *newOne = clone();
newOne->decreaseIndirection();