@@ -72,12 +72,25 @@ module.exports = function(context) {
72
72
} ;
73
73
stack . push ( frame ) ;
74
74
let funcName ;
75
+ let className ;
75
76
if ( node . type === "FunctionDeclaration" ) {
76
77
funcName = node . id . name ;
77
78
} else if ( node . type === "FunctionExpression" || node . type === "ArrowFunctionExpression" ) {
78
79
// Try to get function name...
79
80
const parentType = node . parent ? node . parent . type : undefined ;
80
81
switch ( parentType ) {
82
+ case "MethodDefinition" :
83
+ const methodName = node . parent . key . name ;
84
+ if ( node . parent . static ) {
85
+ if ( node . parent . parent . type === "ClassBody" &&
86
+ node . parent . parent . parent . type === "ClassDeclaration" ) {
87
+ className = node . parent . parent . parent . id . name ;
88
+ }
89
+ } else {
90
+ className = "this" ;
91
+ }
92
+ funcName = methodName ;
93
+ break ;
81
94
case "AssignmentExpression" :
82
95
if ( node . parent . operator === "=" && node . parent . left . type === "Identifier" ) {
83
96
funcName = node . parent . left . name ;
@@ -92,7 +105,11 @@ module.exports = function(context) {
92
105
}
93
106
94
107
if ( funcName ) {
95
- setFuncProp ( callingFrame , funcName , PROP . ASYNC , node . async || false ) ;
108
+ if ( className ) {
109
+ setFuncProp ( callingFrame , className + "." + funcName , PROP . ASYNC , node . async || false ) ;
110
+ } else {
111
+ setFuncProp ( callingFrame , funcName , PROP . ASYNC , node . async || false ) ;
112
+ }
96
113
if ( node . async ) {
97
114
const reportNodeIfAsync = isFuncFailedIfAsync ( funcName ) ;
98
115
if ( reportNodeIfAsync ) {
@@ -144,8 +161,17 @@ module.exports = function(context) {
144
161
// We have a function call within an async function...
145
162
const parentIsAwait = node . parent && node . parent . type === "AwaitExpression" ;
146
163
const parentIsAssign = node . parent && ( [ "AssignmentExpression" , "VariableDeclarator" ] . indexOf ( node . parent . type ) !== - 1 ) ;
147
- const calledFunctionName = node . callee . name ;
148
164
if ( assignmentRequired ? parentIsAssign : ! parentIsAwait ) {
165
+ let calledFunctionName = node . callee . name ;
166
+ if ( node . callee . type === "MemberExpression" ) {
167
+ let instName ;
168
+ if ( node . callee . object . type === "ThisExpression" ) {
169
+ instName = "this" ;
170
+ } else if ( node . callee . object . type === "Identifier" ) {
171
+ instName = node . callee . object . name ;
172
+ }
173
+ calledFunctionName = instName + "." + node . callee . property . name ;
174
+ }
149
175
// That is called without await...
150
176
const calledFuncIsAsync = isFuncAsync ( calledFunctionName ) ;
151
177
if ( calledFuncIsAsync === undefined ) {
0 commit comments