Skip to content

Commit

Permalink
remove private property with respect to the Unique philosophy
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 8, 2020
1 parent 04a2841 commit 8759fc8
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions experimental/class-features.md
Expand Up @@ -21,24 +21,20 @@ interface PropertyDefinition <: Node {
value: Expression | null;
computed: boolean;
static: boolean;
private: boolean;
}
```

- When `private` is `true`, `computed` must be `false` and `key` must be a `PrivateIdentifier`.
- When `private` is `false`, `key` must be an `Expression` and can not be a `PrivateIdentifier`.
- When `key` is a `PrivateIdentifier`, `computed` must be `false`.

## MethodDefinition

```js
extend interface MethodDefinition {
key: Expression | PrivateIdentifier;
private: boolean;
}
```

- When `private` is `true`, `computed` must be `false`, `key` must be a `PrivateIdentifier`, `kind` can not be `"constructor"`.
- When `private` is `false`, `key` must be an `Expression` and can not be a `PrivateIdentifier`.
- When `key` is a `PrivateIdentifier`, `computed` must be `false` and `kind` can not be `"constructor"`.

### PrivateIdentifier

Expand All @@ -49,18 +45,16 @@ interface PrivateIdentifier <: Node {
}
```

A private name refers to private class elements. For a private name `#a`, its `name` is `a`.
A private identifier refers to private class elements. For a private name `#a`, its `name` is `a`.

```js
extend interface MemberExpression {
private: boolean;
property: Expression | PrivateIdentifier;
}
```

- When `private` is `true`, `property` must be a `PrivateIdentifier`, `computed` must be `false`.
- When `private` is `false`, `property` must be an `Expression` and can not be a `PrivateIdentifier`.
- When `object` is a `Super`, `private` must be `false`.
- When `property` is a `PrivateIdentifier`, `computed` must be `false`.
- When `object` is a `Super`, `property` can not be a `PrivateIdentifier`.

[Class Fields]: https://github.com/tc39/proposal-class-fields
[Static Class Features]: https://github.com/tc39/proposal-static-class-features/
Expand Down

0 comments on commit 8759fc8

Please sign in to comment.