Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Turn Name Resolution 2.0 on by default #2875

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions gcc/rust/ast/rust-ast-collector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,29 +250,6 @@ TokenCollector::visit (Visibility &vis)
}
}

void
TokenCollector::visit (NamedFunctionParam &param)
{
auto name = param.get_name ();
if (!param.is_variadic ())
{
push (
Rust::Token::make_identifier (param.get_locus (), std::move (name)));
push (Rust::Token::make (COLON, UNDEF_LOCATION));
visit (param.get_type ());
}
else
{
if (name != "")
{
push (Rust::Token::make_identifier (param.get_locus (),
std::move (name)));
push (Rust::Token::make (COLON, UNDEF_LOCATION));
}
push (Rust::Token::make (ELLIPSIS, UNDEF_LOCATION));
}
}

void
TokenCollector::visit (std::vector<std::unique_ptr<GenericParam>> &params)
{
Expand Down
1 change: 0 additions & 1 deletion gcc/rust/ast/rust-ast-collector.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ class TokenCollector : public ASTVisitor
void visit (TupleField &field);
void visit (StructField &field);
void visit (SimplePathSegment &segment);
void visit (NamedFunctionParam &param);
void visit (MacroRule &rule);
void visit (WhereClause &rule);
void visit (std::vector<LifetimeParam> &for_lifetimes);
Expand Down
1 change: 0 additions & 1 deletion gcc/rust/ast/rust-ast-full-decls.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ class TraitImpl;
class ExternalItem;
class ExternalTypeItem;
class ExternalStaticItem;
class NamedFunctionParam;
class ExternBlock;

// rust-macro.h
Expand Down
17 changes: 9 additions & 8 deletions gcc/rust/ast/rust-ast-visitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,15 @@ DefaultASTVisitor::visit (AST::SelfParam &param)
void
DefaultASTVisitor::visit (AST::Module &module)
{
// Parse the module's items if they haven't been expanded and the file
// should be parsed (i.e isn't hidden behind an untrue or impossible cfg
// directive
// TODO: make sure this is right
// This was copied from the old early resolver method
// 'accumulate_escaped_macros'
if (module.get_kind () == AST::Module::UNLOADED)
module.load_items ();

visit_outer_attrs (module);
visit (module.get_visibility ());
visit_inner_attrs (module);
Expand Down Expand Up @@ -1060,14 +1069,6 @@ DefaultASTVisitor::visit (AST::ExternalStaticItem &item)
visit (item.get_type ());
}

void
DefaultASTVisitor::visit (AST::NamedFunctionParam &param)
{
visit_outer_attrs (param);
if (!param.is_variadic ())
visit (param.get_type ());
}

void
DefaultASTVisitor::visit (AST::ExternBlock &block)
{
Expand Down
1 change: 0 additions & 1 deletion gcc/rust/ast/rust-ast-visitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ class DefaultASTVisitor : public ASTVisitor
virtual void visit (AST::WhereClause &where);
virtual void visit (AST::StructField &field);
virtual void visit (AST::TupleField &field);
virtual void visit (AST::NamedFunctionParam &param);
virtual void visit (AST::MacroRule &rule);
virtual void visit (AST::MacroInvocData &data);
virtual void visit (AST::MacroTranscriber &transcriber);
Expand Down
16 changes: 0 additions & 16 deletions gcc/rust/ast/rust-ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2997,22 +2997,6 @@ ExternalStaticItem::as_string () const
return str;
}

std::string
NamedFunctionParam::as_string () const
{
std::string str = append_attributes (outer_attrs, OUTER);

if (has_name ())
str += "\n" + name;

if (is_variadic ())
str += "...";
else
str += "\n Type: " + param_type->as_string ();

return str;
}

std::string
TraitItemConst::as_string () const
{
Expand Down
Loading
Loading