diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-01-24 18:38:58 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-01-24 18:42:24 +0000 |
commit | c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957 (patch) | |
tree | 5c10c91f085cbe16316fd5dff0a611bbd40a0610 /gcc/rust/backend/rust-compile-resolve-path.cc | |
parent | 3de87e620f8714278c273ec91dc6ec22347c188c (diff) | |
download | gcc-c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957.zip gcc-c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957.tar.gz gcc-c8a0c6eb4b9ea3779f01418cfc97a6761ca4a957.tar.bz2 |
Remove hack to handle forward declared items
We used to use a compile_fns flag as a method to handle the case of code
such as:
```rust
fn foo() {
bar()
}
fn bar() { }
```
The compile_fns flag when set to false would allow us to do a toplevel
scan to compile the initial fndecl prototype of the functions as a method
of handling the case of the call to bar() within the body of foo.
The backend is setup now that we can 'query_compile' by compiling the
item as required with a cache if we have already done so.
Diffstat (limited to 'gcc/rust/backend/rust-compile-resolve-path.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-resolve-path.cc | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/rust/backend/rust-compile-resolve-path.cc b/gcc/rust/backend/rust-compile-resolve-path.cc index e2c0354..ddb6c91 100644 --- a/gcc/rust/backend/rust-compile-resolve-path.cc +++ b/gcc/rust/backend/rust-compile-resolve-path.cc @@ -166,10 +166,10 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup, if (is_hir_item) { if (!lookup->has_subsititions_defined ()) - return CompileItem::compile (resolved_item, ctx, true, nullptr, true, + return CompileItem::compile (resolved_item, ctx, nullptr, true, expr_locus); else - return CompileItem::compile (resolved_item, ctx, true, lookup, true, + return CompileItem::compile (resolved_item, ctx, lookup, true, expr_locus); } else @@ -194,11 +194,11 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup, rust_assert (ok); if (!lookup->has_subsititions_defined ()) - return CompileInherentImplItem::Compile (resolved_item, ctx, true, + return CompileInherentImplItem::Compile (resolved_item, ctx, nullptr, true, expr_locus); else - return CompileInherentImplItem::Compile (resolved_item, ctx, true, - lookup, true, expr_locus); + return CompileInherentImplItem::Compile (resolved_item, ctx, lookup, + true, expr_locus); } else { @@ -276,13 +276,12 @@ HIRCompileBase::query_compile (HirId ref, TyTy::BaseType *lookup, rust_assert (ok); if (!lookup->has_subsititions_defined ()) - return CompileInherentImplItem::Compile (impl_item, ctx, true, + return CompileInherentImplItem::Compile (impl_item, ctx, nullptr, true, expr_locus); else - return CompileInherentImplItem::Compile (impl_item, ctx, true, - lookup, true, - expr_locus); + return CompileInherentImplItem::Compile (impl_item, ctx, lookup, + true, expr_locus); lookup->set_ty_ref (impl_item->get_impl_mappings ().get_hirid ()); } |