mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-21 18:51:43 +00:00
Implement reference counting (#592)
This commit is contained in:
30
tests/compiler/constant-assign.ts
Normal file
30
tests/compiler/constant-assign.ts
Normal file
@ -0,0 +1,30 @@
|
||||
// Expect error: TS2540
|
||||
// ^ TODO: Properly handle multiple
|
||||
|
||||
function localConst(a: i32): void {
|
||||
const b = a + 1;
|
||||
b = 3;
|
||||
}
|
||||
localConst(1);
|
||||
|
||||
function localConstInline(): void {
|
||||
const a = 1;
|
||||
a = 2;
|
||||
}
|
||||
localConstInline();
|
||||
|
||||
function localConstArray(a: i32): void {
|
||||
const b: i32[] = [ a ];
|
||||
b = [ 2 ];
|
||||
}
|
||||
localConstArray(1);
|
||||
|
||||
function localConstArrayInline(): void {
|
||||
const a: i32[] = [ 1 ];
|
||||
a = [ 2 ];
|
||||
}
|
||||
localConstArrayInline();
|
||||
|
||||
// globalConst
|
||||
const a = 1;
|
||||
a = 2;
|
Reference in New Issue
Block a user