mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
remove function names
This commit is contained in:
parent
09bddc4610
commit
2e1a209815
@ -42,7 +42,7 @@ function leafNode(node, parent, state, cb) {}
|
||||
// TODO: docs
|
||||
var walkers = exports.walkers = {};
|
||||
|
||||
walkers[Syntax.ArrayExpression] = function arrayExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.ArrayExpression] = function(node, parent, state, cb) {
|
||||
for (var i = 0, l = node.elements.length; i < l; i++) {
|
||||
var e = node.elements[i];
|
||||
if (e) {
|
||||
@ -52,7 +52,7 @@ walkers[Syntax.ArrayExpression] = function arrayExpression(node, parent, state,
|
||||
};
|
||||
|
||||
// TODO: verify correctness
|
||||
walkers[Syntax.ArrayPattern] = function arrayPattern(node, parent, state, cb) {
|
||||
walkers[Syntax.ArrayPattern] = function(node, parent, state, cb) {
|
||||
for (var i = 0, l = node.elements.length; i < l; i++) {
|
||||
var e = node.elements[i];
|
||||
// must be an identifier or an expression
|
||||
@ -62,8 +62,7 @@ walkers[Syntax.ArrayPattern] = function arrayPattern(node, parent, state, cb) {
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ArrowFunctionExpression] =
|
||||
function arrowFunctionExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.ArrowFunctionExpression] = function(node, parent, state, cb) {
|
||||
var i;
|
||||
var l;
|
||||
|
||||
@ -87,17 +86,17 @@ walkers[Syntax.ArrowFunctionExpression] =
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.AssignmentExpression] = function assignmentExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.AssignmentExpression] = function(node, parent, state, cb) {
|
||||
cb(node.left, node, state);
|
||||
cb(node.right, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.BinaryExpression] = function binaryExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.BinaryExpression] = function(node, parent, state, cb) {
|
||||
cb(node.left, node, state);
|
||||
cb(node.right, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.BlockStatement] = function blockStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.BlockStatement] = function(node, parent, state, cb) {
|
||||
for (var i = 0, l = node.body.length; i < l; i++) {
|
||||
cb(node.body[i], node, state);
|
||||
}
|
||||
@ -105,7 +104,7 @@ walkers[Syntax.BlockStatement] = function blockStatement(node, parent, state, cb
|
||||
|
||||
walkers[Syntax.BreakStatement] = leafNode;
|
||||
|
||||
walkers[Syntax.CallExpression] = function callExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.CallExpression] = function(node, parent, state, cb) {
|
||||
var i;
|
||||
var l;
|
||||
|
||||
@ -121,7 +120,7 @@ walkers[Syntax.CatchClause] = leafNode;
|
||||
|
||||
walkers[Syntax.ClassBody] = walkers[Syntax.BlockStatement];
|
||||
|
||||
walkers[Syntax.ClassDeclaration] = function classDeclaration(node, parent, state, cb) {
|
||||
walkers[Syntax.ClassDeclaration] = function(node, parent, state, cb) {
|
||||
if (node.id) {
|
||||
cb(node.id, node, state);
|
||||
}
|
||||
@ -141,8 +140,7 @@ walkers[Syntax.ClassExpression] = walkers[Syntax.ClassDeclaration];
|
||||
walkers[Syntax.ComprehensionBlock] = walkers[Syntax.AssignmentExpression];
|
||||
|
||||
// TODO: verify correctness
|
||||
walkers[Syntax.ComprehensionExpression] =
|
||||
function comprehensionExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.ComprehensionExpression] = function(node, parent, state, cb) {
|
||||
cb(node.body, node, state);
|
||||
|
||||
if (node.filter) {
|
||||
@ -154,7 +152,7 @@ walkers[Syntax.ComprehensionExpression] =
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ConditionalExpression] = function conditionalExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.ConditionalExpression] = function(node, parent, state, cb) {
|
||||
cb(node.test, node, state);
|
||||
cb(node.consequent, node, state);
|
||||
cb(node.alternate, node, state);
|
||||
@ -164,7 +162,7 @@ walkers[Syntax.ContinueStatement] = leafNode;
|
||||
|
||||
walkers[Syntax.DebuggerStatement] = leafNode;
|
||||
|
||||
walkers[Syntax.DoWhileStatement] = function doWhileStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.DoWhileStatement] = function(node, parent, state, cb) {
|
||||
cb(node.test, node, state);
|
||||
cb(node.body, node, state);
|
||||
};
|
||||
@ -173,7 +171,7 @@ walkers[Syntax.EmptyStatement] = leafNode;
|
||||
|
||||
walkers[Syntax.ExportBatchSpecifier] = leafNode;
|
||||
|
||||
walkers[Syntax.ExportDeclaration] = function exportDeclaration(node, parent, state, cb) {
|
||||
walkers[Syntax.ExportDeclaration] = function(node, parent, state, cb) {
|
||||
var i;
|
||||
var l;
|
||||
|
||||
@ -194,7 +192,7 @@ walkers[Syntax.ExportDeclaration] = function exportDeclaration(node, parent, sta
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ExportSpecifier] = function exportSpecifier(node, parent, state, cb) {
|
||||
walkers[Syntax.ExportSpecifier] = function(node, parent, state, cb) {
|
||||
if (node.id) {
|
||||
cb(node.id, node, state);
|
||||
}
|
||||
@ -204,11 +202,11 @@ walkers[Syntax.ExportSpecifier] = function exportSpecifier(node, parent, state,
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ExpressionStatement] = function expressionStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.ExpressionStatement] = function(node, parent, state, cb) {
|
||||
cb(node.expression, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.ForInStatement] = function forInStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.ForInStatement] = function(node, parent, state, cb) {
|
||||
cb(node.left, node, state);
|
||||
cb(node.right, node, state);
|
||||
cb(node.body, node, state);
|
||||
@ -216,7 +214,7 @@ walkers[Syntax.ForInStatement] = function forInStatement(node, parent, state, cb
|
||||
|
||||
walkers[Syntax.ForOfStatement] = walkers[Syntax.ForInStatement];
|
||||
|
||||
walkers[Syntax.ForStatement] = function forStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.ForStatement] = function(node, parent, state, cb) {
|
||||
if (node.init) {
|
||||
cb(node.init, node, state);
|
||||
}
|
||||
@ -238,7 +236,7 @@ walkers[Syntax.FunctionExpression] = walkers[Syntax.ArrowFunctionExpression];
|
||||
|
||||
walkers[Syntax.Identifier] = leafNode;
|
||||
|
||||
walkers[Syntax.IfStatement] = function ifStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.IfStatement] = function(node, parent, state, cb) {
|
||||
cb(node.test, node, state);
|
||||
cb(node.consequent, node, state);
|
||||
if (node.alternate) {
|
||||
@ -246,7 +244,7 @@ walkers[Syntax.IfStatement] = function ifStatement(node, parent, state, cb) {
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ImportDeclaration] = function importDeclaration(node, parent, state, cb) {
|
||||
walkers[Syntax.ImportDeclaration] = function(node, parent, state, cb) {
|
||||
var i;
|
||||
var l;
|
||||
|
||||
@ -263,12 +261,12 @@ walkers[Syntax.ImportDeclaration] = function importDeclaration(node, parent, sta
|
||||
|
||||
walkers[Syntax.ImportSpecifier] = walkers[Syntax.ExportSpecifier];
|
||||
|
||||
walkers[Syntax.LabeledStatement] = function labeledStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.LabeledStatement] = function(node, parent, state, cb) {
|
||||
cb(node.body, node, state);
|
||||
};
|
||||
|
||||
// TODO: add scope info??
|
||||
walkers[Syntax.LetStatement] = function letStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.LetStatement] = function(node, parent, state, cb) {
|
||||
for (var i = 0, l = node.head.length; i < l; i++) {
|
||||
var head = node.head[i];
|
||||
cb(head.id, node, state);
|
||||
@ -284,14 +282,14 @@ walkers[Syntax.Literal] = leafNode;
|
||||
|
||||
walkers[Syntax.LogicalExpression] = walkers[Syntax.BinaryExpression];
|
||||
|
||||
walkers[Syntax.MemberExpression] = function memberExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.MemberExpression] = function(node, parent, state, cb) {
|
||||
cb(node.object, node, state);
|
||||
if (node.property) {
|
||||
cb(node.property, node, state);
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.MethodDefinition] = function methodDefinition(node, parent, state, cb) {
|
||||
walkers[Syntax.MethodDefinition] = function(node, parent, state, cb) {
|
||||
if (node.key) {
|
||||
cb(node.key, node, state);
|
||||
}
|
||||
@ -301,7 +299,7 @@ walkers[Syntax.MethodDefinition] = function methodDefinition(node, parent, state
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ModuleDeclaration] = function moduleDeclaration(node, parent, state, cb) {
|
||||
walkers[Syntax.ModuleDeclaration] = function(node, parent, state, cb) {
|
||||
if (node.id) {
|
||||
cb(node.id, node, state);
|
||||
}
|
||||
@ -317,7 +315,7 @@ walkers[Syntax.ModuleDeclaration] = function moduleDeclaration(node, parent, sta
|
||||
|
||||
walkers[Syntax.NewExpression] = walkers[Syntax.CallExpression];
|
||||
|
||||
walkers[Syntax.ObjectExpression] = function objectExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.ObjectExpression] = function(node, parent, state, cb) {
|
||||
for (var i = 0, l = node.properties.length; i < l; i++) {
|
||||
cb(node.properties[i], node, state);
|
||||
}
|
||||
@ -327,32 +325,32 @@ walkers[Syntax.ObjectPattern] = walkers[Syntax.ObjectExpression];
|
||||
|
||||
walkers[Syntax.Program] = walkers[Syntax.BlockStatement];
|
||||
|
||||
walkers[Syntax.Property] = function property(node, parent, state, cb) {
|
||||
walkers[Syntax.Property] = function(node, parent, state, cb) {
|
||||
// move leading comments from key to property node
|
||||
moveComments(node.key, node);
|
||||
|
||||
cb(node.value, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.ReturnStatement] = function returnStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.ReturnStatement] = function(node, parent, state, cb) {
|
||||
if (node.argument) {
|
||||
cb(node.argument, node, state);
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.SequenceExpression] = function sequenceExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.SequenceExpression] = function(node, parent, state, cb) {
|
||||
for (var i = 0, l = node.expressions.length; i < l; i++) {
|
||||
cb(node.expressions[i], node, state);
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.SpreadElement] = function spreadElement(node, parent, state, cb) {
|
||||
walkers[Syntax.SpreadElement] = function(node, parent, state, cb) {
|
||||
if (node.argument) {
|
||||
cb(node.argument, node, state);
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.SwitchCase] = function switchCase(node, parent, state, cb) {
|
||||
walkers[Syntax.SwitchCase] = function(node, parent, state, cb) {
|
||||
if (node.test) {
|
||||
cb(node.test, node, state);
|
||||
}
|
||||
@ -362,7 +360,7 @@ walkers[Syntax.SwitchCase] = function switchCase(node, parent, state, cb) {
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.SwitchStatement] = function switchStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.SwitchStatement] = function(node, parent, state, cb) {
|
||||
cb(node.discriminant, node, state);
|
||||
|
||||
for (var i = 0, l = node.cases.length; i < l; i++) {
|
||||
@ -370,8 +368,7 @@ walkers[Syntax.SwitchStatement] = function switchStatement(node, parent, state,
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.TaggedTemplateExpression] =
|
||||
function taggedTemplateExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.TaggedTemplateExpression] = function(node, parent, state, cb) {
|
||||
if (node.tag) {
|
||||
cb(node.tag, node, state);
|
||||
}
|
||||
@ -382,7 +379,7 @@ walkers[Syntax.TaggedTemplateExpression] =
|
||||
|
||||
walkers[Syntax.TemplateElement] = leafNode;
|
||||
|
||||
walkers[Syntax.TemplateLiteral] = function templateLiteral(node, parent, state, cb) {
|
||||
walkers[Syntax.TemplateLiteral] = function(node, parent, state, cb) {
|
||||
var i;
|
||||
var l;
|
||||
|
||||
@ -401,11 +398,11 @@ walkers[Syntax.TemplateLiteral] = function templateLiteral(node, parent, state,
|
||||
|
||||
walkers[Syntax.ThisExpression] = leafNode;
|
||||
|
||||
walkers[Syntax.ThrowStatement] = function throwStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.ThrowStatement] = function(node, parent, state, cb) {
|
||||
cb(node.argument, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.TryStatement] = function tryStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.TryStatement] = function(node, parent, state, cb) {
|
||||
var i;
|
||||
var l;
|
||||
|
||||
@ -430,13 +427,13 @@ walkers[Syntax.TryStatement] = function tryStatement(node, parent, state, cb) {
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.UnaryExpression] = function unaryExpression(node, parent, state, cb) {
|
||||
walkers[Syntax.UnaryExpression] = function(node, parent, state, cb) {
|
||||
cb(node.argument, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.UpdateExpression] = walkers[Syntax.UnaryExpression];
|
||||
|
||||
walkers[Syntax.VariableDeclaration] = function variableDeclaration(node, parent, state, cb) {
|
||||
walkers[Syntax.VariableDeclaration] = function(node, parent, state, cb) {
|
||||
// move leading comments to first declarator
|
||||
moveComments(node, node.declarations[0]);
|
||||
|
||||
@ -445,7 +442,7 @@ walkers[Syntax.VariableDeclaration] = function variableDeclaration(node, parent,
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.VariableDeclarator] = function variableDeclarator(node, parent, state, cb) {
|
||||
walkers[Syntax.VariableDeclarator] = function(node, parent, state, cb) {
|
||||
cb(node.id, node, state);
|
||||
|
||||
if (node.init) {
|
||||
@ -455,7 +452,7 @@ walkers[Syntax.VariableDeclarator] = function variableDeclarator(node, parent, s
|
||||
|
||||
walkers[Syntax.WhileStatement] = walkers[Syntax.DoWhileStatement];
|
||||
|
||||
walkers[Syntax.WithStatement] = function withStatement(node, parent, state, cb) {
|
||||
walkers[Syntax.WithStatement] = function(node, parent, state, cb) {
|
||||
cb(node.object, node, state);
|
||||
cb(node.body, node, state);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user