void
DefaultResolver::visit (AST::StructStruct &type)
{
- // do we need to scope anything here? no, right?
+ auto inner_fn = [this, &type] () { AST::DefaultASTVisitor::visit (type); };
- // we also can't visit `StructField`s by default, so there's nothing to do -
- // correct? or should we do something like
+ ctx.scoped (Rib::Kind::Item /* FIXME: Correct? */, type.get_node_id (),
+ inner_fn, type.get_struct_name ());
+}
- AST::DefaultASTVisitor::visit (type);
+void
+DefaultResolver::visit (AST::TupleStruct &type)
+{
+ auto inner_fn = [this, &type] () { AST::DefaultASTVisitor::visit (type); };
- // FIXME: ???
+ ctx.scoped (Rib::Kind::Item /* FIXME: Correct? */, type.get_node_id (),
+ inner_fn, type.get_struct_name ());
}
void
DefaultResolver::visit (AST::Enum &type)
{
- // FIXME: Do we need to scope anything by default?
-
auto variant_fn = [this, &type] () { AST::DefaultASTVisitor::visit (type); };
ctx.scoped (Rib::Kind::Item /* FIXME: Correct? */, type.get_node_id (),
variant_fn, type.get_identifier ());
}
+void
+DefaultResolver::visit (AST::Union &type)
+{
+ auto inner_fn = [this, &type] () { AST::DefaultASTVisitor::visit (type); };
+
+ ctx.scoped (Rib::Kind::Item /* FIXME: Correct? */, type.get_node_id (),
+ inner_fn, type.get_identifier ());
+}
+
+void
+DefaultResolver::visit (AST::TypeAlias &type)
+{
+ auto inner_fn = [this, &type] () { AST::DefaultASTVisitor::visit (type); };
+
+ ctx.scoped (Rib::Kind::Item /* FIXME: Correct? */, type.get_node_id (),
+ inner_fn, type.get_new_type_name ());
+}
+
void
DefaultResolver::visit (AST::ClosureExprInner &expr)
{
// type dec nodes, which visit their fields or variants by default
void visit (AST::StructStruct &) override;
+ void visit (AST::TupleStruct &) override;
void visit (AST::Enum &) override;
+ void visit (AST::Union &) override;
+ void visit (AST::TypeAlias &) override;
// Visitors that visit their expression node(s)
void visit (AST::ClosureExprInner &) override;
ctx.scoped (Rib::Kind::Item, s.get_node_id (), s_vis);
}
-void
-Late::visit (AST::Enum &s)
-{
- auto s_vis = [this, &s] () { AST::DefaultASTVisitor::visit (s); };
- ctx.scoped (Rib::Kind::Item, s.get_node_id (), s_vis);
-}
-
void
Late::visit (AST::StructExprStruct &s)
{
void visit (AST::StructExprStructBase &) override;
void visit (AST::StructExprStructFields &) override;
void visit (AST::StructStruct &) override;
- void visit (AST::Enum &) override;
void visit (AST::GenericArgs &) override;
void visit (AST::GenericArg &);
if (module.get_kind () == AST::Module::UNLOADED)
module.load_items ();
- auto sub_visitor = [this, &module] () {
- for (auto &item : module.get_items ())
- item->accept_vis (*this);
- };
-
- ctx.scoped (Rib::Kind::Module, module.get_node_id (), sub_visitor,
- module.get_name ());
+ DefaultResolver::visit (module);
if (Analysis::Mappings::get ().lookup_ast_module (module.get_node_id ())
== tl::nullopt)
DefaultResolver::visit (function);
}
-void
-TopLevel::visit (AST::BlockExpr &expr)
-{
- // extracting the lambda from the `scoped` call otherwise the code looks like
- // a hot turd thanks to our .clang-format
-
- auto sub_vis = [this, &expr] () {
- for (auto &stmt : expr.get_statements ())
- stmt->accept_vis (*this);
-
- if (expr.has_tail_expr ())
- expr.get_tail_expr ().accept_vis (*this);
- };
-
- ctx.scoped (Rib::Kind::Normal, expr.get_node_id (), sub_vis);
-}
-
void
TopLevel::visit (AST::StaticItem &static_item)
{
{
insert_or_error_out (static_item.get_identifier ().as_string (), static_item,
Namespace::Values);
+
+ DefaultResolver::visit (static_item);
}
void
{
insert_or_error_out (type_param.get_type_representation (), type_param,
Namespace::Types);
+
+ DefaultResolver::visit (type_param);
}
void
insert_or_error_out (tuple_struct.get_struct_name (), tuple_struct,
Namespace::Values);
+
+ DefaultResolver::visit (tuple_struct);
}
void
void
TopLevel::visit (AST::Enum &enum_item)
{
- auto generic_vis = [this, &enum_item] () {
- for (auto &g : enum_item.get_generic_params ())
- {
- g->accept_vis (*this);
- }
- };
-
- ctx.scoped (Rib::Kind::Item, enum_item.get_node_id (), generic_vis);
-
insert_or_error_out (enum_item.get_identifier (), enum_item,
Namespace::Types);
- auto field_vis = [this, &enum_item] () {
- for (auto &variant : enum_item.get_variants ())
- variant->accept_vis (*this);
- };
-
- ctx.scoped (Rib::Kind::Item /* FIXME: Is that correct? */,
- enum_item.get_node_id (), field_vis, enum_item.get_identifier ());
+ DefaultResolver::visit (enum_item);
}
void
{
insert_or_error_out (union_item.get_identifier (), union_item,
Namespace::Types);
+
+ DefaultResolver::visit (union_item);
}
void
void visit (AST::TraitItemType &trait_item) override;
void visit (AST::MacroRulesDefinition ¯o) override;
void visit (AST::Function &function) override;
- void visit (AST::BlockExpr &expr) override;
void visit (AST::StaticItem &static_item) override;
void visit (AST::ExternalStaticItem &static_item) override;
void visit (AST::StructStruct &struct_item) override;
derive_macro4.rs
derive_macro6.rs
expected_type_args2.rs
-expected_type_args3.rs
feature_rust_attri0.rs
for_lifetimes.rs
format_args_basic_expansion.rs
generics1.rs
generics10.rs
generics11.rs
-generics2.rs
generics3.rs
generics4.rs
generics5.rs
generics6.rs
-generics8.rs
generics9.rs
if_let_expr.rs
issue-1019.rs
issue-1034.rs
issue-1129-2.rs
issue-1130.rs
-issue-1165.rs
issue-1173.rs
-issue-1235.rs
issue-1272.rs
issue-1289.rs
issue-1447.rs
issue-2037.rs
issue-2043.rs
issue-2070.rs
-issue-2105.rs
issue-2135.rs
issue-2136-1.rs
issue-2136-2.rs
multiple_bindings2.rs
name_resolution2.rs
name_resolution4.rs
-nested_generic.rs
nested_macro_use1.rs
nested_macro_use2.rs
nested_macro_use3.rs
redef_error2.rs
redef_error4.rs
redef_error5.rs
-redef_error6.rs
self-path1.rs
self-path2.rs
sizeof-stray-infer-var-bug.rs
iflet.rs
issue-3033.rs
issue-3009.rs
-issue-2323.rs
issue-2953-2.rs
issue-1773.rs
issue-2905-1.rs