mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-06-22 03:01:55 +00:00
Getters & setters (static); Instantiate compiler tests; Cleanup
This commit is contained in:
16
tests/compiler/getter-setter.ts
Normal file
16
tests/compiler/getter-setter.ts
Normal file
@ -0,0 +1,16 @@
|
||||
class Foo {
|
||||
static _bar: i32 = 0;
|
||||
|
||||
static get bar(): i32 {
|
||||
return Foo._bar;
|
||||
}
|
||||
|
||||
static set bar(bar: i32) {
|
||||
Foo._bar = bar;
|
||||
}
|
||||
}
|
||||
|
||||
assert(Foo.bar == 0);
|
||||
Foo.bar = 1;
|
||||
assert(Foo.bar == 1);
|
||||
assert((Foo.bar = 2) == 2);
|
Reference in New Issue
Block a user