Skip to content

Comments

Enable subscripting for bytes type in eldritch-core#1382

Merged
KCarretto merged 3 commits intomainfrom
bytes-subscript-12243308108492668480
Dec 24, 2025
Merged

Enable subscripting for bytes type in eldritch-core#1382
KCarretto merged 3 commits intomainfrom
bytes-subscript-12243308108492668480

Conversation

@google-labs-jules
Copy link
Contributor

This PR updates the eldritch-core interpreter to support subscripting (indexing and slicing) for the bytes type (Value::Bytes).

Changes:

  • Modified implants/lib/eldritchv2/eldritch-core/src/interpreter/eval/access.rs:
    • In evaluate_index: Added a match arm for Value::Bytes. It returns the byte value at the specified index as a Value::Int, supporting negative indexing.
    • In evaluate_slice: Added a match arm for Value::Bytes. It returns a new Value::Bytes containing the sliced byte vector, supporting start, stop, and step arguments.
  • Added implants/lib/eldritchv2/eldritch-core/tests/bytes_subscript.rs: A new integration test file to verify indexing and slicing behavior for bytes.

This aligns the behavior of bytes more closely with Python's bytes type.


PR created automatically by Jules for task 12243308108492668480 started by @KCarretto

Updated `evaluate_index` and `evaluate_slice` in `implants/lib/eldritchv2/eldritch-core/src/interpreter/eval/access.rs` to support `Value::Bytes`.
This allows indexing (e.g., `b[0]`) which returns an integer, and slicing (e.g., `b[0:5]`) which returns a new `bytes` object.
Added a new test file `implants/lib/eldritchv2/eldritch-core/tests/bytes_subscript.rs` to verify the functionality.
Verified with existing tests.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

Updated `evaluate_index` and `evaluate_slice` in `implants/lib/eldritchv2/eldritch-core/src/interpreter/eval/access.rs` to support `Value::Bytes`.
This allows indexing (e.g., `b[0]`) which returns an integer, and slicing (e.g., `b[0:5]`) which returns a new `bytes` object.
Added a new test file `implants/lib/eldritchv2/eldritch-core/tests/bytes_subscript.rs` to verify the functionality.
Verified with existing tests.
@KCarretto KCarretto marked this pull request as ready for review December 24, 2025 00:08
@KCarretto KCarretto requested review from Cictrone and hulto December 24, 2025 00:08
Copy link
Collaborator

@hulto hulto left a comment

Choose a reason for hiding this comment

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

Slay

@KCarretto KCarretto merged commit 42ccc79 into main Dec 24, 2025
5 checks passed
@KCarretto KCarretto deleted the bytes-subscript-12243308108492668480 branch December 24, 2025 03:59
nullmonk pushed a commit that referenced this pull request Dec 24, 2025
* feat: Enable subscripting for bytes type in eldritch-core

Updated `evaluate_index` and `evaluate_slice` in `implants/lib/eldritchv2/eldritch-core/src/interpreter/eval/access.rs` to support `Value::Bytes`.
This allows indexing (e.g., `b[0]`) which returns an integer, and slicing (e.g., `b[0:5]`) which returns a new `bytes` object.
Added a new test file `implants/lib/eldritchv2/eldritch-core/tests/bytes_subscript.rs` to verify the functionality.
Verified with existing tests.

* feat: Enable subscripting for bytes type in eldritch-core

Updated `evaluate_index` and `evaluate_slice` in `implants/lib/eldritchv2/eldritch-core/src/interpreter/eval/access.rs` to support `Value::Bytes`.
This allows indexing (e.g., `b[0]`) which returns an integer, and slicing (e.g., `b[0:5]`) which returns a new `bytes` object.
Added a new test file `implants/lib/eldritchv2/eldritch-core/tests/bytes_subscript.rs` to verify the functionality.
Verified with existing tests.

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: KCarretto <Kcarretto@gmail.com>
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.

2 participants