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

Throw Expressions (Stage 2) #23

Open
2 tasks done
hzoo opened this issue Jul 28, 2017 · 5 comments
Open
2 tasks done

Throw Expressions (Stage 2) #23

hzoo opened this issue Jul 28, 2017 · 5 comments

Comments

@hzoo
Copy link
Member

hzoo commented Jul 28, 2017

Champions: Ron Buckton (@rbuckton)
Spec Repo: https://github.com/rbuckton/proposal-throw-expressions
First presented at the July 2017 meeting: https://github.com/tc39/agendas/blob/master/2017/07.md
Stage 1 to Stage 2 at Sept 2017 meeting

Examples:

function save(filename = throw new TypeError("Argument required")) {}
lint(ast, { 
  with: () => throw new Error("avoid using 'with' statements.")
});
function getEncoder(encoding) {
  const encoder = encoding === "utf8" ? new UTF8Encoder() 
                : encoding === "utf16le" ? new UTF16Encoder(false) 
                : encoding === "utf16be" ? new UTF16Encoder(true) 
                : throw new Error("Unsupported encoding");
}
class Product {
  get id() { return this._id; }
  set id(value) { this._id = value || throw new Error("Invalid value"); }
}

Implementation

@hzoo hzoo mentioned this issue Jul 28, 2017
10 tasks
@ljharb
Copy link
Member

ljharb commented Jul 28, 2017

Note there's an open question on throw x, y as well as its precedence, so you may want to hold off on implementing this.

@jridgewell
Copy link
Member

Babylon: babel/babylon#740

@hzoo hzoo changed the title Throw Expressions (Stage 1) Throw Expressions (Stage 2) Sep 27, 2017
@jridgewell
Copy link
Member

Babel: babel/babel#6325

@hzoo hzoo mentioned this issue Sep 28, 2017
11 tasks
@hzoo
Copy link
Member Author

hzoo commented Sep 29, 2017

Ok merged the parser/plugin and moved to Stage 2 preset in master

@jridgewell
Copy link
Member

Can you add to proposals readme?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants