about summary refs log tree commit diff
path: root/users/glittershark/achilles/src/tc/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/glittershark/achilles/src/tc/mod.rs')
-rw-r--r--users/glittershark/achilles/src/tc/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/users/glittershark/achilles/src/tc/mod.rs b/users/glittershark/achilles/src/tc/mod.rs
index 52c18e6d5329..4bca52733bc8 100644
--- a/users/glittershark/achilles/src/tc/mod.rs
+++ b/users/glittershark/achilles/src/tc/mod.rs
@@ -337,6 +337,19 @@ impl<'ast> Typechecker<'ast> {
                 self.env.set(name.clone(), type_);
                 Ok(None)
             }
+            ast::Decl::Extern { name, type_ } => {
+                let type_ = self.type_from_ast_type(ast::Type::Function(type_));
+                self.env.set(name.clone(), type_.clone());
+                let (arg_types, ret_type) = match type_ {
+                    Type::Fun { args, ret } => (args, *ret),
+                    _ => unreachable!(),
+                };
+                Ok(Some(hir::Decl::Extern {
+                    name,
+                    arg_types,
+                    ret_type,
+                }))
+            }
         }
     }