Skip to content

Add method body with cfg and locals#346

Merged
Lipen merged 2 commits into
neofrom
lipen/body-locals
Aug 20, 2025
Merged

Add method body with cfg and locals#346
Lipen merged 2 commits into
neofrom
lipen/body-locals

Conversation

@Lipen
Copy link
Copy Markdown
Member

@Lipen Lipen commented Aug 18, 2025

This PR adds val body: EtsMethodBody with CFG and locals (taken from IR).

Note that all "locals" (that could be found in IR) that do not present in this list of locals, are actually not locals, but probably global variables or other out of scope refs. For example x := 42 when method.body.locals list does not contain x, actually means "modify the global variable x", not local.

@Lipen Lipen requested review from CaelmBleidd and Copilot August 18, 2025 13:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR restructures the ETS method model by introducing a EtsMethodBody class that encapsulates both CFG (Control Flow Graph) and locals information, moving away from the direct cfg property on EtsMethod. The body contains locals extracted from IR, where missing locals indicate global variables rather than local ones.

  • Introduces EtsMethodBody class containing CFG and locals
  • Updates method building to populate locals from IR during conversion
  • Maintains backward compatibility with deprecated _cfg property

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
Method.kt Adds EtsMethodBody class and refactors EtsMethod interface to use body instead of direct CFG property
Convert.kt Updates method builder to extract locals from DTO and populate method body with both CFG and locals
EtsCfgDslTest.kt Updates test to use new method.body.cfg instead of deprecated method._cfg

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Aug 18, 2025

Test Results

  217 files  ±0    217 suites  ±0   15m 54s ⏱️ +2s
  729 tests ±0    717 ✅ ±0  12 💤 ±0  0 ❌ ±0 
1 997 runs  ±0  1 947 ✅ ±0  50 💤 ±0  0 ❌ ±0 

Results for commit acfc880. ± Comparison against base commit 0a50288.

♻️ This comment has been updated with latest results.

@Lipen Lipen merged commit f16b931 into neo Aug 20, 2025
7 checks passed
@Lipen Lipen deleted the lipen/body-locals branch August 20, 2025 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants