implement dynamic key; implement __curPos; other small changes
This commit is contained in:
+13
-12
@@ -143,14 +143,14 @@ impl<T: VmRuntimeCtx> ConvertValueWithSeen for T {
|
||||
Value::String(ns.as_str().to_owned())
|
||||
} else if let Some(attrs) = val.as_gc::<AttrSet>() {
|
||||
let bits = val.to_bits();
|
||||
if attrs.entries.borrow().is_empty() {
|
||||
if attrs.entries.is_empty() {
|
||||
return Value::AttrSet(Default::default());
|
||||
}
|
||||
if !seen.insert(bits) {
|
||||
return Value::Repeated;
|
||||
}
|
||||
let mut map = std::collections::BTreeMap::new();
|
||||
for &(key, val) in attrs.entries.borrow().iter() {
|
||||
for &(key, val) in attrs.entries.iter() {
|
||||
let key = self.resolve_string(key).to_owned();
|
||||
let converted = self.convert_value_with_seen(val, seen);
|
||||
map.insert(fix_common::Symbol::from(key), converted);
|
||||
@@ -265,11 +265,6 @@ impl OperandData {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) enum AttrKeyData {
|
||||
Static(StringId),
|
||||
Dynamic,
|
||||
}
|
||||
|
||||
fn init_builtins<'gc>(mc: &Mutation<'gc>, ctx: &mut impl VmRuntimeCtx) -> Value<'gc> {
|
||||
let mut entries = SmallVec::with_capacity(BUILTINS.len());
|
||||
|
||||
@@ -471,7 +466,6 @@ impl<'gc> Vm<'gc> {
|
||||
match *state {
|
||||
ThunkState::Pending { ip, env, with_env } => {
|
||||
*state = ThunkState::Blackhole;
|
||||
drop(state);
|
||||
self.call_stack.push(CallFrame {
|
||||
thunk: Some(thunk),
|
||||
stack_depth: depth,
|
||||
@@ -485,13 +479,21 @@ impl<'gc> Vm<'gc> {
|
||||
Step::Break(Break::Force)
|
||||
}
|
||||
ThunkState::Evaluated(v) => {
|
||||
drop(state);
|
||||
self.replace(depth, v.relax());
|
||||
Step::Continue(())
|
||||
}
|
||||
ThunkState::Apply { .. } => todo!("force apply"),
|
||||
ThunkState::Apply { func, arg } => {
|
||||
self.call_stack.push(CallFrame {
|
||||
thunk: Some(thunk),
|
||||
stack_depth: depth,
|
||||
pc: resume_pc,
|
||||
env: self.env,
|
||||
with_env: self.with_env,
|
||||
});
|
||||
self.push(func);
|
||||
self.call(reader, mc, arg, resume_pc)
|
||||
},
|
||||
ThunkState::Blackhole => {
|
||||
drop(state);
|
||||
self.finish_err(Error::eval_error("infinite recursion encountered"))
|
||||
}
|
||||
}
|
||||
@@ -676,7 +678,6 @@ impl<'gc> Vm<'gc> {
|
||||
LoadBuiltins => self.op_load_builtins(),
|
||||
LoadBuiltin => self.op_load_builtin(&mut reader),
|
||||
|
||||
MkPos => self.op_mk_pos(&mut reader),
|
||||
LoadReplBinding => self.op_load_repl_binding(&mut reader),
|
||||
LoadScopedBinding => self.op_load_scoped_binding(&mut reader),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user