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:
17
src/Type.cpp
17
src/Type.cpp
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user