diff options
author | SimplyTheOther <simplytheother@gmail.com> | 2020-11-12 22:22:41 +0800 |
---|---|---|
committer | SimplyTheOther <simplytheother@gmail.com> | 2020-12-08 21:10:28 +0800 |
commit | f5ae2781823b3a2bcded1ac3446de83cc52403a9 (patch) | |
tree | e90b9876a23cd40e0da140aa62fb220ef22dfd58 /gcc/rust/analysis | |
parent | 37bbf2b8cbd4578f0fbe7cbbd573493481f62a45 (diff) | |
download | gcc-f5ae2781823b3a2bcded1ac3446de83cc52403a9.zip gcc-f5ae2781823b3a2bcded1ac3446de83cc52403a9.tar.gz gcc-f5ae2781823b3a2bcded1ac3446de83cc52403a9.tar.bz2 |
Added more expression stripping
Fixed compile errors and started on enum expr stripping
Diffstat (limited to 'gcc/rust/analysis')
-rw-r--r-- | gcc/rust/analysis/rust-type-resolution.cc | 14 | ||||
-rw-r--r-- | gcc/rust/analysis/rust-type-resolution.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/gcc/rust/analysis/rust-type-resolution.cc b/gcc/rust/analysis/rust-type-resolution.cc index 87cf828..fcf475e 100644 --- a/gcc/rust/analysis/rust-type-resolution.cc +++ b/gcc/rust/analysis/rust-type-resolution.cc @@ -427,15 +427,15 @@ TypeResolution::visit (AST::StructExprFieldIdentifier &field) void TypeResolution::visit (AST::StructExprFieldIdentifierValue &field) { - identifierBuffer = &field.field_name; - field.value->accept_vis (*this); + identifierBuffer = std::unique_ptr<std::string> (new std::string (field.get_field_name ())); + field.get_value ()->accept_vis (*this); } void TypeResolution::visit (AST::StructExprFieldIndexValue &field) { - tupleIndexBuffer = &field.index; - field.value->accept_vis (*this); + tupleIndexBuffer = std::unique_ptr<int> (new int (field.get_index ())); + field.get_value ()->accept_vis (*this); } void @@ -448,7 +448,7 @@ TypeResolution::visit (AST::StructExprStructFields &expr) return; } - for (auto &field : expr.fields) + for (auto &field : expr.get_fields ()) { identifierBuffer = NULL; tupleIndexBuffer = NULL; @@ -1069,14 +1069,14 @@ TypeResolution::visit (AST::LetStmt &stmt) void TypeResolution::visit (AST::ExprStmtWithoutBlock &stmt) { - stmt.expr->accept_vis (*this); + stmt.get_expr ()->accept_vis (*this); } void TypeResolution::visit (AST::ExprStmtWithBlock &stmt) { scope.Push (); - stmt.expr->accept_vis (*this); + stmt.get_expr ()->accept_vis (*this); auto localMap = scope.PeekLocals (); for (auto &[_, value] : localMap) { diff --git a/gcc/rust/analysis/rust-type-resolution.h b/gcc/rust/analysis/rust-type-resolution.h index af4594e..0c6413b 100644 --- a/gcc/rust/analysis/rust-type-resolution.h +++ b/gcc/rust/analysis/rust-type-resolution.h @@ -301,8 +301,8 @@ private: bool isTypeInScope (AST::Type *type, Location locus); TypeScoping scope; - std::string *identifierBuffer; - int *tupleIndexBuffer; + std::unique_ptr<std::string> identifierBuffer; + std::unique_ptr<int> tupleIndexBuffer; }; } // namespace Analysis |