DanielXMoore / Civet

A TypeScript superset that favors more types and less typing

Home Page:https://civet.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`get #x` requires newline, not semicolon

bbrk24 opened this issue · comments

This compiles:

class Dummy
  #x: number
  get #x
  private set #x

This does not:

class Dummy
  #x: number
  get #x; private set #x

Currently, ; private set #x is being treated as a body to the get. Example where this is more obvious (also with another bug — missing ; before return):

class Dummy
  #x: number
  get #x; set #x
---
class Dummy {
  #x: number
  get x() {; set(this.#x)return this.#x }
}

I agree this is a bit counterintuitive, but I'm trying to understand the general rule that's being violated. Perhaps a body of ; should be treated as complete?