Enable subscripting for bytes type in eldritch-core#1382
Conversation
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.
|
👋 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 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.
* 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>
This PR updates the
eldritch-coreinterpreter to support subscripting (indexing and slicing) for thebytestype (Value::Bytes).Changes:
implants/lib/eldritchv2/eldritch-core/src/interpreter/eval/access.rs:evaluate_index: Added a match arm forValue::Bytes. It returns the byte value at the specified index as aValue::Int, supporting negative indexing.evaluate_slice: Added a match arm forValue::Bytes. It returns a newValue::Bytescontaining the sliced byte vector, supporting start, stop, and step arguments.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
bytesmore closely with Python'sbytestype.PR created automatically by Jules for task 12243308108492668480 started by @KCarretto