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:
@@ -26,13 +26,10 @@ class ASTData {
|
||||
~ASTData();
|
||||
std::string toString();
|
||||
static std::string ASTTypeToString(ASTType type);
|
||||
void addTemplateTypeDefToReplace(NodeTree<ASTData>* typeDefToReplace);
|
||||
std::vector<NodeTree<ASTData>*> getTemplateTypeDefsToReplace();
|
||||
ASTType type;
|
||||
Type* valueType;
|
||||
Symbol symbol;
|
||||
std::map<std::string, std::vector<NodeTree<ASTData>*>> scope;
|
||||
std::vector<NodeTree<ASTData>*> templateTypeDefsToReplace; //Used only by template classes/functions to keep track of pointers to the typedefs that need to be changed
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
@@ -16,13 +16,13 @@ class ASTTransformation: public NodeTransformation<Symbol,ASTData> {
|
||||
ASTTransformation(Importer* importerIn);
|
||||
~ASTTransformation();
|
||||
virtual NodeTree<ASTData>* transform(NodeTree<Symbol>* from);
|
||||
NodeTree<ASTData>* transform(NodeTree<Symbol>* from, NodeTree<ASTData>* scope, std::vector<Type> types = std::vector<Type>());
|
||||
std::vector<NodeTree<ASTData>*> transformChildren(std::vector<NodeTree<Symbol>*> children, std::set<int> skipChildren, NodeTree<ASTData>* scope, std::vector<Type> types);
|
||||
NodeTree<ASTData>* transform(NodeTree<Symbol>* from, NodeTree<ASTData>* scope, std::vector<Type> types, std::map<std::string, Type*> templateTypeReplacements);
|
||||
std::vector<NodeTree<ASTData>*> transformChildren(std::vector<NodeTree<Symbol>*> children, std::set<int> skipChildren, NodeTree<ASTData>* scope, std::vector<Type> types, std::map<std::string, Type*> templateTypeReplacements);
|
||||
std::vector<Type> mapNodesToTypes(std::vector<NodeTree<ASTData>*> nodes);
|
||||
std::string concatSymbolTree(NodeTree<Symbol>* root);
|
||||
NodeTree<ASTData>* doFunction(NodeTree<ASTData>* scope, std::string lookup, std::vector<NodeTree<ASTData>*> nodes);
|
||||
NodeTree<ASTData>* doFunction(NodeTree<ASTData>* scope, std::string lookup, std::vector<NodeTree<ASTData>*> nodes, std::map<std::string, Type*> templateTypeReplacements);
|
||||
NodeTree<ASTData>* scopeLookup(NodeTree<ASTData>* scope, std::string lookup, std::vector<Type> types = std::vector<Type>());
|
||||
Type* typeFromTypeNode(NodeTree<Symbol>* typeNode, NodeTree<ASTData>* scope);
|
||||
Type* typeFromTypeNode(NodeTree<Symbol>* typeNode, NodeTree<ASTData>* scope, std::map<std::string, Type*> templateTypeReplacements);
|
||||
private:
|
||||
Importer * importer;
|
||||
std::map<std::string, std::vector<NodeTree<ASTData>*>> languageLevelScope;
|
||||
|
||||
@@ -13,7 +13,7 @@ class ASTData;
|
||||
#include "ASTData.h"
|
||||
#include "util.h"
|
||||
|
||||
enum ValueType {none, void_type, boolean, integer, floating, double_percision, character };
|
||||
enum ValueType {none, template_type, void_type, boolean, integer, floating, double_percision, character };
|
||||
|
||||
|
||||
class Type {
|
||||
@@ -24,6 +24,7 @@ class Type {
|
||||
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();
|
||||
bool const operator==(const Type &other)const;
|
||||
bool const operator!=(const Type &other)const;
|
||||
@@ -32,6 +33,7 @@ class Type {
|
||||
ValueType baseType;
|
||||
NodeTree<ASTData>* typeDefinition;
|
||||
int indirection;
|
||||
NodeTree<Symbol>* templateDefinition;
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user