Add unknown ranges and open object values

This commit is contained in:
2026-08-14 08:00:22 +09:00
parent 8c50dd202d
commit 848c7f169f
53 changed files with 9047 additions and 6572 deletions
+16 -21
View File
@@ -1,7 +1,7 @@
use alloc::{string::String, vec::Vec};
use crate::{
Ast, ExprId, HostValue, SourceForm, SourceId,
Ast, ExprId, SourceForm, SourceId, Value,
runtime::{EnvId, ThunkId},
};
@@ -17,23 +17,18 @@ pub struct Module {
pub root_thunk: ThunkId,
}
#[derive(Debug, Clone)]
pub struct LoadedSource {
pub key: String,
pub name: String,
pub source: String,
}
#[derive(Debug, Clone)]
pub struct LoadedValue {
pub key: String,
pub value: HostValue,
}
/// Content resolved by an [`ImportLoader`].
#[derive(Debug, Clone)]
pub enum LoadedImport {
Source(LoadedSource),
Value(LoadedValue),
Source {
key: String,
name: String,
source: String,
},
Value {
key: String,
value: Value,
},
}
/// An import specifier offered by host-owned language tooling.
@@ -63,18 +58,18 @@ impl LoadedImport {
name: impl Into<String>,
source: impl Into<String>,
) -> Self {
Self::Source(LoadedSource {
Self::Source {
key: key.into(),
name: name.into(),
source: source.into(),
})
}
}
pub fn value(key: impl Into<String>, value: HostValue) -> Self {
Self::Value(LoadedValue {
pub fn value(key: impl Into<String>, value: Value) -> Self {
Self::Value {
key: key.into(),
value,
})
}
}
}