Skip to content

Commit 13d0744

Browse files
committed
Default args and locals params in debugger snapshot hooks
Allow the build plugin to omit empty args/locals arguments from $dd_entry, $dd_return, and $dd_throw calls by defaulting the parameters to {} in onEntry, onReturn, and onThrow.
1 parent 239ef70 commit 13d0744

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • packages/debugger/src/domain

packages/debugger/src/domain/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export function resetDebuggerTransport(): void {
3939
* @param self - The 'this' context
4040
* @param args - Function arguments
4141
*/
42-
export function onEntry(probes: InitializedProbe[], self: any, args: Record<string, any>): void {
42+
export function onEntry(probes: InitializedProbe[], self: any, args: Record<string, any> = {}): void {
4343
const start = performance.now()
4444

4545
// TODO: A lot of repeated work performed for each probe that could be shared between probes
@@ -114,8 +114,8 @@ export function onReturn(
114114
probes: InitializedProbe[],
115115
value: any,
116116
self: any,
117-
args: Record<string, any>,
118-
locals: Record<string, any>
117+
args: Record<string, any> = {},
118+
locals: Record<string, any> = {}
119119
): any {
120120
const end = performance.now()
121121

@@ -180,7 +180,7 @@ export function onReturn(
180180
* @param self - The 'this' context
181181
* @param args - Function arguments
182182
*/
183-
export function onThrow(probes: InitializedProbe[], error: Error, self: any, args: Record<string, any>): void {
183+
export function onThrow(probes: InitializedProbe[], error: Error, self: any, args: Record<string, any> = {}): void {
184184
const end = performance.now()
185185

186186
// TODO: A lot of repeated work performed for each probe that could be shared between probes

0 commit comments

Comments
 (0)