GitHub

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,4 @@

1+

import babelGenerator from 'babel-generator';

12

import AbstractDoc from './AbstractDoc.js';

23

import ParamParser from '../Parser/ParamParser.js';

34

import NamingUtil from '../Util/NamingUtil.js';

@@ -18,8 +19,9 @@ export default class FunctionDoc extends AbstractDoc {

1819
1920

if (this._node.id) {

2021

if (this._node.id.type === 'MemberExpression') {

21-

// todo: can not reproduce this condition.

22-

// this._value.name = ASTUtil.flattenMemberExpression(this._node.id);

22+

// e.g. foo[bar.baz] = function bal(){}

23+

const expression = babelGenerator(this._node.id).code;

24+

this._value.name = `[${expression}]`;

2325

} else {

2426

this._value.name = this._node.id.name;

2527

}

Read the original on github.com ↗