Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ under the licensing terms detailed in LICENSE:
* Max Graey <maxgraey@gmail.com>
* Igor Sbitnev <PinkaminaDianePie@gmail.com>
* Norton Wang <me@nortonwang.com>
* Alan Pierce <alangpierce@gmail.com>

Portions of this software are derived from third-party works licensed under
the following terms:
Expand Down
4 changes: 2 additions & 2 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4411,7 +4411,7 @@ export class Compiler extends DiagnosticEmitter {
return module.createBlock(null, [
module.createSetLocal(tempLocalIndex, valueWithCorrectType),
module.createStore(
type.size >> 3,
type.byteSize,
thisExpr,
module.createGetLocal(tempLocalIndex, nativeType),
nativeType,
Expand All @@ -4421,7 +4421,7 @@ export class Compiler extends DiagnosticEmitter {
], nativeType);
} else {
return module.createStore(
type.size >> 3,
type.byteSize,
thisExpr,
valueWithCorrectType,
nativeType,
Expand Down
16 changes: 16 additions & 0 deletions tests/compiler/class-with-boolean-field.optimized.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(module
(type $i (func (result i32)))
(memory $0 1)
(export "test" (func $class-with-boolean-field/test))
(export "memory" (memory $0))
(func $class-with-boolean-field/test (; 0 ;) (type $i) (result i32)
(local $0 i32)
(i32.store8
(get_local $0)
(i32.const 1)
)
(i32.load8_u
(get_local $0)
)
)
)
9 changes: 9 additions & 0 deletions tests/compiler/class-with-boolean-field.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class A {
boolValue: bool;
}

export function test(): bool {
let a: A;
a.boolValue = true;
return a.boolValue;
}
20 changes: 20 additions & 0 deletions tests/compiler/class-with-boolean-field.untouched.wat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(module
(type $i (func (result i32)))
(global $HEAP_BASE i32 (i32.const 4))
(memory $0 1)
(export "test" (func $class-with-boolean-field/test))
(export "memory" (memory $0))
(func $class-with-boolean-field/test (; 0 ;) (type $i) (result i32)
(local $0 i32)
(nop)
(i32.store8
(get_local $0)
(i32.const 1)
)
(return
(i32.load8_u
(get_local $0)
)
)
)
)