mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
Legalize casting object literals to classes when linting
This commit is contained in:
parent
29081b6323
commit
c636eddcd2
2
dist/asc.js
vendored
2
dist/asc.js
vendored
File diff suppressed because one or more lines are too long
2
dist/asc.js.map
vendored
2
dist/asc.js.map
vendored
File diff suppressed because one or more lines are too long
@ -73,9 +73,6 @@
|
||||
"no-misused-new": {
|
||||
"severity": "error"
|
||||
},
|
||||
"no-object-literal-type-assertion": {
|
||||
"severity": "error"
|
||||
},
|
||||
"no-require-imports": {
|
||||
"severity": "error"
|
||||
},
|
||||
|
@ -275,14 +275,33 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 36)
|
||||
(i32.const 23)
|
||||
(i32.const 26)
|
||||
(i32.const 2)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 6 ;) (type $v)
|
||||
(func $object-literal/Foo2#test (; 6 ;) (type $iv) (param $0 i32)
|
||||
(if
|
||||
(i32.ne
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 36)
|
||||
(i32.const 21)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 7 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(set_global $~lib/allocator/arena/startOffset
|
||||
(i32.and
|
||||
@ -322,5 +341,16 @@
|
||||
(call $object-literal/bar2
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.store
|
||||
(tee_local $0
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
(call $object-literal/Foo2#test
|
||||
(get_local $0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -17,10 +17,15 @@ class Foo2 {
|
||||
constructor() {
|
||||
this.bar = 1;
|
||||
}
|
||||
test(): void {
|
||||
assert(this.bar == 3);
|
||||
}
|
||||
}
|
||||
|
||||
function bar2(foo: Foo2): void {
|
||||
assert(foo.bar == 2);
|
||||
}
|
||||
|
||||
bar2({ bar: 2 });
|
||||
bar2(<Foo2>{ bar: 2 });
|
||||
|
||||
(<Foo2>{ bar: 3 }).test();
|
||||
|
@ -308,16 +308,38 @@
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 36)
|
||||
(i32.const 23)
|
||||
(i32.const 26)
|
||||
(i32.const 2)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 6 ;) (type $v)
|
||||
(func $object-literal/Foo2#test (; 6 ;) (type $iv) (param $0 i32)
|
||||
(if
|
||||
(i32.eqz
|
||||
(i32.eq
|
||||
(i32.load
|
||||
(get_local $0)
|
||||
)
|
||||
(i32.const 3)
|
||||
)
|
||||
)
|
||||
(block
|
||||
(call $~lib/env/abort
|
||||
(i32.const 0)
|
||||
(i32.const 36)
|
||||
(i32.const 21)
|
||||
(i32.const 4)
|
||||
)
|
||||
(unreachable)
|
||||
)
|
||||
)
|
||||
)
|
||||
(func $start (; 7 ;) (type $v)
|
||||
(local $0 i32)
|
||||
(local $1 i32)
|
||||
(local $2 i32)
|
||||
(set_global $~lib/allocator/arena/startOffset
|
||||
(i32.and
|
||||
(i32.add
|
||||
@ -365,5 +387,19 @@
|
||||
(get_local $1)
|
||||
)
|
||||
)
|
||||
(call $object-literal/Foo2#test
|
||||
(block (result i32)
|
||||
(set_local $2
|
||||
(call $~lib/allocator/arena/allocate_memory
|
||||
(i32.const 4)
|
||||
)
|
||||
)
|
||||
(i32.store
|
||||
(get_local $2)
|
||||
(i32.const 3)
|
||||
)
|
||||
(get_local $2)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user