mirror of
https://git.sfja.dk/Mikkel/slige.git
synced 2025-01-30 15:10:51 +00:00
fix explicit copy move
This commit is contained in:
parent
5d6b1abefc
commit
9cb145d97e
@ -13,7 +13,7 @@ class LocalExpliciter {
|
||||
private copyable: boolean;
|
||||
|
||||
public constructor(private fn: Fn, private local: Local) {
|
||||
this.copyable = copyableIsType(local.vtype);
|
||||
this.copyable = copyableIsType(this.local.vtype);
|
||||
}
|
||||
|
||||
public pass() {
|
||||
@ -23,7 +23,7 @@ class LocalExpliciter {
|
||||
}
|
||||
|
||||
private explicitSrc(src: RValue): RValue {
|
||||
if (src.type !== "local") {
|
||||
if (src.type !== "local" || src.id !== this.local.id) {
|
||||
return src;
|
||||
}
|
||||
return this.copyable
|
||||
@ -41,8 +41,10 @@ function copyableIsType(vtype: VType): boolean {
|
||||
case "int":
|
||||
case "bool":
|
||||
case "string":
|
||||
return true;
|
||||
case "ref":
|
||||
case "ref_mut":
|
||||
return false;
|
||||
case "ptr":
|
||||
case "ptr_mut":
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user