aboutsummaryrefslogtreecommitdiffstats
path: root/src/compile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile.cpp')
-rw-r--r--src/compile.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/compile.cpp b/src/compile.cpp
index 90e31ba..53fd9ad 100644
--- a/src/compile.cpp
+++ b/src/compile.cpp
@@ -109,12 +109,18 @@ compile_def(CEnv& cenv, const ATuple* def) throw()
static CVal
compile_def_type(CEnv& cenv, const ATuple* def) throw()
{
- const ASymbol* name = def->frst()->as_tuple()->fst()->as_symbol();
- cenv.engine()->compileType(cenv, name->sym(), def->frst());
- for (ATuple::const_iterator i = def->iter_at(2); i != def->end(); ++i) {
- const ATuple* exp = (*i)->as_tuple();
- const ASymbol* tag = (*exp->begin())->as_symbol();
- cenv.engine()->compileType(cenv, tag->sym(), exp);
+ const ASymbol* name = def->frst()->to_symbol();
+ if (name) {
+ cenv.engine()->compileType(cenv, name->sym(), def->frrst());
+ cenv.tenv.def(name, def->frrst());
+ } else {
+ name = def->frst()->as_tuple()->fst()->as_symbol();
+ cenv.engine()->compileType(cenv, name->sym(), def->frst());
+ for (ATuple::const_iterator i = def->iter_at(2); i != def->end(); ++i) {
+ const ATuple* exp = (*i)->as_tuple();
+ const ASymbol* tag = (*exp->begin())->as_symbol();
+ cenv.engine()->compileType(cenv, tag->sym(), exp);
+ }
}
return NULL;
}