mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
fix(core): profile decorator (#10476)
This commit is contained in:
@ -177,10 +177,10 @@ export function disable() {
|
||||
}
|
||||
|
||||
function profileFunction<F extends Function>(fn: F, customName?: string): F {
|
||||
return profileFunctionFactory(fn, customName || fn.name);
|
||||
return profileFunctionFactory<F>(fn, customName || fn.name);
|
||||
}
|
||||
|
||||
const profileMethodUnnamed = (target, key, descriptor) => {
|
||||
const profileMethodUnnamed = (target: Object, key: symbol | string, descriptor) => {
|
||||
// save a reference to the original method this way we keep the values currently in the
|
||||
// descriptor and don't overwrite what another decorator might have done to the descriptor.
|
||||
if (descriptor === undefined) {
|
||||
@ -193,7 +193,7 @@ const profileMethodUnnamed = (target, key, descriptor) => {
|
||||
className = target.constructor.name + '.';
|
||||
}
|
||||
|
||||
const name = className + key;
|
||||
const name = className + key?.toString();
|
||||
|
||||
//editing the descriptor/value parameter
|
||||
descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Instance);
|
||||
@ -202,7 +202,7 @@ const profileMethodUnnamed = (target, key, descriptor) => {
|
||||
return descriptor;
|
||||
};
|
||||
|
||||
const profileStaticMethodUnnamed = (ctor, key, descriptor) => {
|
||||
const profileStaticMethodUnnamed = <F extends Function>(ctor: F, key: symbol | string, descriptor) => {
|
||||
// save a reference to the original method this way we keep the values currently in the
|
||||
// descriptor and don't overwrite what another decorator might have done to the descriptor.
|
||||
if (descriptor === undefined) {
|
||||
@ -214,7 +214,7 @@ const profileStaticMethodUnnamed = (ctor, key, descriptor) => {
|
||||
if (ctor && ctor.name) {
|
||||
className = ctor.name + '.';
|
||||
}
|
||||
const name = className + key;
|
||||
const name = className + key?.toString();
|
||||
|
||||
//editing the descriptor/value parameter
|
||||
descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Static);
|
||||
|
Reference in New Issue
Block a user