aboutsummaryrefslogtreecommitdiff
path: root/src/link/Wasm.zig
diff options
context:
space:
mode:
authorJacob Young <jacobly0@users.noreply.github.com>2023-05-26 16:04:53 -0400
committerAndrew Kelley <andrew@ziglang.org>2023-06-10 20:47:55 -0700
commit9cd0ca9f482ef7f76d3f3ca683913e9aceaa47fe (patch)
tree86e9cfb93f1cf8b68aebc83877bef7c24aed47a6 /src/link/Wasm.zig
parentd5f0ee0d62e48e623625779a0cf722c3f0f66921 (diff)
downloadzig-9cd0ca9f482ef7f76d3f3ca683913e9aceaa47fe.tar.gz
zig-9cd0ca9f482ef7f76d3f3ca683913e9aceaa47fe.zip
Module: rename functions to make ownership checks explicit
This makes the difference between `decl.getOwnedFunction` and `decl.val.getFunction` more clear when reading the code.
Diffstat (limited to 'src/link/Wasm.zig')
-rw-r--r--src/link/Wasm.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index 78d1be978b..96de121ffb 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -1404,9 +1404,9 @@ pub fn updateDecl(wasm: *Wasm, mod: *Module, decl_index: Module.Decl.Index) !voi
defer tracy.end();
const decl = mod.declPtr(decl_index);
- if (decl.getFunction(mod)) |_| {
+ if (decl.val.getFunction(mod)) |_| {
return;
- } else if (decl.getExternFunc(mod)) |_| {
+ } else if (decl.val.getExternFunc(mod)) |_| {
return;
}
@@ -1415,12 +1415,12 @@ pub fn updateDecl(wasm: *Wasm, mod: *Module, decl_index: Module.Decl.Index) !voi
atom.clear();
if (decl.isExtern(mod)) {
- const variable = decl.getVariable(mod).?;
+ const variable = decl.getOwnedVariable(mod).?;
const name = mem.sliceTo(decl.name, 0);
const lib_name = mod.intern_pool.stringToSliceUnwrap(variable.lib_name);
return wasm.addOrUpdateImport(name, atom.sym_index, lib_name, null);
}
- const val = if (decl.getVariable(mod)) |variable| variable.init.toValue() else decl.val;
+ const val = if (decl.val.getVariable(mod)) |variable| variable.init.toValue() else decl.val;
var code_writer = std.ArrayList(u8).init(wasm.base.allocator);
defer code_writer.deinit();
@@ -3373,7 +3373,7 @@ pub fn flushModule(wasm: *Wasm, comp: *Compilation, prog_node: *std.Progress.Nod
const atom = wasm.getAtomPtr(atom_index);
if (decl.ty.zigTypeTag(mod) == .Fn) {
try wasm.parseAtom(atom_index, .function);
- } else if (decl.getVariable(mod)) |variable| {
+ } else if (decl.getOwnedVariable(mod)) |variable| {
if (variable.is_const) {
try wasm.parseAtom(atom_index, .{ .data = .read_only });
} else if (variable.init.toValue().isUndefDeep(mod)) {