Permalink
Browse files

[[Fix]] Do not disable ES6 when `moz` is set

Although environments implementing Mozilla extensions are not
necessarily ES6-compliant, they are not mutually exclusive. Ensure that
for configurations that specify both ES6 and `moz`, the semantics of
both environments are applied consistently.
  • Loading branch information...
jugglinmike committed Dec 6, 2015
1 parent 46db923 commit 97dfd90c57d415c9356b08297a553bd8d5669fa6
Showing with 22 additions and 2 deletions.
  1. +2 −2 src/state.js
  2. +20 −0 tests/unit/options.js
@@ -22,11 +22,11 @@ var state = {

/**
* @param {boolean} strict - When `true`, only consider ES6 when in
* "esversion: 6" code and *not* in "moz".
* "esversion: 6" code.
*/
inES6: function(strict) {
if (strict) {
return !this.option.moz && this.option.esversion === 6;
return this.option.esversion === 6;
}
return this.option.moz || this.option.esversion >= 6;
},
@@ -1939,6 +1939,26 @@ exports.esnext = function (test) {
test.done();
};

// The `moz` option should not preclude ES6
exports.mozAndEs6 = function (test) {
var src = [
"var x = () => {};",
"function* toArray(...rest) {",
" void new.target;",
" yield rest;",
"}",
"var y = [...x];"
];

TestRun(test)
.test(src, { esversion: 6 });

TestRun(test)
.test(src, { esversion: 6, moz: true });

test.done();
};

/*
* Tests the `maxlen` option
*/

0 comments on commit 97dfd90

Please sign in to comment.