diff options
author | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 20:18:59 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 21:13:22 +0000 |
commit | 0db8774645244b08d0e0cd18275ea64ff96f6911 (patch) | |
tree | 470f3d8a8641dcff2baf1efaeaf8446043dca9d9 | |
parent | e7cf2f7789dccbb1d8aac6222b2b1c0f4d5f18f6 (diff) | |
download | gcc-0db8774645244b08d0e0cd18275ea64ff96f6911.zip gcc-0db8774645244b08d0e0cd18275ea64ff96f6911.tar.gz gcc-0db8774645244b08d0e0cd18275ea64ff96f6911.tar.bz2 |
Remove unused and add FIXME
We need to ensure in type resolution pass we fix up the ordering for
a struct initilization and give defaults to missing fields.
-rw-r--r-- | gcc/rust/analysis/rust-type-resolution.cc | 4 | ||||
-rw-r--r-- | gcc/rust/backend/rust-compile.cc | 18 |
2 files changed, 4 insertions, 18 deletions
diff --git a/gcc/rust/analysis/rust-type-resolution.cc b/gcc/rust/analysis/rust-type-resolution.cc index 3503a83..9179b0c 100644 --- a/gcc/rust/analysis/rust-type-resolution.cc +++ b/gcc/rust/analysis/rust-type-resolution.cc @@ -516,6 +516,10 @@ TypeResolution::visit (AST::StructExprStructFields &expr) } } + // need to correct the ordering with the respect to the struct definition and + // ensure we handle missing values and give them defaults + // FIXME + // setup a path in type AST::PathIdentSegment seg (expr.get_struct_name ().as_string ()); auto typePath = ::std::unique_ptr<AST::TypePathSegment> ( diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc index 6374a45..0b632b7 100644 --- a/gcc/rust/backend/rust-compile.cc +++ b/gcc/rust/backend/rust-compile.cc @@ -533,24 +533,6 @@ Compilation::visit (AST::StructExprFieldIdentifier &field) void Compilation::visit (AST::StructExprFieldIdentifierValue &field) { - AST::StructStruct *decl = structBuffer.back (); - size_t index = 0; - bool found = false; - for (auto &df : decl->fields) - { - if (field.field_name.compare (df.field_name) == 0) - { - found = true; - break; - } - } - if (!found) - { - rust_fatal_error (field.value->get_locus_slow (), - "failed to lookup field index"); - return; - } - Bexpression *value = NULL; VISIT_POP (field.value->get_locus_slow (), field.value.get (), value, exprs); if (value == NULL) |