| ... | ... | @@ -18,8 +18,10 @@ pub const MultiHashHexDigest = [multihash_hex_digest_len]u8; |
| 18 | 18 | pub const Dependency = struct { |
| 19 | 19 | location: Location, |
| 20 | 20 | location_tok: Ast.TokenIndex, |
| 21 | location_node: Ast.Node.Index, |
| 21 | 22 | hash: ?[]const u8, |
| 22 | 23 | hash_tok: Ast.TokenIndex, |
| 24 | hash_node: Ast.Node.Index, |
| 23 | 25 | node: Ast.Node.Index, |
| 24 | 26 | name_tok: Ast.TokenIndex, |
| 25 | 27 | lazy: bool, |
| ... | ... | @@ -293,8 +295,10 @@ const Parse = struct { |
| 293 | 295 | var dep: Dependency = .{ |
| 294 | 296 | .location = undefined, |
| 295 | 297 | .location_tok = 0, |
| 298 | .location_node = undefined, |
| 296 | 299 | .hash = null, |
| 297 | 300 | .hash_tok = 0, |
| 301 | .hash_node = undefined, |
| 298 | 302 | .node = node, |
| 299 | 303 | .name_tok = 0, |
| 300 | 304 | .lazy = false, |
| ... | ... | @@ -320,6 +324,7 @@ const Parse = struct { |
| 320 | 324 | }; |
| 321 | 325 | has_location = true; |
| 322 | 326 | dep.location_tok = main_tokens[field_init]; |
| 327 | dep.location_node = field_init; |
| 323 | 328 | } else if (mem.eql(u8, field_name, "path")) { |
| 324 | 329 | if (has_location) { |
| 325 | 330 | return fail(p, main_tokens[field_init], "dependency should specify only one of 'url' and 'path' fields.", .{}); |
| ... | ... | @@ -332,12 +337,14 @@ const Parse = struct { |
| 332 | 337 | }; |
| 333 | 338 | has_location = true; |
| 334 | 339 | dep.location_tok = main_tokens[field_init]; |
| 340 | dep.location_node = field_init; |
| 335 | 341 | } else if (mem.eql(u8, field_name, "hash")) { |
| 336 | 342 | dep.hash = parseHash(p, field_init) catch |err| switch (err) { |
| 337 | 343 | error.ParseFailure => continue, |
| 338 | 344 | else => |e| return e, |
| 339 | 345 | }; |
| 340 | 346 | dep.hash_tok = main_tokens[field_init]; |
| 347 | dep.hash_node = field_init; |
| 341 | 348 | } else if (mem.eql(u8, field_name, "lazy")) { |
| 342 | 349 | dep.lazy = parseBool(p, field_init) catch |err| switch (err) { |
| 343 | 350 | error.ParseFailure => continue, |