summaryrefslogtreecommitdiff
path: root/src/ast/ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge (sonata) <tpg@mutabah.net>2015-01-04 09:42:53 +0800
committerJohn Hodge (sonata) <tpg@mutabah.net>2015-01-04 09:42:53 +0800
commit4a9e7dc0e4976c03a8dbceeacc5e474509b237f9 (patch)
tree5696f6f2fe862fe0a548444a188dd1fdbd831341 /src/ast/ast.cpp
parent5fae00d74e717a703d1bbc90536a003a205eae95 (diff)
downloadmrust-4a9e7dc0e4976c03a8dbceeacc5e474509b237f9.tar.gz
Hacking up 'use' resolution (needs work to handle recursion)
Diffstat (limited to 'src/ast/ast.cpp')
-rw-r--r--src/ast/ast.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index 7d151063..994d3999 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -88,14 +88,37 @@ void Crate::iterate_functions(fcn_visitor_t* visitor)
m_root_module.iterate_functions(visitor, *this);
}
+ExternCrate::ExternCrate()
+{
+}
+
+ExternCrate::ExternCrate(const char *path)
+{
+ throw ParseError::Todo("Load extern crate from a file");
+}
+
+ExternCrate ExternCrate_std()
+{
+ ExternCrate crate;
+ Module& std_mod = crate.root_module();
+
+ // TODO: Add modules
+
+ return crate;
+}
+
void Module::add_ext_crate(::std::string ext_name, ::std::string int_name)
{
DEBUG("add_ext_crate(\"" << ext_name << "\" as " << int_name << ")");
if( ext_name == "std" )
{
// HACK! Load std using a hackjob (included within the compiler)
+ m_extern_crates.push_back( Item<ExternCrate>( ::std::move(int_name), ExternCrate_std(), false ) );
+ }
+ else
+ {
+ throw ParseError::Todo("'extern crate' (not hackjob std)");
}
- throw ParseError::Todo("'extern crate'");
}
void Module::add_constant(bool is_public, ::std::string name, TypeRef type, Expr val)
{