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