Open
Conversation
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.
Motivation
--includeto be used with--filterso shared helper functions can be reused in filter expressions while preserving filter purity.Description
ScriptStageType::Filterto carry{ script: String, includes: Vec<IncludeFile> }and addIncludeFile { path, content }insrc/config.rs.load_include_filesinsrc/cli.rsand attach loaded includes to filter stages instead of inlining their contents into the expression.RhaiEngine::compile_filter_with_includesinsrc/engine.rswhich compiles the filter as an expression, compiles each include as a script, rejects includes that contain statements, extracts only functions viaclone_functions_only, and merges them into the filter AST.FilterStage::newsignature to accept includes, and add unit tests to validate that includes provide helper functions and that includes with statements are rejected.Testing
cargo fmt --alland formatting completed successfully.cargo clippy --all-targets --all-features -- -D warningswith no warnings treated as errors.cargo testand the full test suite completed with all tests passing (automated unit and integration tests passed).Codex Task