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