diff --git a/lib/6to5/register.js b/lib/6to5/register.js index 553e62a5f9..2cd90de4b9 100644 --- a/lib/6to5/register.js +++ b/lib/6to5/register.js @@ -24,28 +24,28 @@ var blacklist = []; var blacklistTest = function (transformer, code) { try { - eval(code); + new Function(code); blacklist.push(transformer); } catch (err) { if (err.name !== "SyntaxError") throw err; } }; -// array comprehension +blacklistTest("arrayComprehension", "var foo = [for (foo of bar) foo * foo];"); blacklistTest("arrowFunctions", "var foo = x => x * x;"); blacklistTest("classes", "class Foo {}"); -// computed property names -// constants -// defaultParamters -// descturing -// forOf -blacklistTest("generators", "function foo *() {}"); +//blacklistTest("computedPropertyNames", ""); +blacklistTest("constants", "const foo = 0;"); +blacklistTest("defaultParamaters", "var foo = function (bar = 0) {};"); +blacklistTest("destructuring", "var { x, y } = { x: 0, y: 0 };"); +blacklistTest("forOf", "for (var foo of bar) {}"); +blacklistTest("generators", "function* foo() {}"); blacklistTest("letScoping", "let foo = 0;"); -// modules -// propertyMethodAssignment -// propertyNameShorthand -// restParameters -// spread +//blacklistTest("modules", ""); +//blacklistTest("propertyMethodAssignment", ""); +blacklistTest("propertyNameShorthand", "var foo = { x, y };"); +//blacklistTest("restParameters", ""); +//blacklistTest("spread", ""); blacklistTest("templateLiterals", "`foo`"); blacklistTest("unicodeRegex", "/foo/u");