Traits for function templates working! Need to finish for objects and specilizations, and I think also else statements.

This commit is contained in:
Nathan Braswell
2014-07-18 08:52:15 -07:00
parent 46b9fc8b7f
commit 64fcb6b0b7
14 changed files with 396 additions and 174 deletions

View File

@@ -5,12 +5,9 @@
#define NULL ((void*)0)
#endif
#ifndef SEGFAULT
#define SEGFAULT (*((char*)0)), std::cout << "\t\t\t\tNEGATIVE*************************************************************************" << std::endl;
#endif
#include <string>
#include <iostream>
#include <set>
//Circular dependency
class ASTData;
@@ -23,12 +20,12 @@ enum ValueType {none, template_type, template_type_type, void_type, boolean, int
class Type {
public:
Type();
Type(ValueType typeIn, int indirectionIn);
Type(ValueType typeIn);
Type(NodeTree<ASTData>* typeDefinitionIn);
Type(NodeTree<ASTData>* typeDefinitionIn, int indirectionIn);
Type(ValueType typeIn, NodeTree<ASTData>* typeDefinitionIn, int indirectionIn);
Type(ValueType typeIn, NodeTree<Symbol>* templateDefinitionIn);
Type(ValueType typeIn, int indirectionIn = 0);
Type(ValueType typeIn, std::set<std::string> traitsIn); //Mostly for template type type's
Type(NodeTree<ASTData>* typeDefinitionIn, int indirectionIn = 0);
Type(NodeTree<ASTData>* typeDefinitionIn, std::set<std::string> traitsIn);
Type(ValueType typeIn, NodeTree<ASTData>* typeDefinitionIn, int indirectionIn, std::set<std::string> traitsIn);
Type(ValueType typeIn, NodeTree<Symbol>* templateDefinitionIn, std::set<std::string> traitsIn = std::set<std::string>());
~Type();
bool const operator==(const Type &other)const;
bool const operator!=(const Type &other)const;
@@ -39,13 +36,13 @@ class Type {
void increaseIndirection();
void decreaseIndirection();
void modifyIndirection(int mod);
void check();
ValueType baseType;
NodeTree<ASTData>* typeDefinition;
NodeTree<Symbol>* templateDefinition;
std::map<std::string, Type*> templateTypeReplacement;
private:
std::set<std::string> traits;
private:
int indirection;
};