plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


2f51682 — Peter John 2026-11-10T19:24:51+05:30
Driver: fusionRun is driveNotes then inPlaceRun; a mangled comment in native
compiler/core/src/native.rs CHANGED
@@ -98,7 +98,7 @@ pub fn isNative(f: &Fn) -> bool {
98
98
  /// its folders, lower-cased, so `std/math/math.plum`'s `sqrt` is `math.sqrt` wherever the
99
99
  /// file is. A function of no file (an in-memory source) is just `name`.
100
100
  pub fn qualifiedName(f: &Fn) -> String {
101
- // A built-in's is not the module mark of a renamed function ().
101
+ // A built-in's leading `@` is not the module mark of a renamed function (`clear@gfx`).
102
102
  if f.type_param.is_none() && f.name.starts_with('@') {
103
103
  return f.name.clone();
104
104
  }
compiler/driver/src/lib.rs CHANGED
@@ -121,24 +121,14 @@ pub fn fusionNotesWith(copy: &mut Source, fbip: bool) -> Vec<String> {
121
121
  /// `fusionNotesWith`, and the errors of the `fip fun`s whose spreads the
122
122
  /// proof left as copies (see `plum_core::fip`). Needs `fbip`; without it nothing is enforced.
123
123
  pub fn fusionRun(copy: &mut Source, fbip: bool) -> (Vec<String>, Vec<Diagnostic>) {
124
+ // the `fip fun`s' own spreads, read before fusion builds callees' spreads into them
124
125
  let origins = plum_core::fip::origins(copy);
125
- // A build never runs `test` blocks (`plum test` lowers them to fns first, so none is left
126
- // here): their calls must not make production code copy.
127
- copy.items.retain(|i| !matches!(i, plum_core::ast::Item::Test(_)));
128
- let mut errors = Vec::new();
126
+ let mut notes = driveNotes(copy);
129
- let pure = plum_core::timing::time("purity", || plum_core::purity::pureFns(copy));
130
- let mut notes = plum_core::timing::time("simplify", || plum_core::simplify::simplify(copy, &pure));
131
- notes.extend(plum_core::timing::time("drive", || plum_core::drive::drive(copy, &pure)));
132
- if fbip {
127
+ if !fbip {
133
- let rep = plum_core::timing::time("uniqueness", || plum_core::uniqueness::markUnique(copy));
134
- notes.extend(rep.versions.iter().cloned());
135
- notes.extend(rep.proved.iter().map(|l| format!("unique spread at {l}")));
136
- notes.extend(rep.unproved.iter().map(|(l, why)| format!("uniqueness: not in place {l}: {why}")));
137
- errors = plum_core::timing::time("fip", || plum_core::fip::diagnostics(copy, &rep, &origins));
138
- notes.retain(|n| !n.is_empty());
128
+ return (notes, Vec::new());
139
- notes.extend(plum_core::timing::time("reuse", || plum_core::reuse::markReuse(copy)));
140
129
  }
130
+ let (more, errors) = inPlaceRun(copy, Some(&origins));
141
- notes.retain(|n| !n.is_empty());
131
+ notes.extend(more);
142
132
  (notes, errors)
143
133
  }
144
134