aboutsummaryrefslogtreecommitdiff
path: root/src/javascript/jsc/javascript.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-07-13 10:32:57 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-07-13 10:32:57 -0700
commitfea9faaf4cd110591e9e6f07cd4d17cbc0ea5918 (patch)
treeb59ec68d139ebcb339cd7bd6d1d15eb71a423b4f /src/javascript/jsc/javascript.zig
parentb1b459435f375bf5eef7c6aeb7285ac6c2719b62 (diff)
downloadbun-fea9faaf4cd110591e9e6f07cd4d17cbc0ea5918.tar.gz
bun-fea9faaf4cd110591e9e6f07cd4d17cbc0ea5918.tar.zst
bun-fea9faaf4cd110591e9e6f07cd4d17cbc0ea5918.zip
alright
Former-commit-id: ab73c7b323c222e5d1172c07036653ca98aa8e6b
Diffstat (limited to 'src/javascript/jsc/javascript.zig')
-rw-r--r--src/javascript/jsc/javascript.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/javascript/jsc/javascript.zig b/src/javascript/jsc/javascript.zig
index f9aae96ee..102abf925 100644
--- a/src/javascript/jsc/javascript.zig
+++ b/src/javascript/jsc/javascript.zig
@@ -768,6 +768,8 @@ pub const Module = struct {
return null;
}
+ var module = this;
+
var total_len: usize = 0;
for (arguments) |argument| {
const len = js.JSStringGetLength(argument);
@@ -785,7 +787,6 @@ pub const Module = struct {
const end = js.JSStringGetUTF8CString(argument, require_buf.list.items.ptr, require_buf.list.items.len);
total_len += end;
const import_path = require_buf.list.items[0 .. end - 1];
- var module = this;
if (this.vm.bundler.linker.resolver.resolve(module.path.name.dirWithTrailingSlash(), import_path, .require)) |resolved| {
var load_result = Module.loadFromResolveResult(this.vm, ctx, resolved, exception) catch |err| {
@@ -835,7 +836,7 @@ pub const Module = struct {
for (arguments) |argument| {
const end = js.JSStringGetUTF8CString(argument, remainder.ptr, total_len - used_len);
used_len += end;
- remainder[end - 1] = ",";
+ remainder[end - 1] = ',';
remainder = remainder[end..];
}
@@ -1126,7 +1127,7 @@ pub const Module = struct {
}
var module: *Module = undefined;
- if (needs_reload) {
+ if (reload_pending) {
module = vm.require_cache.get(hash).?;
} else {
module = try vm.allocator.create(Module);
@@ -1134,12 +1135,12 @@ pub const Module = struct {
}
errdefer {
- if (!needs_reload) {
+ if (!reload_pending) {
vm.allocator.destroy(module);
}
}
- if (needs_reload) {
+ if (reload_pending) {
try Module.load(
module,
vm,
@@ -1345,7 +1346,7 @@ pub const EventListenerMixin = struct {
fetch,
err,
- const SizeMatcher = strings.ExactSizeMatcher("fetch".len);
+ const SizeMatcher = strings.ExactSizeMatcher(8);
pub fn match(str: string) ?EventType {
return switch (SizeMatcher.match(str)) {