aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/base.zig
diff options
context:
space:
mode:
authorGravatar Alex Lam S.L <alexlamsl@gmail.com> 2023-01-02 02:37:45 +0200
committerGravatar GitHub <noreply@github.com> 2023-01-01 16:37:45 -0800
commit8a29c643025c73312da001c5fa4caf0ccf0528fa (patch)
tree487fb73334b0eda6484b331886f80a4664dfccb0 /src/bun.js/base.zig
parent2345e268bc8f38ffdeba1580780e96683600874b (diff)
downloadbun-8a29c643025c73312da001c5fa4caf0ccf0528fa.tar.gz
bun-8a29c643025c73312da001c5fa4caf0ccf0528fa.tar.zst
bun-8a29c643025c73312da001c5fa4caf0ccf0528fa.zip
clean up `Promise` handling (#1697)
Diffstat (limited to 'src/bun.js/base.zig')
-rw-r--r--src/bun.js/base.zig14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/bun.js/base.zig b/src/bun.js/base.zig
index de02c1cbf..671a4c197 100644
--- a/src/bun.js/base.zig
+++ b/src/bun.js/base.zig
@@ -2538,7 +2538,7 @@ pub fn DOMCall(
\\ static const JSC::DOMJIT::Signature {[signatureName]s}(
\\ {[fastPathName]s}Wrapper,
\\ thisObject->classInfo(),
- \\
+ \\
;
try writer.print(fmt, .{
@@ -2823,16 +2823,10 @@ pub fn wrapWithHasContainer(
}
if (comptime maybe_async) {
- if (result.asPromise() != null or result.asInternalPromise() != null) {
+ if (result.asAnyPromise()) |promise| {
var vm = ctx.ptr().bunVM();
-
- if (result.asPromise()) |promise| {
- vm.waitForPromise(promise);
- result = promise.result(ctx.vm());
- } else if (result.asInternalPromise()) |promise| {
- vm.waitForPromise(promise);
- result = promise.result(ctx.vm());
- }
+ vm.waitForPromise(promise);
+ result = promise.result(ctx.vm());
}
}