Skip to content

feat(vm): a function's scope and parameters, public - #40

Merged
dylan-sutton-chavez merged 1 commit into
mainfrom
api-scopes
Oct 19, 2026
Merged

dylan-sutton-chavez merged 1 commit into
mainfrom
api-scopes

Conversation

@dylan-sutton-chavez

@dylan-sutton-chavez dylan-sutton-chavez commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Makes public what the VM already resolves, for tools that lower Edge bytecode: VM::scope_of(body) gives a function's index and its FnScope (each slot's Kind, cellvars, freevars), and VM::params_of(fi) its parameters with their ParamKind and slot. Kind, FnScope and ParamKind become public; nothing is recomputed. is_jump and exc_parents were already public.

Summary by CodeRabbit

  • New Features
    • Added public access to function scope information and resolved parameter kinds and slots.
    • Made scope classifications and function scope details available to consumers of the library.

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5174618e-ab5c-4dae-94b8-c5f44463ff9c
📥 Commits

Reviewing files that changed from the base of the PR and between a17b3b2 and 00eec95.

📒 Files selected for processing: 3
  • src/vm/mod.rs
  • src/vm/scope.rs
  • tests/tables.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The VM now exposes function scope and parameter metadata through public types and accessors. A test checks scope classification, parameter kinds, captured variables, and behavior for the module chunk.

Changes: VM Scope Metadata

Layer / File(s) Summary
Expose scope and parameter metadata
src/vm/mod.rs, src/vm/scope.rs, tests/tables.rs
Kind, FnScope, and ParamKind are public. VM::scope_of returns the indexed function scope for a body chunk, and VM::params_of exposes parameter kinds and slots. The test checks resolved scope classifications, parameter kinds, and that the module chunk has no function scope.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 00eec

The new queries expose the VM-resolved scope and parameter data, with positional-only information still available from the function body. No actionable merge risk was found.

Security architecture risk: ⚪ Minimal · up to 00eec

The new APIs expose existing function metadata through read-only references. The reviewed changes do not add execution privileges, mutable access to VM state, or a new guest-code entrypoint. No material security risk was identified in this contract expansion.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The added exposure is resolved code metadata available to Rust callers already holding a VM reference. The accessor implementations do not return runtime variable values, credentials, heap objects, or authority to execute functions.

Trust Boundaries and Controls

  • observed — Both accessors borrow the VM immutably and return shared metadata references. Although FnScope has public fields, the returned shared reference does not grant mutation of the VM-owned scope, and the lookup converts the supplied body reference to a map key without dereferencing a raw pointer.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title accurately identifies the main change: public VM access to a function's scope and parameters.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@dylan-sutton-chavez
dylan-sutton-chavez merged commit 9b26eb5 into main Oct 19, 2026
16 checks passed
@dylan-sutton-chavez
dylan-sutton-chavez deleted the api-scopes branch October 19, 2026 06:27
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.

1 participant