Skip to content

Commit 5f75963

Browse files
timfishsimon-id
andauthored
fix: Use uniquely named local variables (#13)
Co-authored-by: simon-id <[email protected]>
1 parent f5d7d1f commit 5f75963

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/instrumentation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ impl Instrumentation {
115115
));
116116

117117
body.stmts = vec![
118-
quote!("const traced = $traced;" as Stmt, traced: Expr = traced_fn.into()),
118+
quote!("const __apm$traced = $traced;" as Stmt, traced: Expr = traced_fn.into()),
119119
quote!(
120-
"if (!$ch.hasSubscribers) return traced();" as Stmt,
120+
"if (!$ch.hasSubscribers) return __apm$traced();" as Stmt,
121121
ch = ch_ident
122122
),
123123
quote!(
124-
"return $trace(traced, { arguments, self: this } );" as Stmt,
124+
"return $trace(__apm$traced, { arguments, self: this } );" as Stmt,
125125
trace = trace_ident
126126
),
127127
];

tests/wasm/testdata/expected-cjs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ module.exports = class Up {
2828
}
2929
}
3030
fetch() {
31-
const traced = ()=>{
31+
const __apm$traced = ()=>{
3232
console.log('fetch');
3333
};
34-
if (!tr_ch_apm$up_fetch.hasSubscribers) return traced();
35-
return tr_ch_apm$up_fetch.traceSync(traced, {
34+
if (!tr_ch_apm$up_fetch.hasSubscribers) return __apm$traced();
35+
return tr_ch_apm$up_fetch.traceSync(__apm$traced, {
3636
arguments,
3737
self: this
3838
});

tests/wasm/testdata/expected.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ export class Up {
2828
}
2929
}
3030
fetch() {
31-
const traced = ()=>{
31+
const __apm$traced = ()=>{
3232
console.log('fetch');
3333
};
34-
if (!tr_ch_apm$up_fetch.hasSubscribers) return traced();
35-
return tr_ch_apm$up_fetch.traceSync(traced, {
34+
if (!tr_ch_apm$up_fetch.hasSubscribers) return __apm$traced();
35+
return tr_ch_apm$up_fetch.traceSync(__apm$traced, {
3636
arguments,
3737
self: this
3838
});

0 commit comments

Comments
 (0)