Skip to content

Commit

Permalink
Change rust-session-manager for resolution refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
NalaGinrut authored and philberty committed Nov 28, 2020
1 parent 0833b2d commit 0fee2a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
19 changes: 10 additions & 9 deletions gcc/rust/rust-session-manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ Session::enable_dump (::std::string arg)
{
options.dump_option = CompileOptions::EXPANSION_DUMP;
}
else if (arg == "name_resolution")
else if (arg == "resolution")
{
options.dump_option = CompileOptions::NAME_RESOLUTION_DUMP;
options.dump_option = CompileOptions::RESOLUTION_DUMP;
}
else if (arg == "target_options")
{
Expand Down Expand Up @@ -449,8 +449,8 @@ Session::parse_file (const char *filename)
* injection)
* - expansion (expands all macros, maybe build test harness, AST validation,
* maybe macro crate)
* - name resolution (name resolution, maybe feature checking, maybe buffered
* lints)
* - resolution (name resolution, type resolution, maybe feature checking,
* maybe buffered lints)
* TODO not done */

fprintf (stderr, "\033[0;31mSUCCESSFULLY PARSED CRATE \n\033[0m");
Expand Down Expand Up @@ -485,11 +485,11 @@ Session::parse_file (const char *filename)
return;
}

// name resolution pipeline stage
name_resolution (parsed_crate);
fprintf (stderr, "\033[0;31mSUCCESSFULLY FINISHED NAME RESOLUTION \n\033[0m");
// resolution pipeline stage
resolution (parsed_crate);
fprintf (stderr, "\033[0;31mSUCCESSFULLY FINISHED RESOLUTION \n\033[0m");

if (options.dump_option == CompileOptions::NAME_RESOLUTION_DUMP)
if (options.dump_option == CompileOptions::RESOLUTION_DUMP)
{
// TODO: what do I dump here? resolved names? AST with resolved names?
return;
Expand Down Expand Up @@ -750,10 +750,11 @@ Session::expansion (AST::Crate &crate ATTRIBUTE_UNUSED)
}

void
Session::name_resolution (AST::Crate &crate)
Session::resolution (AST::Crate &crate)
{
fprintf (stderr, "started name resolution\n");
Analysis::TopLevelScan toplevel (crate);
// Name resolution must be in front of type resolution
Analysis::TypeResolution::ResolveNamesAndTypes (crate, toplevel);
fprintf (stderr, "finished name resolution\n");
}
Expand Down
10 changes: 6 additions & 4 deletions gcc/rust/rust-session-manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ struct CompileOptions
EXPANSION_DUMP,
NAME_RESOLUTION_DUMP,
TARGET_OPTION_DUMP,
RESOLUTION_DUMP,
// TODO: add more?
} dump_option;

Expand Down Expand Up @@ -225,11 +226,12 @@ struct Session
* macros, maybe build test harness in future, AST validation, maybe create
* macro crate (if not rustdoc).*/
void expansion (AST::Crate &crate);
/* Name resolution pipeline stage. TODO maybe move to another object. Performs
* name resolution, maybe complete gated feature checking, maybe create
* buffered lints in future.

/* Resolution pipeline stage. TODO maybe move to another object.
* Performs name resolution and type resolution, maybe complete gated
* feature checking, maybe create buffered lints in future.
*/
void name_resolution (AST::Crate &crate);
void resolution (AST::Crate &crate);
};
} // namespace Rust

Expand Down

0 comments on commit 0fee2a0

Please sign in to comment.