Refactor series implementation into its own module

This commit reorganizes the series-related code by moving the
`RingBuffer`, `ScalarSeries`, `ValueSeries`, `RecordSeries`,
`SeriesView`, and `SharedSeries` structs into a new
`src/ast/rtl/series/data.rs` file.

The `src/ast/rtl/series/mod.rs` file now contains the module
declaration, re-exports, and the `register` function for registering
series-related native functions with the environment. This improves code
organization and maintainability.
This commit is contained in:
2026-03-22 21:22:56 +01:00
parent 09ae98728f
commit 99b540c84e
4 changed files with 684 additions and 676 deletions
+9 -6
View File
@@ -19,7 +19,7 @@ use crate::ast::compiler::lambda_collector::LambdaCollector;
use crate::ast::compiler::lowering::Lowering;
use crate::ast::compiler::macros::{MacroEvaluator, MacroExpander, MacroRegistry};
use crate::ast::compiler::optimizer::Optimizer;
use crate::ast::compiler::specializer::{FunctionRegistry, MonoCache, Specializer};
use crate::ast::compiler::specializer::{FunctionRegistry, MonoCache, RtlLookupFunc, Specializer};
use crate::ast::rtl::{self, intrinsics};
use crate::ast::types::{
NativeFunction, NodeIdentity, Purity, SourceLocation, StaticType, Value,
@@ -28,8 +28,12 @@ use crate::ast::types::{
use crate::ast::diagnostics::{DiagnosticLevel, Diagnostics};
pub type PipelineGenerator = Box<dyn FnMut() -> bool>;
const SYSTEM_LIB_SOURCE: &str = include_str!("system.myc");
const SYSTEM_LIB_PATH: &str = "<embedded>/system.myc";
const SYSTEM_LIB_SOURCE: &str = include_str!("rtl/prelude.myc");
const SYSTEM_LIB_PATH: &str = "<embedded>/prelude.myc";
fn make_rtl_lookup() -> RtlLookupFunc {
Rc::new(|name: &str, args: &[StaticType]| intrinsics::lookup(name, args))
}
pub struct CompilationResult {
pub ast: Option<TypedNode>,
@@ -707,7 +711,7 @@ impl Environment {
analyzed_registry: self.typed_function_registry.clone(),
});
let rtl_lookup = Rc::new(|name: &str, args: &[StaticType]| intrinsics::lookup(name, args));
let rtl_lookup = make_rtl_lookup();
let typed_reg = self.typed_function_registry.clone();
let mono_cache = self.monomorph_cache.clone();
let root_values = self.root_values.clone();
@@ -755,8 +759,7 @@ impl Environment {
let sub_registry = Rc::new(EnvFunctionRegistry {
analyzed_registry: typed_reg.clone(),
});
let sub_rtl_lookup =
Rc::new(|name: &str, args: &[StaticType]| intrinsics::lookup(name, args));
let sub_rtl_lookup = make_rtl_lookup();
let sub_specializer = Specializer::new(
Some(sub_registry),