more reliable t.isExpression
This commit is contained in:
parent
470c8fced0
commit
383912c11b
@ -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"]
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -3,8 +3,8 @@ var test = {
|
||||
* Before bracket init
|
||||
*/
|
||||
["a"]: "1",
|
||||
[/*
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b"]: "2"
|
||||
[( /*
|
||||
* Inside bracket init
|
||||
*/
|
||||
"b")]: "2"
|
||||
}, ok = 42;
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user