ericmckean / traceur-compiler

Automatically exported from code.google.com/p/traceur-compiler
Apache License 2.0
0 stars 0 forks source link

Simplif default parameter that defaults to undefined #200

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems like the following will be a common pattern

function f(x = undefined) {}

to document that the param is optional.

It desugars to:

function f() {
  var x = arguments[0] !== (void 0) ? arguments[0]: undefined;
}

We could do a little bit better and do:

function f() {
  var x = arguments[0];
}

Original issue reported on code.google.com by arv@chromium.org on 8 Feb 2013 at 10:40

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/traceur-compiler/source/detail?r=a4e2f73

Original comment by arv@chromium.org on 9 Feb 2013 at 6:39