@@ -228,7 +228,7 @@ export default class JavascriptEventWorker extends EventWorker {
228228 * Fixes bug: https://github.com/codex-team/hawk.workers/issues/121
229229 */
230230 if ( originalLocation . source ) {
231- console . log ( 'original location source found' )
231+ console . log ( 'original location source found' ) ;
232232 /**
233233 * Get 5 lines above and 5 below
234234 */
@@ -247,40 +247,43 @@ export default class JavascriptEventWorker extends EventWorker {
247247 sourceCode : lines ,
248248 } ) as BacktraceFrame ;
249249 }
250-
250+
251251 /**
252252 * Method that is used to parse full function context of the code position
253+ *
253254 * @param sourceCode - content of the source file
254255 * @param line - number of the line from the stack trace
255256 * @returns - string of the function context or null if it could not be parsed
256257 */
257258 private getFunctionContext ( sourceCode : string , line : number ) : string | null {
258259 let functionName : string | null = null ;
259260 let className : string | null = null ;
260- let isAsync : boolean = false ;
261+ let isAsync = false ;
261262
262263 try {
263264 const ast = parse ( sourceCode , {
264- sourceType : " module" ,
265+ sourceType : ' module' ,
265266 plugins : [
266- " typescript" ,
267- " jsx" ,
268- " classProperties" ,
269- " decorators" ,
270- " optionalChaining" ,
271- " nullishCoalescingOperator" ,
272- " dynamicImport" ,
273- " bigInt" ,
274- " topLevelAwait"
275- ]
267+ ' typescript' ,
268+ ' jsx' ,
269+ ' classProperties' ,
270+ ' decorators' ,
271+ ' optionalChaining' ,
272+ ' nullishCoalescingOperator' ,
273+ ' dynamicImport' ,
274+ ' bigInt' ,
275+ ' topLevelAwait' ,
276+ ] ,
276277 } ) ;
277278
278279 traverse ( ast as any , {
279280 /**
280281 * It is used to get class decorator of the position, it will save class that is related to original position
282+ *
283+ * @param path
281284 */
282285 ClassDeclaration ( path ) {
283- console . log ( `class declaration: loc: ${ path . node . loc } , line: ${ line } , node.start.line: ${ path . node . loc . start . line } , node.end.line: ${ path . node . loc . end . line } ` )
286+ console . log ( `class declaration: loc: ${ path . node . loc } , line: ${ line } , node.start.line: ${ path . node . loc . start . line } , node.end.line: ${ path . node . loc . end . line } ` ) ;
284287
285288 if ( path . node . loc && path . node . loc . start . line <= line && path . node . loc . end . line >= line ) {
286289 className = path . node . id . name || null ;
@@ -289,9 +292,11 @@ export default class JavascriptEventWorker extends EventWorker {
289292 /**
290293 * It is used to get class and its method decorator of the position
291294 * It will save class and method, that are related to original position
295+ *
296+ * @param path
292297 */
293298 ClassMethod ( path ) {
294- console . log ( `class declaration: loc: ${ path . node . loc } , line: ${ line } , node.start.line: ${ path . node . loc . start . line } , node.end.line: ${ path . node . loc . end . line } ` )
299+ console . log ( `class declaration: loc: ${ path . node . loc } , line: ${ line } , node.start.line: ${ path . node . loc . start . line } , node.end.line: ${ path . node . loc . end . line } ` ) ;
295300
296301 if ( path . node . loc && path . node . loc . start . line <= line && path . node . loc . end . line >= line ) {
297302 // Handle different key types
@@ -303,24 +308,28 @@ export default class JavascriptEventWorker extends EventWorker {
303308 } ,
304309 /**
305310 * It is used to get function name that is declared out of class
311+ *
312+ * @param path
306313 */
307314 FunctionDeclaration ( path ) {
308- console . log ( `function declaration: loc: ${ path . node . loc } , line: ${ line } , node.start.line: ${ path . node . loc . start . line } , node.end.line: ${ path . node . loc . end . line } ` )
309-
315+ console . log ( `function declaration: loc: ${ path . node . loc } , line: ${ line } , node.start.line: ${ path . node . loc . start . line } , node.end.line: ${ path . node . loc . end . line } ` ) ;
316+
310317 if ( path . node . loc && path . node . loc . start . line <= line && path . node . loc . end . line >= line ) {
311318 functionName = path . node . id . name || null ;
312319 isAsync = path . node . async ;
313320 }
314321 } ,
315322 /**
316323 * It is used to get anonimous function names in function expressions or arrow function expressions
324+ *
325+ * @param path
317326 */
318327 VariableDeclarator ( path ) {
319- console . log ( `variable declaration: node.type: ${ path . node . init . type } , line: ${ line } , ` )
328+ console . log ( `variable declaration: node.type: ${ path . node . init . type } , line: ${ line } , ` ) ;
320329
321330 if (
322331 path . node . init &&
323- ( path . node . init . type === " FunctionExpression" || path . node . init . type === " ArrowFunctionExpression" ) &&
332+ ( path . node . init . type === ' FunctionExpression' || path . node . init . type === ' ArrowFunctionExpression' ) &&
324333 path . node . loc &&
325334 path . node . loc . start . line <= line &&
326335 path . node . loc . end . line >= line
@@ -331,14 +340,14 @@ export default class JavascriptEventWorker extends EventWorker {
331340 }
332341 isAsync = ( path . node . init as any ) . async ;
333342 }
334- }
343+ } ,
335344 } ) ;
336345 } catch ( e ) {
337- console . error ( `Failed to parse source code: ${ e . message } ` ) ;
346+ console . error ( `Failed to parse source code: ${ e . message } ` ) ;
338347 }
339348
340- return functionName ? `${ isAsync ? " async " : "" } ${ className ? `${ className } .` : "" } ${ functionName } ` : null ;
341- }
349+ return functionName ? `${ isAsync ? ' async ' : '' } ${ className ? `${ className } .` : '' } ${ functionName } ` : null ;
350+ }
342351
343352 /**
344353 * Downloads source map file from Grid FS
0 commit comments