Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

Suggestion: add local aliasing for this #2

@egonelbre

Description

@egonelbre

This test

type test struct {
    value string
}

func (t *test) get() string {
    return t.value
}

Currently translates to:

function test(value) {
        this.value=value
}

test.prototype.get = function() {
        return this.value;
}

It would be probably better to translate into:

function test(value) {
        this.value=value
}

test.prototype.get = function() {
        var t = this;
        return t.value;
}

If you are at some point doing anon. functions then handling of this can get quite complicated otherwise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions