Significant work on templates. They should be close to working now (for single replacement). However, they do not show up in the global scope the the C generator can't see them. Plus, their names will have to be Cified.

This commit is contained in:
Nathan Braswell
2014-05-09 02:56:55 -04:00
parent 5de2ff58bb
commit 5022fc0802
6 changed files with 130 additions and 77 deletions

View File

@@ -4,42 +4,55 @@ Type::Type() {
indirection = 0;
baseType = none;
typeDefinition = NULL;
templateDefinition = NULL;
}
Type::Type(ValueType typeIn) {
indirection = 0;
baseType = typeIn;
typeDefinition = NULL;
templateDefinition = NULL;
}
Type::Type(ValueType typeIn, int indirectionIn) {
indirection = indirectionIn;
baseType = typeIn;
typeDefinition = NULL;
templateDefinition = NULL;
}
Type::Type(NodeTree<ASTData>* typeDefinitionIn) {
indirection = 0;
baseType = none;
typeDefinition = typeDefinitionIn;
templateDefinition = NULL;
}
Type::Type(NodeTree<ASTData>* typeDefinitionIn, int indirectionIn) {
indirection = indirectionIn;
baseType = none;
typeDefinition = typeDefinitionIn;
templateDefinition = NULL;
}
Type::Type(ValueType typeIn, NodeTree<ASTData>* typeDefinitionIn, int indirectionIn) {
baseType = typeIn;
indirection = indirectionIn;
typeDefinition = typeDefinitionIn;
templateDefinition = NULL;
}
Type::Type(ValueType typeIn, NodeTree<Symbol>* templateDefinitionIn) {
indirection = 0;
baseType = typeIn;
typeDefinition = NULL;
templateDefinition = templateDefinitionIn;
}
Type::~Type() {
}
const bool Type::operator==(const Type &other) const {
return( baseType == other.baseType && indirection == other.indirection && typeDefinition == other.typeDefinition);
return( baseType == other.baseType && indirection == other.indirection && typeDefinition == other.typeDefinition && templateDefinition == other.templateDefinition);
}
const bool Type::operator!=(const Type &other) const {
@@ -55,6 +68,8 @@ std::string Type::toString() {
else
typeString = "none";
break;
case template_type:
typeString = "template: " + templateDefinition->getDataRef()->toString();
case void_type:
typeString = "void";
break;