Add `Node` union
まだ誰も着手していません。
評価
調査の方向性
既存のASTノード型を確認し、提案されている所有型のNodeと参照型のNodeRefの設計を比較してください。enum、変換メソッド、型チェックを実装する前に、命名要件と所有権要件を解決してください。サポート対象のノード型と必要なAPIについて合意され、テストで網羅されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Add a new Node union that is an enum over all node types. This can be useful when implementing methods that can operate on any node. For example, Ruff's formatter has (roughly) the API format(node: AnyNode) -> String
I haven't figured out the full requirements yet, and I don't know yet if we'll need both the owned and reference versions:
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
enum Node {
IfStmt(ast::IfStmt),
ConstantExpr(ast::ConstantExpr),
...
}
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, is_macro)]
enum NodeRef<'a> {
IfStmt(&'a ast::IfStmt),
ConstantExpr(&'a ast::ConstantExpr)
...
}
Note: An alternative naming more in line with
PathandPathBufwould be to name the typesNodeBuf(owned) andNode(reference)
The enums should have the following basic methods:
if_stmt(self) -> Option<ast::IfStmt>as_if_stmt(&self) -> Option<&ast::IfStmt>const is_if_stmt(&self) -> bool
Node could also implement AsRef that returns a NodeRef
I may have time to work on this sometime soon but I wanted to put this up for discussion first to get feedback.
- 主要言語
- Rust
- スター
- 117
- フォーク
- 38
- 平均マージ
- 4日 7時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
RustPython/Parser のほかの issue
-
Maintenance status オープン
難易度 1/5 1時間未満 初心者へのやさしさ 25/100
RustPython/Parser#140 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
RustPython/Parser#139 · コメント 3 件 ·
-
cargo audit paste オープン
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
RustPython/Parser#137 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 50/100
RustPython/Parser#133 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
RustPython/Parser#130 ·
RustPython/Parser の issue をすべて見る
似ている issue
-
risk:low runtime status:in-progress type:test
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
zeroclaw-labs/zeroclaw#11023 ·
-
good first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
EricSpencer00/Resilient#4835 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
bisq-network/bisq-musig#204 ·
-
agent:ready documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
cesarferreira/stax#890 ·