Skip to content

feat: クラスをhydrationしメンバー呼び出しを解決 - #121

Open
milkeclair wants to merge 28 commits into
feat/class-runtimefrom
feat/class-diagnostics
Open

milkeclair wants to merge 28 commits into
feat/class-runtimefrom
feat/class-diagnostics

Conversation

@milkeclair

@milkeclair milkeclair commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

変更内容

Refs #90。ランタイムを追加する#120の上に、クラスのAST hydrationと診断を追加します。平坦なクラス定義を解釈し、元のWordとdefault=の値の範囲を保持します。不正な属性と拒否された定義を公開候補から除外し、メソッド本体のマーカーと定義の終端を区別します。

メソッド内の$self.increment、$self.count.get、$self.count.setを、そのメソッドを所有するクラスの宣言に結び付けます。メソッド本体を引数で渡す場合も、共通の埋め込みコード解析から元のクラスを特定して診断位置を対応付けます。所有クラスを特定できない$selfは動的な呼び出しとして扱います。

ASTを走査してクラス宣言を集めたあと、開いたままの定義を所属スコープの末尾で確定します。selfの解決では所属クラスとメソッドを一度の探索で取得します。クラス宣言を含まない埋め込みコードでは、親のクラス宣言を再利用します。

インスタンスIDを展開する呼び出しでは、同じファイルとスコープにある先行の z.cls.new からクラスを特定します。$counter.increment、"$counter.count.set"、${counter}.count.get を解決し、クラスを特定できる場合に未定義のメンバーを報告します。counter.increment は通常のコマンド解決へ進み、同名の関数や外部コマンドが見つからない場合は未定義として報告します。

検証

  • 単体のLSと feat: 単一所有者のクラス実体を自動回収する #180 を合わせたLSで全768件成功。書式、lint、ビルド、型検査を含みます。
  • 親のランタイムで全Zsh 1,581件成功。
  • selfから実メンバーのASTへの参照、存在しないメンバーの診断位置、コード引数の入れ子、通常関数のスコープ境界、既存の補完・診断を確認しました。先に#120を見ると実行時の呼び出し規則を確認できます。

@milkeclair
milkeclair added this pull request to stack #122 November 15, 2026 22:18
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch 2 times, most recently from 1d6de3b to d667564 Compare November 16, 2026 00:12
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch from d667564 to c6deb69 Compare November 16, 2026 04:11
@milkeclair milkeclair changed the title feat: クラスのメソッドと属性呼び出しを診断で認識 feat: クラスをhydrationしメンバー呼び出しを解決 Nov 16, 2026
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch from c6deb69 to c715653 Compare November 16, 2026 05:20
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch 2 times, most recently from b08cb8e to c5223eb Compare November 16, 2026 07:10
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch 2 times, most recently from 66fb65c to 0ca207a Compare November 16, 2026 23:27
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch 4 times, most recently from 320ae90 to 7fe3821 Compare November 17, 2026 08:41
@milkeclair
milkeclair removed this pull request from stack #122 November 17, 2026 08:47
@milkeclair
milkeclair added this pull request to stack #166 November 17, 2026 08:47
@milkeclair
milkeclair removed this pull request from stack #166 November 17, 2026 08:48
@milkeclair
milkeclair changed the base branch from feat/class-runtime to main November 17, 2026 08:48
@milkeclair
milkeclair changed the base branch from main to feat/class-runtime November 17, 2026 08:48
@milkeclair
milkeclair added this pull request to stack #167 November 17, 2026 08:49
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch 2 times, most recently from de314fb to 6bc33c6 Compare November 17, 2026 09:51
Collect literal class members and scoped instance declarations across project files so generated methods and accessors do not raise undefined-command warnings. Preserve body diagnostics and invalidate cached resolution when class declarations change. Refs #90.
Return readonly definition and method capture states without mutating prior maps. Test declaration transitions with real AST fixtures and keep class command integration in dedicated files instead of the general diagnostics suite.
Move the existing decoder to the AST word layer so hydrators can consume it without depending on function resolution. Keep the old import as a compatibility re-export and cover literal, dynamic and prefix inputs.
Attach typed class, attribute, method and instance meaning while preserving syntax kinds and source positions. Build reusable indexes from the final AST so declaration, word and lexical-scope references stay current after immutable enrichment. Represent published, aborted and incomplete definitions separately.
Replace diagnostic-side DSL recognition with hydrated declaration and instance indexes. Return member provenance from call analysis, refresh cached contexts when AST references change, and preserve method argument ownership. Use the shared code-argument analyzer for inline method bodies and isolate embedded class bindings.
Expand semantic fields and state transitions into readable steps, share the member transition, and resolve lexical owners through the final AST index. Match the runtime reserved prefix and retain source positions, readonly data and node identity.
Use explicit semantic names, separate target and context construction, and make test setup, actions and assertions readable. Keep existing class, incremental and embedded-code cases and their resolution behavior.
Interpret bindings, attributes, method endings and publication through separate readonly transitions. Build fresh role-specific indexes without mutating input ASTs or existing indexes. Retain native declaration references and cover duplicate members and independent index reconstruction.
Use the actual runtime declarations to verify eight default public completions, opt-in access to twenty private helpers, and private-call diagnostics and definition resolution. Keep the existing provider implementation and public DSL unchanged.
Retain upstream Japanese architecture guides and restore the class-specific hydration, provenance and diagnostic sections in Japanese. Preserve source tokens, semantic behavior and the code parameter marker while translating added function comments.
Constrain class definitions to file/function ownership and member captures to actual attributes or methods, using the established discriminated-union model. Use ordinary Japanese descriptions and document current consumers without development-history wording. Keep syntax nodes, ranges and runtime behavior unchanged.
The context for an external document already includes project declarations and the document itself. Use that result directly and build generated class commands only after the context reuse check. Cover both project and local class resolution through an external document, including isolation from project callers.
@milkeclair
milkeclair force-pushed the feat/class-diagnostics branch from 6bc33c6 to 3ea96d7 Compare November 17, 2026 10:52
Preserve the shared embedded-code pipeline and immutable LSP structure while integrating class hydration, final-AST indexes and diagnostic targets. Keep the upstream hydration fast paths and function discovery reuse.
Verify that the shared embedded-code result retains the class index and references its returned AST. Describe native-function providers and class diagnostics in terms of the common code-program analysis introduced on main.
@milkeclair milkeclair self-assigned this Nov 17, 2026
@milkeclair milkeclair added the enhancement New feature or request label Nov 17, 2026
@milkeclair
milkeclair marked this pull request as ready for review November 17, 2026 23:49

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant