mirror of
https://github.com/voltrevo/ValueScript.git
synced 2026-04-18 03:00:27 -04:00
Fix SubMov copying
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
//! test_output(2)
|
||||
// Should be: 1
|
||||
|
||||
/// <reference path="../../../concept-code/vs.d.ts" />
|
||||
|
||||
export default function main() {
|
||||
const x = Debug.makeCopyCounter("x");
|
||||
|
||||
let obj: Record<string, unknown> = { x }; // Single copy occurs here
|
||||
obj.y = "y"; // Shouldn't copy, but does
|
||||
let obj: Record<string, unknown> = { x }; // First copy
|
||||
obj.y = "y"; // No extra copy
|
||||
|
||||
let arr: unknown[] = [x]; // Second copy
|
||||
arr[1] = "y"; // No extra copy
|
||||
|
||||
return x.count;
|
||||
}
|
||||
Reference in New Issue
Block a user