mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
parse decorators (#1165)
This change allows decorators to be parsed, but it does not add information about decorators to the generated documentation.
This commit is contained in:
parent
b719e68907
commit
fb37938b77
@ -8,6 +8,7 @@ var parserOptions = exports.parserOptions = {
|
||||
ranges: true,
|
||||
sourceType: 'module',
|
||||
plugins: [
|
||||
'decorators2',
|
||||
'doExpressions',
|
||||
'estree',
|
||||
'jsx',
|
||||
|
||||
@ -21,6 +21,7 @@ exports.Syntax = {
|
||||
ConditionalExpression: 'ConditionalExpression',
|
||||
ContinueStatement: 'ContinueStatement',
|
||||
DebuggerStatement: 'DebuggerStatement',
|
||||
Decorator: 'Decorator',
|
||||
DoExpression: 'DoExpression',
|
||||
DoWhileStatement: 'DoWhileStatement',
|
||||
EmptyStatement: 'EmptyStatement',
|
||||
|
||||
@ -149,6 +149,12 @@ walkers[Syntax.ClassDeclaration] = function(node, parent, state, cb) {
|
||||
if (node.body) {
|
||||
cb(node.body, node, state);
|
||||
}
|
||||
|
||||
if (node.decorators) {
|
||||
for (var i = 0, l = node.decorators.length; i < l; i++) {
|
||||
cb(node.decorators[i], node, state);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ClassExpression] = walkers[Syntax.ClassDeclaration];
|
||||
@ -179,6 +185,10 @@ walkers[Syntax.ContinueStatement] = leafNode;
|
||||
|
||||
walkers[Syntax.DebuggerStatement] = leafNode;
|
||||
|
||||
walkers[Syntax.Decorator] = function(node, parent, state, cb) {
|
||||
cb(node.expression, node, state);
|
||||
};
|
||||
|
||||
walkers[Syntax.DoExpression] = function(node, parent, state, cb) {
|
||||
cb(node.body, node, state);
|
||||
};
|
||||
@ -406,6 +416,12 @@ walkers[Syntax.MethodDefinition] = function(node, parent, state, cb) {
|
||||
if (node.value) {
|
||||
cb(node.value, node, state);
|
||||
}
|
||||
|
||||
if (node.decorators) {
|
||||
for (var i = 0, l = node.decorators.length; i < l; i++) {
|
||||
cb(node.decorators[i], node, state);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.ModuleDeclaration] = function(node, parent, state, cb) {
|
||||
@ -455,6 +471,12 @@ walkers[Syntax.Property] = function(node, parent, state, cb) {
|
||||
moveLeadingComments(node.key, node);
|
||||
|
||||
cb(node.value, node, state);
|
||||
|
||||
if (node.decorators) {
|
||||
for (var i = 0, l = node.decorators.length; i < l; i++) {
|
||||
cb(node.decorators[i], node, state);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
walkers[Syntax.RestElement] = function(node, parent, state, cb) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user