diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/hir/expr.cpp | 4 | ||||
-rw-r--r-- | src/hir/expr.hpp | 2 | ||||
-rw-r--r-- | src/hir/path.cpp | 11 | ||||
-rw-r--r-- | src/hir/path.hpp | 7 | ||||
-rw-r--r-- | src/hir/visitor.cpp | 2 | ||||
-rw-r--r-- | src/hir_typeck/expr_check.cpp | 4 | ||||
-rw-r--r-- | src/hir_typeck/expr_cs.cpp | 7 | ||||
-rw-r--r-- | src/main.cpp | 3 |
8 files changed, 25 insertions, 15 deletions
diff --git a/src/hir/expr.cpp b/src/hir/expr.cpp index 10d01e1b..e974f2cc 100644 --- a/src/hir/expr.cpp +++ b/src/hir/expr.cpp @@ -102,7 +102,6 @@ DEF_VISIT(ExprNode_CallPath, node, TRACE_FUNCTION_F("_CallPath: " << node.m_path); for(auto& ty : node.m_cache.m_arg_types) visit_type(ty); - visit_path_params(node.m_cache.m_ty_impl_params); visit_path(::HIR::Visitor::PathContext::VALUE, node.m_path); for(auto& arg : node.m_args) @@ -121,7 +120,6 @@ DEF_VISIT(ExprNode_CallMethod, node, TRACE_FUNCTION_F("_CallMethod: " << node.m_method); for(auto& ty : node.m_cache.m_arg_types) visit_type(ty); - visit_path_params(node.m_cache.m_ty_impl_params); visit_path(::HIR::Visitor::PathContext::VALUE, node.m_method_path); @@ -322,6 +320,7 @@ void ::HIR::ExprVisitorDef::visit_path(::HIR::Visitor::PathContext pc, ::HIR::Pa visit_type(*e.type); visit_generic_path(pc, e.trait); visit_path_params(e.params); + visit_path_params(e.impl_params); ), (UfcsUnknown, visit_type(*e.type); @@ -330,6 +329,7 @@ void ::HIR::ExprVisitorDef::visit_path(::HIR::Visitor::PathContext pc, ::HIR::Pa (UfcsInherent, visit_type(*e.type); visit_path_params(e.params); + visit_path_params(e.impl_params); ) ) } diff --git a/src/hir/expr.hpp b/src/hir/expr.hpp index 1b732e4a..b963834f 100644 --- a/src/hir/expr.hpp +++ b/src/hir/expr.hpp @@ -452,8 +452,6 @@ struct ExprCallCache const ::HIR::GenericParams* m_fcn_params; const ::HIR::GenericParams* m_top_params; const ::HIR::Function* m_fcn; - - ::HIR::PathParams m_ty_impl_params; ::std::function<const ::HIR::TypeRef&(const ::HIR::TypeRef&)> m_monomorph_cb; }; diff --git a/src/hir/path.cpp b/src/hir/path.cpp index 8e522aa9..7f9d2fc9 100644 --- a/src/hir/path.cpp +++ b/src/hir/path.cpp @@ -1,4 +1,9 @@ /* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * hir/path.hpp + * - Item paths (helper code) */ #include <hir/path.hpp> #include <hir/type.hpp> @@ -206,7 +211,8 @@ bool ::HIR::TraitPath::operator==(const ::HIR::TraitPath& x) const return Path(Data::make_UfcsInherent({ box$( e.type->clone() ), e.item, - e.params.clone() + e.params.clone(), + e.impl_params.clone() })); ), (UfcsKnown, @@ -214,7 +220,8 @@ bool ::HIR::TraitPath::operator==(const ::HIR::TraitPath& x) const box$( e.type->clone() ), e.trait.clone(), e.item, - e.params.clone() + e.params.clone(), + e.impl_params.clone() })); ), (UfcsUnknown, diff --git a/src/hir/path.hpp b/src/hir/path.hpp index ae875620..af07e453 100644 --- a/src/hir/path.hpp +++ b/src/hir/path.hpp @@ -1,4 +1,9 @@ /* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * hir/path.hpp + * - Item paths */ #ifndef _HIR_PATH_HPP_ #define _HIR_PATH_HPP_ @@ -175,12 +180,14 @@ public: ::std::unique_ptr<TypeRef> type; ::std::string item; PathParams params; + PathParams impl_params; }), (UfcsKnown, struct { ::std::unique_ptr<TypeRef> type; GenericPath trait; ::std::string item; PathParams params; + PathParams impl_params; }), (UfcsUnknown, struct { ::std::unique_ptr<TypeRef> type; diff --git a/src/hir/visitor.cpp b/src/hir/visitor.cpp index 1882416d..d852423a 100644 --- a/src/hir/visitor.cpp +++ b/src/hir/visitor.cpp @@ -444,11 +444,13 @@ void ::HIR::Visitor::visit_path(::HIR::Path& p, ::HIR::Visitor::PathContext pc) (UfcsInherent, this->visit_type(*e.type); this->visit_path_params(e.params); + this->visit_path_params(e.impl_params); ), (UfcsKnown, this->visit_type(*e.type); this->visit_generic_path(e.trait, ::HIR::Visitor::PathContext::TYPE); this->visit_path_params(e.params); + this->visit_path_params(e.impl_params); ), (UfcsUnknown, this->visit_type(*e.type); diff --git a/src/hir_typeck/expr_check.cpp b/src/hir_typeck/expr_check.cpp index 2d601b54..3a76e231 100644 --- a/src/hir_typeck/expr_check.cpp +++ b/src/hir_typeck/expr_check.cpp @@ -651,8 +651,8 @@ namespace { // NOTE: Trusts the existing cache. - ASSERT_BUG(sp, cache.m_ty_impl_params.m_types.size() == impl_ptr->m_params.m_types.size(), ""); - auto& impl_params = cache.m_ty_impl_params; + ASSERT_BUG(sp, e.impl_params.m_types.size() == impl_ptr->m_params.m_types.size(), ""); + auto& impl_params = e.impl_params; // Create monomorphise callback const auto& fcn_params = e.params; diff --git a/src/hir_typeck/expr_cs.cpp b/src/hir_typeck/expr_cs.cpp index 60ceef0b..98dcada2 100644 --- a/src/hir_typeck/expr_cs.cpp +++ b/src/hir_typeck/expr_cs.cpp @@ -406,7 +406,7 @@ namespace { // If the impl block has parameters, figure out what types they map to // - The function params are already mapped (from fix_param_count) - auto& impl_params = cache.m_ty_impl_params; + auto& impl_params = e.impl_params; if( impl_ptr->m_params.m_types.size() > 0 ) { // Default-construct entires in the `impl_params` array @@ -2915,9 +2915,6 @@ namespace { { for(auto& ty : cache.m_arg_types) this->check_type_resolved_top(sp, ty); - - for(auto& ty : cache.m_ty_impl_params.m_types) - this->check_type_resolved_top(sp, ty); } void visit(::HIR::ExprNode_CallPath& node) override { this->visit_callcache(node.span(), node.m_cache); @@ -2982,11 +2979,13 @@ namespace { (UfcsInherent, check_type_resolved(sp, *pe.type, top_type); check_type_resolved_pp(sp, pe.params, top_type); + check_type_resolved_pp(sp, pe.impl_params, top_type); ), (UfcsKnown, check_type_resolved(sp, *pe.type, top_type); check_type_resolved_pp(sp, pe.trait.m_params, top_type); check_type_resolved_pp(sp, pe.params, top_type); + check_type_resolved_pp(sp, pe.impl_params, top_type); ), (UfcsUnknown, ERROR(sp, E0000, "UfcsUnknown " << path << " left in " << top_type); diff --git a/src/main.cpp b/src/main.cpp index 45e5bfa8..530717ae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -174,9 +174,6 @@ int main(int argc, char *argv[]) Cfg_SetValueCb("feature", [¶ms](const ::std::string& s) {
return params.features.count(s) != 0;
});
-
- // TODO: This is for liblibc - should be a command-line option
- //Cfg_SetFlag("stdbuild");
|