summaryrefslogtreecommitdiff
path: root/src/expand/mod.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-03-19 14:51:35 +0800
committerJohn Hodge <tpg@mutabah.net>2016-03-19 14:51:35 +0800
commit13e938957698086e77b7a2c8bbcfea9bba76c17a (patch)
treef3d1eece3c3dd6977635acf375aaa7268962b6ae /src/expand/mod.cpp
parentd9ddf019fe73c78213cddac02c700b6ebf782de4 (diff)
downloadmrust-13e938957698086e77b7a2c8bbcfea9bba76c17a.tar.gz
Expand - Handle std/core loading (partially)
Diffstat (limited to 'src/expand/mod.cpp')
-rw-r--r--src/expand/mod.cpp20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/expand/mod.cpp b/src/expand/mod.cpp
index f1a9891a..3b46736f 100644
--- a/src/expand/mod.cpp
+++ b/src/expand/mod.cpp
@@ -636,8 +636,9 @@ void Expand_Mod(bool is_early, ::AST::Crate& crate, LList<const AST::Module*> mo
for( auto& i : impl.items() )
{
DEBUG(" - " << i.name << " :: " << i.data.attrs);
+
// TODO: Make a path from the impl definition? Requires having the impl def resolved to be correct
- // - Does it? the namespace is essentially the same
+ // - Does it? the namespace is essentially the same. There may be issues with wherever the path is used though
//::AST::Path path = modpath + i.name;
auto attrs = mv$(i.data.attrs);
@@ -680,7 +681,22 @@ void Expand(::AST::Crate& crate)
// 1. Crate attributes
Expand_Attrs(crate.m_attrs, AttrStage::EarlyPre, [&](const auto& d, const auto& a){ d.handle(a, crate); });
- // TODO: Load std/core
+ // Load libstd/libcore
+ switch( crate.m_load_std )
+ {
+ case ::AST::Crate::LOAD_STD:
+ if( crate.m_prelude_path != AST::Path() )
+ crate.m_prelude_path = AST::Path("std", {AST::PathNode("prelude"), AST::PathNode("v1")});
+ TODO(Span(), "Load libstd");
+ break;
+ case ::AST::Crate::LOAD_CORE:
+ if( crate.m_prelude_path != AST::Path() )
+ crate.m_prelude_path = AST::Path("core", {AST::PathNode("prelude")});
+ TODO(Span(), "Load libcore");
+ break;
+ case ::AST::Crate::LOAD_NONE:
+ break;
+ }
// 2. Module attributes
for( auto& a : crate.m_attrs.m_items )