eclipse / n4js

Eclipse Public License 1.0
30 stars 27 forks source link

As a user want private member access to be aligned with TypeScript und ECMAScript proposals #1221

Open jpilgrim opened 5 years ago

jpilgrim commented 5 years ago

As a user want private member access to be aligned with TypeScript und ECMAScript proposals. At the moment, we allow private members to be accesses from everywhere within the same module. This is not the case for TypeScript: There, access to a private member is only possible from within the classes -- this includes nested classes (defined by means of class expressions).

In ECMAScript, the concept of private members is not yet in the standard. But related proposals exist:

Not explicitly mentioning the scope it seems as if private members are accessible similar to TypeScript only within the class.

Example in TypeScript:

class C {
    private m() { }
    nested = class X extends C {
        g() {
            this.m(); // no error
        }
    }
}

let c = new C();
c.m(); // error:

class D extends C {
    g() {
        this.m(); // error
    }
}

This task is related to #1047: When doing this task, adjust the things only added as remarks to the spec in 1047. Also check quickfixes related to access modifiers and overriding.

jpilgrim commented 5 years ago

Duplicates #668 (which was closed as duplicate, issue not resolved yet).