old->new prelude
This commit is contained in:
parent
77635685ab
commit
a87fa6bd3f
1709
assets/prelude.ld
1709
assets/prelude.ld
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -403,7 +403,7 @@ function __wbg_get_imports() {
|
|||
_assertBoolean(ret);
|
||||
return ret;
|
||||
};
|
||||
imports.wbg.__wbindgen_closure_wrapper8194 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
imports.wbg.__wbindgen_closure_wrapper8195 = function() { return logError(function (arg0, arg1, arg2) {
|
||||
const ret = makeMutClosure(arg0, arg1, 363, __wbg_adapter_20);
|
||||
return ret;
|
||||
}, arguments) };
|
||||
|
|
BIN
pkg/rudus_bg.wasm
(Stored with Git LFS)
BIN
pkg/rudus_bg.wasm
(Stored with Git LFS)
Binary file not shown.
|
@ -1,6 +1,5 @@
|
|||
use crate::ast::{Ast, StringPart};
|
||||
use crate::chunk::{Chunk, StrPattern};
|
||||
use crate::errors::line_number;
|
||||
use crate::op::Op;
|
||||
use crate::spans::Spanned;
|
||||
use crate::value::*;
|
||||
|
@ -1115,6 +1114,7 @@ impl Compiler {
|
|||
self.emit_op(Op::Spawn);
|
||||
}
|
||||
Receive(clauses) => {
|
||||
self.msg("********starting receive".to_string());
|
||||
let tail_pos = self.tail_pos;
|
||||
self.emit_op(Op::ClearMessage);
|
||||
let receive_begin = self.len();
|
||||
|
@ -1158,7 +1158,8 @@ impl Compiler {
|
|||
}
|
||||
self.pop_n(self.stack_depth - stack_depth);
|
||||
self.emit_op(Op::Load);
|
||||
self.stack_depth += 1;
|
||||
// self.stack_depth += 1;
|
||||
self.msg("********receive completed".to_string());
|
||||
}
|
||||
MatchClause(..) => unreachable!(),
|
||||
Fn(name, body, doc) => {
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
use phf::phf_map;
|
||||
use rudus::value::Value;
|
||||
use std::env;
|
||||
|
||||
const KEYWORDS: phf::Map<&'static str, Value> = phf_map! {
|
||||
"ok" => Value::keyword("ok"),
|
||||
"err" => Value::keyword("err"),
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
env::set_var("RUST_BACKTRACE", "1");
|
||||
println!("Hello, world.")
|
||||
|
|
|
@ -103,10 +103,16 @@ impl<'a> Validator<'a> {
|
|||
}
|
||||
|
||||
fn declare_fn(&mut self, name: String) {
|
||||
if name.is_empty() {
|
||||
return;
|
||||
}
|
||||
self.locals.push((name, self.span, FnInfo::Declared));
|
||||
}
|
||||
|
||||
fn define_fn(&mut self, name: String, info: FnInfo) {
|
||||
if name.is_empty() {
|
||||
return;
|
||||
}
|
||||
let i = self.locals.iter().position(|(n, ..)| *n == name).unwrap();
|
||||
let new_binding = (name, self.locals[i].1, info);
|
||||
self.locals[i] = new_binding;
|
||||
|
|
15
src/vm.rs
15
src/vm.rs
|
@ -305,7 +305,7 @@ impl Creature {
|
|||
unreachable!("expected keyword pid in monitor");
|
||||
};
|
||||
if other != self.pid {
|
||||
self.unlink(Value::Keyword(other));
|
||||
self.do_unlink(Value::Keyword(other));
|
||||
let mut other = self.zoo.borrow_mut().catch(other);
|
||||
other.parents.push(self.pid);
|
||||
self.zoo.borrow_mut().release(other);
|
||||
|
@ -322,6 +322,11 @@ impl Creature {
|
|||
}
|
||||
|
||||
fn unlink(&mut self, other: Value) {
|
||||
self.do_unlink(other);
|
||||
self.push(Value::Keyword("ok"))
|
||||
}
|
||||
|
||||
fn do_unlink(&mut self, other: Value) {
|
||||
let Value::Keyword(other) = other else {
|
||||
unreachable!("expected keyword pid in unlink")
|
||||
};
|
||||
|
@ -331,7 +336,6 @@ impl Creature {
|
|||
other.delete_from_siblings(self.pid);
|
||||
self.zoo.borrow_mut().release(other);
|
||||
}
|
||||
self.push(Value::Keyword("ok"))
|
||||
}
|
||||
|
||||
fn link(&mut self, other: Value) {
|
||||
|
@ -1324,7 +1328,12 @@ impl Creature {
|
|||
}
|
||||
Return => {
|
||||
if self.debug {
|
||||
console_log!("== returning from {} ==", self.frame.function.show())
|
||||
console_log!("== returning from {} ==", self.frame.function.show());
|
||||
let destination = match self.call_stack.last() {
|
||||
Some(frame) => frame.function.as_fn().name(),
|
||||
None => "toplevel",
|
||||
};
|
||||
console_log!("== returning to {destination} ==");
|
||||
}
|
||||
let mut value = Value::Nothing;
|
||||
swap(&mut self.register[0], &mut value);
|
||||
|
|
Loading…
Reference in New Issue
Block a user