Skip to content
Open
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
5 changes: 5 additions & 0 deletions rust/rubydex/src/model/declaration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ macro_rules! all_declarations {
Declaration::Namespace(Namespace::Class($var)) => $expr,
Declaration::Namespace(Namespace::Module($var)) => $expr,
Declaration::Namespace(Namespace::SingletonClass($var)) => $expr,
Declaration::Namespace(Namespace::Todo($var)) => $expr,
Declaration::Constant($var) => $expr,
Declaration::ConstantAlias($var) => $expr,
Declaration::Method($var) => $expr,
Expand All @@ -74,6 +75,7 @@ macro_rules! all_namespaces {
Namespace::Class($var) => $expr,
Namespace::Module($var) => $expr,
Namespace::SingletonClass($var) => $expr,
Namespace::Todo($var) => $expr,
}
};
}
Expand Down Expand Up @@ -372,6 +374,7 @@ pub enum Namespace {
Class(Box<ClassDeclaration>),
SingletonClass(Box<SingletonClassDeclaration>),
Module(Box<ModuleDeclaration>),
Todo(Box<TodoDeclaration>),
}

impl Namespace {
Expand All @@ -381,6 +384,7 @@ impl Namespace {
Namespace::Class(_) => "Class",
Namespace::SingletonClass(_) => "SingletonClass",
Namespace::Module(_) => "Module",
Namespace::Todo(_) => "<TODO>",
}
}

Expand Down Expand Up @@ -473,6 +477,7 @@ impl Namespace {
namespace_declaration!(Class, ClassDeclaration);
namespace_declaration!(Module, ModuleDeclaration);
namespace_declaration!(SingletonClass, SingletonClassDeclaration);
namespace_declaration!(Todo, TodoDeclaration);
simple_declaration!(ConstantDeclaration);
simple_declaration!(MethodDeclaration);
simple_declaration!(GlobalVariableDeclaration);
Expand Down
7 changes: 3 additions & 4 deletions rust/rubydex/src/model/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,8 @@ impl Graph {
}?;

self.declarations
.get(nesting_declaration_id)
.unwrap()
.as_namespace()
.unwrap()
.get(nesting_declaration_id)?
.as_namespace()?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to change?

.member(member_str_id)
}

Expand Down Expand Up @@ -459,6 +457,7 @@ impl Graph {
Declaration::Namespace(Namespace::SingletonClass(it)) => {
it.add_member(member_str_id, member_declaration_id);
}
Declaration::Namespace(Namespace::Todo(it)) => it.add_member(member_str_id, member_declaration_id),
Declaration::Constant(_) => {
// TODO: temporary hack to avoid crashing on `Struct.new`, `Class.new` and `Module.new`
}
Expand Down
Loading
Loading