Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Mutating functions are not supported on structs #736

Copy link
Copy link
@wfltaylor

Description

@wfltaylor
Issue body actions

Marking a mutating function on a structure @JS results in a compilation failure in the generated code.

For example, this struct generates code which fails to compile.

@JS struct Counter {

    var number: Int

    @JS public mutating func increment() {
        number += 1
    }

}
@_expose(wasm, "bjs_Counter_increment")
@_cdecl("bjs_Counter_increment")
public func _bjs_Counter_increment() -> Void {
    #if arch(wasm32)
    Counter.bridgeJSLiftParameter().increment() // error: cannot use mutating member on immutable value: function call returns immutable value
    #else
    fatalError("Only available on WebAssembly")
    #endif
}
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.