File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/svelte/src/compiler/phases/2-analyze/visitors Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -166,10 +166,10 @@ export function CallExpression(node, context) {
166166 if ( node . arguments [ 0 ] ) {
167167 context . state . scope . tracing = b . thunk ( /** @type {Expression } */ ( node . arguments [ 0 ] ) ) ;
168168 } else {
169- const label = get_function_label ( context . path . slice ( 0 , - 2 ) ) ;
169+ const label = get_function_label ( context . path . slice ( 0 , - 2 ) ) ?? 'trace' ;
170170 const loc = `(${ locate_node ( fn ) } )` ;
171171
172- context . state . scope . tracing = b . thunk ( b . literal ( label ? label + ' ' + loc : loc ) ) ;
172+ context . state . scope . tracing = b . thunk ( b . literal ( label + ' ' + loc ) ) ;
173173 }
174174 }
175175
@@ -245,4 +245,8 @@ function get_function_label(nodes) {
245245 if ( parent . type === 'Property' && ! parent . computed ) {
246246 return /** @type {Identifier } */ ( parent . key ) . name ;
247247 }
248+
249+ if ( parent . type === 'VariableDeclarator' && parent . id . type === 'Identifier' ) {
250+ return parent . id . name ;
251+ }
248252}
You can’t perform that action at this time.
0 commit comments