summaryrefslogtreecommitdiff
path: root/src/ast/ast.cpp
diff options
context:
space:
mode:
authorJohn Hodge (sonata) <tpg@mutabah.net>2015-01-12 16:29:22 +0800
committerJohn Hodge (sonata) <tpg@mutabah.net>2015-01-12 16:29:22 +0800
commit645ecea1a60e913ada6bdc8665d098d4b00a5f01 (patch)
treecfc6f5f0f277cc8882c7e9e064f1afd59fcb88a5 /src/ast/ast.cpp
parentad48a617d5881c14ae5f9d818798d928833a3153 (diff)
downloadmrust-645ecea1a60e913ada6bdc8665d098d4b00a5f01.tar.gz
Added statics, fix minor quirk in resolve handling
Diffstat (limited to 'src/ast/ast.cpp')
-rw-r--r--src/ast/ast.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/ast/ast.cpp b/src/ast/ast.cpp
index edbaa33e..d1e8c9fd 100644
--- a/src/ast/ast.cpp
+++ b/src/ast/ast.cpp
@@ -119,7 +119,7 @@ ExternCrate ExternCrate_std()
Module prelude(crate.crate(), "prelude");
// Re-exports
- #define USE(mod, name, ...) do{ Path p({__VA_ARGS__}); mod.add_alias(true, ::std::move(p), name); } while(0)
+ #define USE(mod, name, ...) do{ Path p({__VA_ARGS__}); p.set_crate("std"); mod.add_alias(true, ::std::move(p), name); } while(0)
USE(prelude, "Option", PathNode("option", {}), PathNode("Option",{}) );
USE(prelude, "Some", PathNode("option", {}), PathNode("Option",{}), PathNode("Some",{}) );
USE(prelude, "None", PathNode("option", {}), PathNode("Option",{}), PathNode("None",{}) );
@@ -144,17 +144,6 @@ void Module::add_ext_crate(::std::string ext_name, ::std::string int_name)
m_extern_crates.push_back( Item< ::std::string>( ::std::move(int_name), ::std::move(ext_name), false ) );
}
-void Module::add_constant(bool is_public, ::std::string name, TypeRef type, Expr val)
-{
- ::std::cout << "add_constant()" << ::std::endl;
-}
-void Module::add_global(bool is_public, bool is_mut, ::std::string name, TypeRef type, Expr val)
-{
- ::std::cout << "add_global()" << ::std::endl;
-}
-void Module::add_struct(bool is_public, ::std::string name, TypeParams params, ::std::vector<StructItem> items)
-{
-}
void Module::add_impl(Impl impl)
{
}
@@ -166,6 +155,22 @@ void Module::iterate_functions(fcn_visitor_t *visitor, const Crate& crate)
}
}
+::Serialiser& operator<<(::Serialiser& s, Static::Class fc)
+{
+ switch(fc)
+ {
+ case Static::CONST: s << "CONST"; break;
+ case Static::STATIC: s << "STATIC"; break;
+ case Static::MUT: s << "MUT"; break;
+ }
+ return s;
+}
+SERIALISE_TYPE(Static::, "AST_Static", {
+ s << m_class;
+ s << m_type;
+ //s << m_value;
+})
+
::Serialiser& operator<<(::Serialiser& s, Function::Class fc)
{
switch(fc)