amber-lang / amber-lang/amber

[Task] Clean up `add_imported_deps` function in imports module

Đang mở
#1,012 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
compiler
Ngôn ngữ chính
Rust
Star
5.2k
Fork
145
Merge trung bình
5 ngày 3 giờ
Pull request đã merge (30 ngày)
7

Mô tả

The match statement in `add_imported_deps` function located in `import.rs` itself should turn into something like:
```rs
// The `publics` here is a vector of items implementing `Declaration` trait which comes with `get_name`
let found = publics.iter_mut().find(|decl| decl.get_name() == name);

match found {
Some(Function(fun)) => ...,
Some(Variable(var)) => ...,
None => // "Import '{name}' not found"
}
```
This requires:
1. Implementation of a `Declaration` enum
2. Restructuring the code in the match statement
3. Update `get_imports` in the `import_cache.rs` to use the new `Declaration` enum

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.