mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-26 15:32:16 +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": {
|
"no-misused-new": {
|
||||||
"severity": "error"
|
"severity": "error"
|
||||||
},
|
},
|
||||||
"no-object-literal-type-assertion": {
|
|
||||||
"severity": "error"
|
|
||||||
},
|
|
||||||
"no-require-imports": {
|
"no-require-imports": {
|
||||||
"severity": "error"
|
"severity": "error"
|
||||||
},
|
},
|
||||||
|
@ -275,14 +275,33 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 36)
|
(i32.const 36)
|
||||||
(i32.const 23)
|
(i32.const 26)
|
||||||
(i32.const 2)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(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)
|
(local $0 i32)
|
||||||
(set_global $~lib/allocator/arena/startOffset
|
(set_global $~lib/allocator/arena/startOffset
|
||||||
(i32.and
|
(i32.and
|
||||||
@ -322,5 +341,16 @@
|
|||||||
(call $object-literal/bar2
|
(call $object-literal/bar2
|
||||||
(get_local $0)
|
(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() {
|
constructor() {
|
||||||
this.bar = 1;
|
this.bar = 1;
|
||||||
}
|
}
|
||||||
|
test(): void {
|
||||||
|
assert(this.bar == 3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bar2(foo: Foo2): void {
|
function bar2(foo: Foo2): void {
|
||||||
assert(foo.bar == 2);
|
assert(foo.bar == 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
bar2({ bar: 2 });
|
bar2(<Foo2>{ bar: 2 });
|
||||||
|
|
||||||
|
(<Foo2>{ bar: 3 }).test();
|
||||||
|
@ -308,16 +308,38 @@
|
|||||||
(call $~lib/env/abort
|
(call $~lib/env/abort
|
||||||
(i32.const 0)
|
(i32.const 0)
|
||||||
(i32.const 36)
|
(i32.const 36)
|
||||||
(i32.const 23)
|
(i32.const 26)
|
||||||
(i32.const 2)
|
(i32.const 2)
|
||||||
)
|
)
|
||||||
(unreachable)
|
(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 $0 i32)
|
||||||
(local $1 i32)
|
(local $1 i32)
|
||||||
|
(local $2 i32)
|
||||||
(set_global $~lib/allocator/arena/startOffset
|
(set_global $~lib/allocator/arena/startOffset
|
||||||
(i32.and
|
(i32.and
|
||||||
(i32.add
|
(i32.add
|
||||||
@ -365,5 +387,19 @@
|
|||||||
(get_local $1)
|
(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