plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
e16e8d6
— Peter John
2026-11-03T14:42:42+05:30
own: default isOwn/ownSelf at AST construction sites
- plum-core/src/ctors.rs +3 -0
- plum-core/src/embeds.rs +1 -0
- plum-core/src/forms.rs +2 -0
- plum-core/src/traits.rs +3 -0
- plum-core/src/union_lower.rs +2 -0
- plum-wasm-codegen/src/lib.rs +2 -0
plum-core/src/ctors.rs
CHANGED
|
@@ -380,6 +380,7 @@ pub fn lowerCtors(source: &mut Source) -> Vec<String> {
|
|
|
380
380
|
0,
|
|
381
381
|
));
|
|
382
382
|
newItems.push(Item::Fn(Fn {
|
|
383
|
+
ownSelf: false,
|
|
383
384
|
name: mname,
|
|
384
385
|
file: file.clone(),
|
|
385
386
|
line,
|
|
@@ -398,6 +399,7 @@ pub fn lowerCtors(source: &mut Source) -> Vec<String> {
|
|
|
398
399
|
}
|
|
399
400
|
ctor.push(Stmt::Expr(Expr::Var(r), 0, 0));
|
|
400
401
|
newItems.push(Item::Fn(Fn {
|
|
402
|
+
ownSelf: false,
|
|
401
403
|
name: format!("{}{}", rname, NEW_SUFFIX),
|
|
402
404
|
file,
|
|
403
405
|
line,
|
|
@@ -411,6 +413,7 @@ pub fn lowerCtors(source: &mut Source) -> Vec<String> {
|
|
|
411
413
|
params: nparams
|
|
412
414
|
.iter()
|
|
413
415
|
.map(|(n, t)| Param {
|
|
416
|
+
isOwn: false,
|
|
414
417
|
name: n.clone(),
|
|
415
418
|
ty: paramType(t),
|
|
416
419
|
default: None,
|
plum-core/src/embeds.rs
CHANGED
|
@@ -563,6 +563,7 @@ fn processRecord(source: &mut Source, rname: &str, cx: &mut Ctx) {
|
|
|
563
563
|
cx.standIn.insert(
|
|
564
564
|
rname.to_string(),
|
|
565
565
|
TraitDecl {
|
|
566
|
+
isOwn: false,
|
|
566
567
|
name: rname.to_string(),
|
|
567
568
|
line: init.as_ref().map(|f| f.line).unwrap_or(0),
|
|
568
569
|
column: init.as_ref().map(|f| f.column).unwrap_or(0),
|
plum-core/src/forms.rs
CHANGED
|
@@ -221,6 +221,7 @@ fn seqCheckCopy(f: &Fn) -> Fn {
|
|
|
221
221
|
c.params.insert(
|
|
222
222
|
0,
|
|
223
223
|
Param {
|
|
224
|
+
isOwn: false,
|
|
224
225
|
name: "self".to_string(),
|
|
225
226
|
ty: ParamType::Type(Type {
|
|
226
227
|
name: "List".to_string(),
|
|
@@ -1838,6 +1839,7 @@ fn checkCopy(f: &Fn) -> Fn {
|
|
|
1838
1839
|
None
|
|
1839
1840
|
};
|
|
1840
1841
|
c.params.push(Param {
|
|
1842
|
+
isOwn: false,
|
|
1841
1843
|
name: YIELD_PARAM.to_string(),
|
|
1842
1844
|
ty: ParamType::Fn(yields, ret),
|
|
1843
1845
|
default: None,
|
plum-core/src/traits.rs
CHANGED
|
@@ -23,6 +23,7 @@ fn accessor(
|
|
|
23
23
|
body: FnBody,
|
|
24
24
|
) -> Fn {
|
|
25
25
|
Fn {
|
|
26
|
+
ownSelf: false,
|
|
26
27
|
name,
|
|
27
28
|
file: file.to_string(),
|
|
28
29
|
line: t.line,
|
|
@@ -190,6 +191,7 @@ pub fn lowerTraits(source: &mut Source) -> Vec<String> {
|
|
|
190
191
|
&file,
|
|
191
192
|
t,
|
|
192
193
|
vec![Param {
|
|
194
|
+
isOwn: false,
|
|
193
195
|
name: "v".to_string(),
|
|
194
196
|
ty: ParamType::Type(f.ty.clone()),
|
|
195
197
|
default: None,
|
|
@@ -248,6 +250,7 @@ pub fn lowerTraits(source: &mut Source) -> Vec<String> {
|
|
|
248
250
|
})
|
|
249
251
|
.collect();
|
|
250
252
|
let e = Enum {
|
|
253
|
+
isOwn: false,
|
|
251
254
|
name: t.name.clone(),
|
|
252
255
|
line: t.line,
|
|
253
256
|
column: t.column,
|
plum-core/src/union_lower.rs
CHANGED
|
@@ -674,6 +674,7 @@ fn synthesize(
|
|
|
674
674
|
.params
|
|
675
675
|
.iter()
|
|
676
676
|
.map(|p| Param {
|
|
677
|
+
isOwn: false,
|
|
677
678
|
name: p.name.clone(),
|
|
678
679
|
ty: substParam(&p.ty, &map),
|
|
679
680
|
default: p.default.clone(),
|
|
@@ -710,6 +711,7 @@ fn synthesize(
|
|
|
710
711
|
})
|
|
711
712
|
.collect();
|
|
712
713
|
Some(Fn {
|
|
714
|
+
ownSelf: false,
|
|
713
715
|
name: method.to_string(),
|
|
714
716
|
file: decl.file.clone(),
|
|
715
717
|
line: 0,
|
plum-wasm-codegen/src/lib.rs
CHANGED
|
@@ -1747,6 +1747,7 @@ fn desugarTestsToFns(source: &ast::Source) -> (ast::Source, Vec<(String, String)
|
|
|
1747
1747
|
));
|
|
1748
1748
|
|
|
1749
1749
|
items.push(ast::Item::Fn(ast::Fn {
|
|
1750
|
+
ownSelf: false,
|
|
1750
1751
|
file: source.file.clone(),
|
|
1751
1752
|
name: internal_name.clone(),
|
|
1752
1753
|
line: t.line,
|
|
@@ -2886,6 +2887,7 @@ fn compileSourceInner(
|
|
|
2886
2887
|
|
|
2887
2888
|
for (name, ci, func_idx) in &const_inits {
|
|
2888
2889
|
let stand_in = ast::Fn {
|
|
2890
|
+
ownSelf: false,
|
|
2889
2891
|
file: String::new(),
|
|
2890
2892
|
name: format!("const#{name}"),
|
|
2891
2893
|
line: 0,
|