summaryrefslogtreecommitdiff
path: root/src/model/func.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-23 10:54:25 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-23 12:00:06 +0100
commitb2a3d3f235fb5a23322435b854460f52db772114 (patch)
tree441ded5e4fcc0a702fe877fc6a3e3fedaaacabb5 /src/model/func.rs
parent65aa27014d090628cfef14b0679d86dd611188b9 (diff)
More general evaluation interface
Diffstat (limited to 'src/model/func.rs')
-rw-r--r--src/model/func.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/model/func.rs b/src/model/func.rs
index f313dcda..d84a8170 100644
--- a/src/model/func.rs
+++ b/src/model/func.rs
@@ -97,7 +97,9 @@ impl Func {
args: Args,
) -> SourceResult<Value> {
let route = Route::default();
- let mut vm = Vm::new(world, route.track(), None, Scopes::new(None));
+ let id = SourceId::detached();
+ let scopes = Scopes::new(None);
+ let mut vm = Vm::new(world, route.track(), id, scopes);
self.call(&mut vm, args)
}
@@ -178,7 +180,7 @@ impl Hash for Native {
#[derive(Hash)]
pub struct Closure {
/// The source file where the closure was defined.
- pub location: Option<SourceId>,
+ pub location: SourceId,
/// The name of the closure.
pub name: Option<EcoString>,
/// Captured values from outer scopes.
@@ -219,7 +221,7 @@ impl Closure {
}
// Determine the route inside the closure.
- let detached = vm.location.is_none();
+ let detached = vm.location.is_detached();
let fresh = Route::new(self.location);
let route = if detached { fresh.track() } else { vm.route };