ericmckean / traceur-compiler

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

Module bodies that do not reference this can be simplified #189

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently:

module m {
  export var x = 42;
}

=>

var m = (function() {
  "use strict";
  var x = 42;
  return Object.preventExtensions(Object.create(null, {x: {
      get: function() {
        return x;
      },
      enumerable: true
    }}));
}).call(this);

can be changed to:

var m = (function() {
  "use strict";
  var x = 42;
  return Object.preventExtensions(Object.create(null, {x: {
      get: function() {
        return x;
      },
      enumerable: true
    }}));
})();

Original issue reported on code.google.com by arv@chromium.org on 29 Dec 2012 at 7:50

GoogleCodeExporter commented 9 years ago

Original comment by arv@chromium.org on 29 Dec 2012 at 7:50