Open
Conversation
- Add CompositeType tracking to TranslationContext - Add currentClassName for tracking context during method translation - Update translateType to handle UserDefined types (classes) - Implement field access via Attribute expressions (self.field) - Handle constructor calls: Class() -> new Class + __init__() - Add helper functions: extractClassFields, translateMethod, translateClass - Implement two-pass translation: collect classes first, then translate - Add classes to program's type definitions Test: test_class_decl.py now passes (7 assertions)
Handles: self.field = value and obj.field = value Previously only AnnAssign supported field assignments. Now Assign statements can target Attribute expressions (field access). Impact: +4 benchmarks now translate (21→25, 42%→50%)
Contributor
ssomayyajula
left a comment
There was a problem hiding this comment.
Almost everything looks standard to me, but what is this issue with "hoisting" of holes that keeps occurring for? Should that be a separate pass?
oyendrila-dobe
previously approved these changes
Feb 25, 2026
oyendrila-dobe
left a comment
There was a problem hiding this comment.
LGTM.
Can we add a note to credit kiro-cli for the all the code changes related to handling of class declaration?
thanhnguyen-aws
previously approved these changes
Feb 26, 2026
aqjune-aws
previously approved these changes
Feb 27, 2026
thanhnguyen-aws
previously approved these changes
Feb 27, 2026
shigoel
previously approved these changes
Feb 27, 2026
This reverts commit 064c1c8.
cbb534d
aqjune-aws
approved these changes
Feb 27, 2026
thanhnguyen-aws
approved these changes
Feb 27, 2026
aqjune-aws
approved these changes
Feb 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add Basic Class Declaration Support to Python → Laurel Translation
Implements foundational support for Python class declarations in the Python → Laurel → Core translation pipeline. This PR focuses on getting the basic class infrastructure working, with field initialization and access deferred to future work.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.