Skip to content

VM: Implement indexer fallback for missing properties. - #1147

Open
schungx wants to merge 5 commits into
rhaiscript:mainfrom
schungx:vm-impl-prop-indexer-fallback
Open

VM: Implement indexer fallback for missing properties.#1147
schungx wants to merge 5 commits into
rhaiscript:mainfrom
schungx:vm-impl-prop-indexer-fallback

Conversation

@schungx

@schungx schungx commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Right now, the VM does not fallback to trying an indexer (getter or setter) when access to a property failed.

This PR implements this behavior so it'll match the AST walker.

@schungx
schungx requested a review from ImTheSquid August 20, 2026 14:58
@schungx schungx added regression vm Issues related to the Rhai Grain bytecodes compiler and VM. labels Aug 20, 2026

@ImTheSquid ImTheSquid left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Unused variable warnings should be handled through this kinda deal:

fn foo(
#[cfg_attr(feature="no_*", allow(unused))] var: Typ
) {}

Other than that LGTM

@schungx

schungx commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Unused variable warnings should be handled through this kinda deal:

Are there unused? Let me double check... I thought I caught them all...

EDIT: Ah, gotcha.

@schungx

schungx commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator Author

Unused variable warnings should be handled through this kinda deal:

It was too many attributes to put on the parameters, I ended up using this:

let _ = (target, key, value, fail_silently, pos);

This will get removed by the compiler during optimization so it won't affect performance.

I see a couple of places in grain that this style is used, so I suppose this is OK! 😆

@schungx
schungx requested a review from ImTheSquid August 21, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

regression vm Issues related to the Rhai Grain bytecodes compiler and VM.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants