More all-rounded implementation of the new objecty features, several bugfixes, and updates to the standard library to behave. Vector still needs a bit more work for some operations

This commit is contained in:
Nathan Braswell
2015-06-05 00:34:24 -04:00
parent 6f9ceaa717
commit 7abab02fbf
15 changed files with 185 additions and 87 deletions

View File

@@ -36,9 +36,9 @@ class CGenerator {
static std::string scopePrefix(NodeTree<ASTData>* from);
std::string generateObjectMethod(NodeTree<ASTData>* enclosingObject, NodeTree<ASTData>* from, std::string *functionPrototype);
NodeTree<ASTData>* getMethodsObjectType(NodeTree<ASTData>* scope, std::string functionName);
NodeTree<ASTData>* getMethod(Type* type, std::string method);
bool methodExists(Type* type, std::string method);
std::string generateMethodIfExists(Type* type, std::string method, std::string parameter);
NodeTree<ASTData>* getMethod(Type* type, std::string method, std::vector<Type> types);
bool methodExists(Type* type, std::string method, std::vector<Type> types);
std::string generateMethodIfExists(Type* type, std::string method, std::string parameter, std::vector<Type> methodTypes);
std::string emitDestructors(std::vector<NodeTree<ASTData>*> possibleDeclarations, NodeTree<ASTData>* enclosingObject);
std::string tabs();
std::string getID();

View File

@@ -38,6 +38,8 @@ class Type {
void increaseIndirection();
void decreaseIndirection();
void modifyIndirection(int mod);
Type withIncreasedIndirection();
Type withDecreasedIndirection();
ValueType baseType;
NodeTree<ASTData>* typeDefinition;

View File

@@ -46,6 +46,14 @@ std::vector<T> reverse(std::vector<T> vec) {
return flat;
}
template <typename T>
std::vector<T> dereferenced(std::vector<T*> vec) {
std::vector<T> de;
for (T* i:vec)
de.push_back(*i);
return de;
}
template <typename T>
std::vector<T> slice(std::vector<T> vec, int begin, int end, int step = 1) {
std::vector<T> toReturn;