diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-12-21 10:00:20 +0800 |
---|---|---|
committer | SimplyTheOther <simplytheother@gmail.com> | 2020-12-21 10:00:20 +0800 |
commit | 30dd20c0098948de74f6a18978e78e2950782975 (patch) | |
tree | 1e3130f51900fb85b63d4f4f0e22d17ca1837770 /gcc/rust/backend | |
parent | aa283484a3dffedc404653af18f9413775cbc3df (diff) | |
parent | 671cefe61254bedd4a9f526f8912fe68368cbe72 (diff) | |
download | gcc-30dd20c0098948de74f6a18978e78e2950782975.zip gcc-30dd20c0098948de74f6a18978e78e2950782975.tar.gz gcc-30dd20c0098948de74f6a18978e78e2950782975.tar.bz2 |
Merge branch 'master' of https://github.com/redbrain/gccrs
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 12 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-item.h | 13 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 7 |
3 files changed, 14 insertions, 18 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index f890678..1924b52 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -205,9 +205,13 @@ public: virtual ~TyTyResolveCompile () {} - void visit (TyTy::FnType &type) { gcc_unreachable (); } + void visit (TyTy::UnitType &type) override { gcc_unreachable (); } - void visit (TyTy::BoolType &type) + void visit (TyTy::InferType &type) override { gcc_unreachable (); } + + void visit (TyTy::FnType &type) override { gcc_unreachable (); } + + void visit (TyTy::BoolType &type) override { ::Btype *compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ref (), &compiled_type); @@ -215,7 +219,7 @@ public: translated = compiled_type; } - void visit (TyTy::IntType &type) + void visit (TyTy::IntType &type) override { printf ("type [%s] has ref: %u\n", type.as_string ().c_str (), type.get_ref ()); @@ -226,7 +230,7 @@ public: translated = compiled_type; } - void visit (TyTy::UintType &type) + void visit (TyTy::UintType &type) override { ::Btype *compiled_type = nullptr; bool ok = ctx->lookup_compiled_types (type.get_ref (), &compiled_type); diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h index dd07435..f131a89 100644 --- a/gcc/rust/backend/rust-compile-item.h +++ b/gcc/rust/backend/rust-compile-item.h @@ -48,11 +48,7 @@ public: { // has this been added to the list then it must be finished if (ctx->function_completed (lookup)) - { - printf ("returning early the function [%s] is completed!\n", - function.as_string ().c_str ()); - return; - } + return; } TyTy::TyBase *fnType; @@ -123,9 +119,12 @@ public: return true; }); - Bblock *enclosing_scope = ctx->peek_enclosing_scope (); - HIR::BlockExpr *function_body = function.function_body.get (); + bool toplevel_item + = function.get_mappings ().get_local_defid () != UNKNOWN_LOCAL_DEFID; + Bblock *enclosing_scope + = toplevel_item ? NULL : ctx->peek_enclosing_scope (); + HIR::BlockExpr *function_body = function.function_body.get (); Location start_location = function_body->get_locus (); Location end_location = function_body->get_closing_locus (); diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index e6683fa..c5c646d 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -36,10 +36,6 @@ ResolvePath::visit (HIR::PathInExpression &expr) return; } - printf ("PATHIN have ast node id %u ref %u for expr [%s]\n", - expr.get_mappings ().get_nodeid (), ref_node_id, - expr.as_string ().c_str ()); - HirId ref; if (!ctx->get_mappings ()->lookup_node_to_hir ( expr.get_mappings ().get_crate_num (), ref_node_id, &ref)) @@ -52,9 +48,6 @@ ResolvePath::visit (HIR::PathInExpression &expr) Bfunction *fn; if (!ctx->lookup_function_decl (ref, &fn)) { - printf ( - "path failed to lookup function attempting to forward resolve!\n"); - // this might fail because its a forward decl so we can attempt to // resolve it now HIR::Item *resolved_item = ctx->get_mappings ()->lookup_hir_item ( |