aboutsummaryrefslogtreecommitdiffstats
path: root/src/c.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/c.cpp')
-rw-r--r--src/c.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/c.cpp b/src/c.cpp
index a00c89b..7d5b125 100644
--- a/src/c.cpp
+++ b/src/c.cpp
@@ -43,18 +43,21 @@ struct CEngine : public Engine {
CFunc startFn(CEnv& cenv, const string& name, const ATuple* args, const ATuple* type);
void pushFnArgs(CEnv& cenv, const ATuple* prot, const ATuple* type, CFunc f);
- void finishFn(CEnv& cenv, CFunc f, CVal ret);
+ void finishFn(CEnv& cenv, CFunc f, CVal ret, const AST* retT);
void eraseFn(CEnv& cenv, CFunc f);
- CVal compileCall(CEnv& cenv, CFunc f, const ATuple* funcT, const vector<CVal>& args);
- CVal compileCons(CEnv& cenv, const ATuple* type, CVal rtti, const vector<CVal>& fields);
- CVal compileDot(CEnv& cenv, CVal tup, int32_t index);
- CVal compileGlobalSet(CEnv& cenv, const string& s, CVal v, const AST* t);
- CVal compileGlobalGet(CEnv& cenv, const string& s, CVal v);
- CVal compileIf(CEnv& cenv, const AST* cond, const AST* then, const AST* aelse);
- CVal compileLiteral(CEnv& cenv, const AST* lit);
- CVal compilePrimitive(CEnv& cenv, const ATuple* prim);
- CVal compileString(CEnv& cenv, const char* str);
+ CVal compileCall(CEnv& cenv, CFunc f, const ATuple* funcT, const vector<CVal>& args);
+ CVal compileCons(CEnv& cenv, const ATuple* type, CVal rtti, const vector<CVal>& fields);
+ CVal compileDot(CEnv& cenv, CVal tup, int32_t index);
+ CVal compileGlobalSet(CEnv& cenv, const string& s, CVal v, const AST* t);
+ CVal compileGlobalGet(CEnv& cenv, const string& s, CVal v);
+ CVal compileIf(CEnv& cenv, const AST* cond, const AST* then, const AST* aelse);
+ CVal compileLiteral(CEnv& cenv, const AST* lit);
+ CVal compilePrimitive(CEnv& cenv, const ATuple* prim);
+ CVal compileString(CEnv& cenv, const char* str);
+ CType compileType(CEnv& cenv, const char* name, const AST* exp);
+
+ CType objectType(CEnv& cenv);
void writeModule(CEnv& cenv, std::ostream& os);
@@ -159,6 +162,18 @@ CEngine::compileString(CEnv& cenv, const char* str)
return new Value(string("\"") + str + "\"");
}
+CType
+CEngine::compileType(CEnv& cenv, const char* name, const AST* expr)
+{
+ return NULL;
+}
+
+CType
+CEngine::objectType(CEnv& cenv)
+{
+ return new string("Object");
+}
+
CFunc
CEngine::startFn(CEnv& cenv, const std::string& name, const ATuple* args, const ATuple* type)
{
@@ -212,7 +227,7 @@ CEngine::pushFnArgs(CEnv& cenv, const ATuple* prot, const ATuple* type, CFunc f)
}
void
-CEngine::finishFn(CEnv& cenv, CFunc f, CVal ret)
+CEngine::finishFn(CEnv& cenv, CFunc f, CVal ret, const AST* retT)
{
out += "return " + *(Value*)ret + ";\n}\n\n";
}