| ... | @@ -110,6 +110,8 @@ pub const File = struct { | ... | @@ -110,6 +110,8 @@ pub const File = struct { |
| 110 | } | 110 | } |
| 111 | } | 111 | } |
| 112 | | 112 | |
| | 113 | /// May be called before or after updateDeclExports but must be called |
| | 114 | /// after allocateDeclIndexes for any given Decl. |
| 113 | pub fn updateDecl(base: *File, module: *Module, decl: *Module.Decl) !void { | 115 | pub fn updateDecl(base: *File, module: *Module, decl: *Module.Decl) !void { |
| 114 | switch (base.tag) { | 116 | switch (base.tag) { |
| 115 | .elf => return @fieldParentPtr(Elf, "base", base).updateDecl(module, decl), | 117 | .elf => return @fieldParentPtr(Elf, "base", base).updateDecl(module, decl), |
| ... | @@ -127,6 +129,8 @@ pub const File = struct { | ... | @@ -127,6 +129,8 @@ pub const File = struct { |
| 127 | } | 129 | } |
| 128 | } | 130 | } |
| 129 | | 131 | |
| | 132 | /// Must be called before any call to updateDecl or updateDeclExports for |
| | 133 | /// any given Decl. |
| 130 | pub fn allocateDeclIndexes(base: *File, decl: *Module.Decl) !void { | 134 | pub fn allocateDeclIndexes(base: *File, decl: *Module.Decl) !void { |
| 131 | switch (base.tag) { | 135 | switch (base.tag) { |
| 132 | .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl), | 136 | .elf => return @fieldParentPtr(Elf, "base", base).allocateDeclIndexes(decl), |
| ... | @@ -200,7 +204,8 @@ pub const File = struct { | ... | @@ -200,7 +204,8 @@ pub const File = struct { |
| 200 | }; | 204 | }; |
| 201 | } | 205 | } |
| 202 | | 206 | |
| 203 | /// Must be called only after a successful call to `updateDecl`. | 207 | /// May be called before or after updateDecl, but must be called after |
| | 208 | /// allocateDeclIndexes for any given Decl. |
| 204 | pub fn updateDeclExports( | 209 | pub fn updateDeclExports( |
| 205 | base: *File, | 210 | base: *File, |
| 206 | module: *Module, | 211 | module: *Module, |