diff options
author | John Hodge <tpg@mutabah.net> | 2015-04-05 13:47:01 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2015-04-05 13:47:01 +0800 |
commit | cae16a7a72a75f08e01b63ef31a56e75125556b6 (patch) | |
tree | 0413915c3eb2925585d844bf7f72d1abd2a0d687 /src/ast/ast.hpp | |
parent | 89788c5801e03b0c5b0b288d0fefb717f75c67f0 (diff) | |
download | mrust-cae16a7a72a75f08e01b63ef31a56e75125556b6.tar.gz |
Move handling of wildcard trait destructure to TypeRef
Diffstat (limited to 'src/ast/ast.hpp')
-rw-r--r-- | src/ast/ast.hpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/ast/ast.hpp b/src/ast/ast.hpp index 2f6ab45f..671a0aa9 100644 --- a/src/ast/ast.hpp +++ b/src/ast/ast.hpp @@ -823,6 +823,26 @@ public: }
+class GenericResolveClosure
+{
+ const AST::TypeParams& m_params;
+ const ::std::vector<TypeRef>& m_args;
+public:
+ GenericResolveClosure(const AST::TypeParams& params, const ::std::vector<TypeRef>& args):
+ m_params(params),
+ m_args(args)
+ {}
+ TypeRef operator()(const char *argname) {
+ for(unsigned int i = 0; i < m_params.ty_params().size(); i ++)
+ {
+ if( m_params.ty_params()[i].name() == argname ) {
+ return m_args.at(i);
+ }
+ }
+ throw ::std::runtime_error("BUGCHECK - Unknown arg in field type");
+ }
+};
+
extern AST::Module g_compiler_module;
extern void AST_InitProvidedModule();
|