diff options
author | John Hodge <tpg@mutabah.net> | 2015-04-03 22:57:27 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-04-03 22:57:27 +0800 |
commit | c15006c15505ae785eb5447c055b8f9379e7fcde (patch) | |
tree | afe7f047db2c5ab2e0ea7bbf7155522771be474a /src/include | |
parent | 44e15eac335bfe8a78af259541be97d1f6653d7a (diff) | |
download | mrust-c15006c15505ae785eb5447c055b8f9379e7fcde.tar.gz |
Added partial support for #[derive()]
- Supports Debug on struct, and assumes compiling in libcore (for now)
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/main_bindings.hpp | 11 | ||||
-rw-r--r-- | src/include/synext.hpp | 33 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/include/main_bindings.hpp b/src/include/main_bindings.hpp index fef57184..91bac742 100644 --- a/src/include/main_bindings.hpp +++ b/src/include/main_bindings.hpp @@ -5,13 +5,24 @@ #include "../ast/ast.hpp" +/// Parse a crate from the given file extern AST::Crate Parse_Crate(::std::string mainfile); +/// Process #[] decorators +extern void Process_Decorators(AST::Crate& crate); +/// Resolve all in-text paths to absolute variants extern void ResolvePaths(AST::Crate& crate); +/// Check that generic bounds are valid extern void Typecheck_GenericBounds(AST::Crate& crate); +/// Check that parameters for generics are valid extern void Typecheck_GenericParams(AST::Crate& crate); +/// Type resolution (and hence checking) for expressions extern void Typecheck_Expr(AST::Crate& crate); + +/// Convert the AST to a flat tree extern AST::Flat Convert_Flatten(const AST::Crate& crate); + +/// Dump the crate as annotated rust extern void Dump_Rust(const char *Filename, const AST::Crate& crate); #endif diff --git a/src/include/synext.hpp b/src/include/synext.hpp new file mode 100644 index 00000000..6688c1c7 --- /dev/null +++ b/src/include/synext.hpp @@ -0,0 +1,33 @@ +/* + */ +#ifndef _SYNEXT_HPP_ +#define _SYNEXT_HPP_ + +#include "../common.hpp" // for mv$ and other things +#include <string> +#include <memory> + +namespace AST { + class MetaItem; + class Path; + class Module; + class Struct; +} + +class CDecoratorHandler +{ +public: + virtual void handle_item(AST::Module& mod, const AST::MetaItem& attr, const AST::Path& path, AST::Struct& str) const = 0; +}; + +#define STATIC_SYNEXT(_type, ident, _typename) \ + struct register_##_typename##_c {\ + register_##_typename##_c() {\ + Register_Synext_##_type( ident, ::std::unique_ptr<C##_type##Handler>(new _typename()) ); \ + } \ + } s_register_##_typename; + +extern void Register_Synext_Decorator(::std::string name, ::std::unique_ptr<CDecoratorHandler> handler); + +#endif + |