abouttreesummaryrefslogcommitdiff
path: root/src/typeInfo.h
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-04 21:44:26 +0200
committerPatrick Schönberger2021-08-04 21:44:26 +0200
commitb9322dfb8efe37f6f88a899269bdf21015f4db9a (patch)
tree837a9aadd80723f6c3d672fe0c9ae04f4f0864c8 /src/typeInfo.h
parentc2ba7425955ae538e220cec79d9124756d1b4c8b (diff)
downloadtoc-b9322dfb8efe37f6f88a899269bdf21015f4db9a.tar.gz
toc-b9322dfb8efe37f6f88a899269bdf21015f4db9a.zip
generic functions and structs
Diffstat (limited to 'src/typeInfo.h')
-rw-r--r--src/typeInfo.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/typeInfo.h b/src/typeInfo.h
index 0fd4114..cbe421c 100644
--- a/src/typeInfo.h
+++ b/src/typeInfo.h
@@ -15,7 +15,8 @@ TypeInfo typeType(const Program & p, Type t)
TypeInfo result;
result.isStruct = true;
if (t.name == "int" || t.name == "float" || t.name == "double" ||
- t.name == "char" || t.name == "long" || t.name == "short" || t.name == "bool")
+ t.name == "char" || t.name == "long" || t.name == "short" || t.name == "bool" ||
+ t.name == "void")
{
result.isStruct = false;
}
@@ -47,7 +48,7 @@ TypeInfo typeExpr(const Program & p, const std::vector<std::string> & globalName
auto m = findStructMethod(p, e._method.methodName, tiCaller);
if (!m.has_value())
throw "Unknown method";
- result = typeType(p, m.value().returnType);
+ result = typeType(p, m.value().t.returnType);
break;
}
case ExprType::Lit:
@@ -69,7 +70,7 @@ TypeInfo typeExpr(const Program & p, const std::vector<std::string> & globalName
typeExpr(p, globalNamespace, globalCtx, *e._dot.expr), e._dot.identifier);
if (!sm.has_value())
throw "Unknown struct member";
- result = typeType(p, sm.value().type);
+ result = typeType(p, sm.value().t.type);
break;
}
case ExprType::PrefixOp: