diff --git a/lib/6to5/types/alias-keys.json b/lib/6to5/types/alias-keys.json index 19cec9ca23..56ad154225 100644 --- a/lib/6to5/types/alias-keys.json +++ b/lib/6to5/types/alias-keys.json @@ -17,23 +17,23 @@ "ExportDeclaration": ["Statement", "Declaration"], "ImportDeclaration": ["Statement", "Declaration"], - "ArrowFunctionExpression": ["Scope", "Function"], + "ArrowFunctionExpression": ["Scope", "Function", "Expression"], "FunctionDeclaration": ["Statement", "Declaration", "Scope", "Function"], - "FunctionExpression": ["Scope", "Function"], + "FunctionExpression": ["Scope", "Function", "Expression"], "BlockStatement": ["Statement", "Scope"], "Program": ["Scope"], "CatchClause": ["Scope"], - "LogicalExpression": ["Binary"], - "BinaryExpression": ["Binary"], + "LogicalExpression": ["Binary", "Expression"], + "BinaryExpression": ["Binary", "Expression"], - "UnaryExpression": ["UnaryLike"], + "UnaryExpression": ["UnaryLike", "Expression"], "SpreadProperty": ["UnaryLike"], "SpreadElement": ["UnaryLike"], "ClassDeclaration": ["Statement", "Declaration", "Class"], - "ClassExpression": ["Class"], + "ClassExpression": ["Class", "Expression"], "ForOfStatement": ["Statement", "For", "Scope", "Loop"], "ForInStatement": ["Statement", "For", "Scope", "Loop"], @@ -43,5 +43,27 @@ "ArrayPattern": ["Pattern"], "Property": ["UserWhitespacable"], - "XJSElement": ["UserWhitespacable"] + "XJSElement": ["UserWhitespacable", "Expression"], + + "ArrayExpression": ["Expression"], + "AssignmentExpression": ["Expression"], + "AwaitExpression": ["Expression"], + "BindFunctionExpression": ["Expression"], + "BindMemberExpression": ["Expression"], + "CallExpression": ["Expression"], + "ComprehensionExpression": ["Expression"], + "ConditionalExpression": ["Expression"], + "Identifier": ["Expression"], + "Literal": ["Expression"], + "MemberExpression": ["Expression"], + "NewExpression": ["Expression"], + "ObjectExpression": ["Expression"], + "SequenceExpression": ["Expression"], + "TaggedTemplateExpression": ["Expression"], + "ThisExpression": ["Expression"], + "UpdateExpression": ["Expression"], + "VirtualPropertyExpression": ["Expression"], + "XJSEmptyExpression": ["Expression"], + "XJSMemberExpression": ["Expression"], + "YieldExpression": ["Expression"] } diff --git a/lib/6to5/types/index.js b/lib/6to5/types/index.js index 16ae144200..c5d66ecb1f 100644 --- a/lib/6to5/types/index.js +++ b/lib/6to5/types/index.js @@ -66,14 +66,6 @@ _.each(t.FLIPPED_ALIAS_KEYS, function (types, type) { // -t.isExpression = function (node) { - return !t.isStatement(node); -}; - -addAssert("Expression", t.isExpression); - -// - t.isFalsyExpression = function (node) { if (t.isLiteral(node)) { return !node.value; diff --git a/test/fixtures/generation/comments/computed-property-comments-2/expected.js b/test/fixtures/generation/comments/computed-property-comments-2/expected.js index 285ad050f3..abfa5fb5c4 100644 --- a/test/fixtures/generation/comments/computed-property-comments-2/expected.js +++ b/test/fixtures/generation/comments/computed-property-comments-2/expected.js @@ -3,8 +3,8 @@ var test = { * Before bracket init */ ["a"]: "1", - [/* - * Inside bracket init - */ - "b"]: "2" + [( /* + * Inside bracket init + */ + "b")]: "2" }, ok = 42; diff --git a/test/fixtures/generation/comments/computed-property-comments/expected.js b/test/fixtures/generation/comments/computed-property-comments/expected.js index c6ffd441f8..177f5a9146 100644 --- a/test/fixtures/generation/comments/computed-property-comments/expected.js +++ b/test/fixtures/generation/comments/computed-property-comments/expected.js @@ -4,10 +4,10 @@ var test = { */ ["a"]: "1", - [/* - * Inside bracket init - */ - "b"]: "2", + [( /* + * Inside bracket init + */ + "b")]: "2", ["c" /* @@ -17,9 +17,9 @@ var test = { // Before bracket, line comment ["d"]: "4", - [ + [( // Inside bracket, line comment - "e"]: "5", + "e")]: "5", ["f" // After bracket, line comment