Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

refactor: Deduplicate 'pointer type from origin' derivation

オープン
#3,137 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
74/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
compilers

調査の方向性

Start by reading createPtrFromOrigin in packages/typegpu/src/data/ptr.ts, then compare its uses in packages/typegpu/src/tgsl/wgslGenerator.ts, packages/typegpu/src/tgsl/forOfUtils.ts, and packages/typegpu/src/data/ref.ts. Check the existing isAddressableOrigin from #3075 and confirm that the shared derivation concretizes the inner type while d.ref() keeps its explicit fallback. Done means the three paths use one consistent helper without changing their intended fallback behavior.

索引モデルが issue の本文から書いたものです。

説明

The same "derive a pointer type from a snippet's origin" logic is written out in three places, each slightly differently:

  • packages/typegpu/src/tgsl/wgslGenerator.ts (_aliasConstStatement): createPtrFromOrigin(eq.origin, concretize(type)) + invariant(ptrType !== undefined, ...)
  • packages/typegpu/src/tgsl/forOfUtils.ts (getElementType): same as above, copy-pasted
  • packages/typegpu/src/data/ref.ts (d.ref() GPU impl): createPtrFromOrigin(value.origin, type) ?? ptrFn(concretize(type)). It falls back to a function-scope pointer instead of asserting, and only concretizes on the fallback path
Proposal

Add a single helper next to createPtrFromOrigin in data/ptr.ts, e.g. ptrTypeFor(snippet), that concretizes the inner type and asserts addressability. d.ref() would then pick its fallback explicitly using isAddressableOrigin (added in #3075).

Follow-up to the review of #3075.

主要言語
TypeScript
スター
3.3k
フォーク
135
平均マージ
3日 23時間
マージ済み PR(30日)
70

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

software-mansion/TypeGPU のほかの issue

software-mansion/TypeGPU の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。