@abaplint/runtime 2.11.8 → 2.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/src/trace.js +16 -2
- package/package.json +1 -1
package/build/src/trace.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Trace = void 0;
|
|
4
|
-
const types_1 = require("util/types");
|
|
5
4
|
const statements_1 = require("./statements");
|
|
5
|
+
// Polyfill for detecting async functions without relying on Node's "util/types"
|
|
6
|
+
// Works in Node and browser builds.
|
|
7
|
+
const isAsyncFunction = (fn) => {
|
|
8
|
+
if (typeof fn !== "function") {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
// Reliable brand check
|
|
12
|
+
const tag = Object.prototype.toString.call(fn);
|
|
13
|
+
if (tag === "[object AsyncFunction]") {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
// Fallback via constructor name (covers most environments)
|
|
17
|
+
const ctorName = fn?.constructor?.name;
|
|
18
|
+
return ctorName === "AsyncFunction";
|
|
19
|
+
};
|
|
6
20
|
class Trace {
|
|
7
21
|
traceTotals = {};
|
|
8
22
|
setTrace(min, totals, statements) {
|
|
@@ -12,7 +26,7 @@ class Trace {
|
|
|
12
26
|
continue;
|
|
13
27
|
}
|
|
14
28
|
const func = statements[c];
|
|
15
|
-
if (
|
|
29
|
+
if (isAsyncFunction(func)) {
|
|
16
30
|
statements[c] = this._traceAsync(func, c, min, totals);
|
|
17
31
|
}
|
|
18
32
|
else {
|