8000 @bind decorator bug when super method is called · Issue #12 · developit/decko · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
@bind decorator bug when super method is called #12
Open
@precious

Description

@precious

This snippet demonstrates that the bind decorator does not work correctly on second method call if that method invokes super method which in turn is also decorated:

class A {
    @bind
    f() {
        console.log('I\'m A.f');
    }
}

class B extends A {
    @bind
    f() {
        console.log('I\'m B.f BEGIN');
        super.f();
        console.log('I\'m B.f END');
    }
}

let b = new B();
console.log('call b.f() 1st time:');
b.f();
console.log('call b.f() 2nd time:');
b.f();

Output:

call b.f() 1st time:
I'm B.f BEGIN
I'm A.f
I'm B.f END
call b.f() 2nd time:
I'm A.f

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

      0