Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace this in object methods #247

Merged
merged 9 commits into from
Feb 6, 2025
Merged

Conversation

SarahIsWeird
Copy link
Contributor

@SarahIsWeird SarahIsWeird commented Feb 3, 2025

Adds the functionality from #181.

Here's my test script, feel free to try to break it some more :)
export default () => {
    const foo = {
        a() {
            this.b = 1
        }
    };

    class MyClass {
        field = {
            a() {
                this.b = 1
            }
        }

        foo() {
            return {
                a() {
                    this.b = 1
                }
            }
        }
    }

    const iTakeAnObjectArgument = ({ a }) => {
        a()
    }

    iTakeAnObjectArgument({
        a() {
            this.b = 1
        }
    })

    let hello = {
        a() {
            this.b = 1
        }
    }

    const bye = hello
    hello = ':('

    return {
        foo,
        bar: {
            a() {
                this.b = 1
            }
        },
        baz: () => ({
            a() {
                this.b = 1
            }
        }),
        thingy: (() => ({
            a() {
                this.b = 1
            }
        }))(),
        whatever: function () {
            return {
                a() {
                    this.b = 1
                }
            }
        },
        MyClass,
        hello,
        bye,
    };
};

@samualtnorman samualtnorman merged commit ae53eb7 into samualtnorman:main Feb 6, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants