diff options
author | Nala Ginrut <mulei@gnu.org> | 2020-06-05 02:09:29 +0800 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2020-11-28 21:13:16 +0000 |
commit | 0ec260e760835e769cf73de1e46eb0ee20d6acef (patch) | |
tree | 1b30dcac9731b5908e6a3ccb2248db58bf9accee /gcc/rust/analysis | |
parent | c9658f97840a3901cb053a9978287816e29bf37b (diff) | |
download | gcc-0ec260e760835e769cf73de1e46eb0ee20d6acef.zip gcc-0ec260e760835e769cf73de1e46eb0ee20d6acef.tar.gz gcc-0ec260e760835e769cf73de1e46eb0ee20d6acef.tar.bz2 |
Add basic functions of name resolution
Diffstat (limited to 'gcc/rust/analysis')
-rw-r--r-- | gcc/rust/analysis/rust-name-resolution.cc | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/gcc/rust/analysis/rust-name-resolution.cc b/gcc/rust/analysis/rust-name-resolution.cc index c05bfcb..582f8ac 100644 --- a/gcc/rust/analysis/rust-name-resolution.cc +++ b/gcc/rust/analysis/rust-name-resolution.cc @@ -45,7 +45,7 @@ namespace Rust { namespace Analysis { NameResolution::NameResolution (AST::Crate &crate, TopLevelScan &toplevel) - : Resolution (crate, toplevel) + : Resolution (crate, toplevel), is_work_list_changed_ (false) {} @@ -58,13 +58,35 @@ NameResolution::Resolve (AST::Crate &crate, TopLevelScan &toplevel) return resolver.go (); } +void +NameResolution::process_work_list () +{} + +void +NameResolution::expand_macros () +{} + bool NameResolution::go () { - for (auto &item : crate.items) - item->accept_vis (*this); - - return true; + bool ret = true; + + do + { + for (auto &item : crate.items) + { + item->accept_vis (*this); + } + } + while (is_work_list_changed ()); + + ret = work_list_.empty (); + for (auto &item : work_list_) + { + std::cout << "Resolution error: " << item.as_string () << std::endl; + } + + return ret; } void @@ -81,7 +103,14 @@ NameResolution::visit (AST::AttrInputMetaItemContainer &input) void NameResolution::visit (AST::IdentifierExpr &ident_expr) -{} +{ + do + { + process_work_list (); + } + while (is_work_list_changed ()); + expand_macros (); +} void NameResolution::visit (AST::Lifetime &lifetime) |