mirror of
https://github.com/bearlanguageorg/bear.git
synced 2026-08-26 15:37:18 +00:00
More buildins and vscode exstention <CO-AUthored, ai>
This commit is contained in:
+28
-21
@@ -12,14 +12,20 @@ mut:
|
||||
val i64
|
||||
}
|
||||
|
||||
// StructVal is a struct (or map) value. `fields` keeps insertion order for
|
||||
// rendering and JSON encoding; `by_name` is a hash index for O(1) field
|
||||
// lookup by name, so map-style access on large records stays fast.
|
||||
struct StructVal {
|
||||
mut:
|
||||
fields []Field
|
||||
fields []Field
|
||||
by_name map[string]int // field name -> index into fields
|
||||
}
|
||||
|
||||
// Handler records a try/catch handler pushed at runtime.
|
||||
struct Closure {
|
||||
entry int // code IP of the function body
|
||||
mut:
|
||||
captured []i64 // values of the enclosing locals this closure captures (by value)
|
||||
}
|
||||
|
||||
struct Handler {
|
||||
@@ -30,26 +36,27 @@ struct Handler {
|
||||
|
||||
struct Vm {
|
||||
mut:
|
||||
code []u8
|
||||
strings []string
|
||||
arrays [][]i64
|
||||
structs []StructVal
|
||||
floats []f64
|
||||
closures []Closure
|
||||
stack []i64
|
||||
sp int
|
||||
bp int
|
||||
ip int
|
||||
trace bool
|
||||
halted bool
|
||||
prog_args []string
|
||||
exit_code i64
|
||||
did_exit bool
|
||||
handlers []Handler
|
||||
lines []obj.LineInfo // debug info: code offset -> source line
|
||||
const_strs int // strings[0..const_strs] are bytecode constants, never collected
|
||||
last_heap int // heap size at the last GC check (allocation trigger)
|
||||
build_root string // directory of the .vrmm build module (build_root() builtin)
|
||||
code []u8
|
||||
strings []string
|
||||
arrays [][]i64
|
||||
structs []StructVal
|
||||
floats []f64
|
||||
closures []Closure
|
||||
stack []i64
|
||||
sp int
|
||||
bp int
|
||||
ip int
|
||||
trace bool
|
||||
halted bool
|
||||
prog_args []string
|
||||
exit_code i64
|
||||
did_exit bool
|
||||
handlers []Handler
|
||||
lines []obj.LineInfo // debug info: code offset -> source line
|
||||
fns []obj.BinFn // function table (for stack traces)
|
||||
const_strs int // strings[0..const_strs] are bytecode constants, never collected
|
||||
last_heap int // heap size at the last GC check (allocation trigger)
|
||||
build_root string // directory of the .vrmm build module (build_root() builtin)
|
||||
}
|
||||
|
||||
fn bool_i64(b bool) i64 {
|
||||
|
||||
Reference in New Issue
Block a user