| author | |
| committer | |
| log | 50accb757fb8514c3eac824fad5d09d569a6fdc9 |
| tree | a14d6513f717343bf32fc2c96a81bde20b76c7cd |
| parent | b463924da2b1ed4ae83a51c18b4998531c44d809 |
3 files changed, 15 insertions(+), 10 deletions(-)
lib/std/zig/Ast.zig+12| ... | @@ -1642,6 +1642,18 @@ pub fn containerDeclArg(tree: Ast, node: Node.Index) full.ContainerDecl { | ... | @@ -1642,6 +1642,18 @@ pub fn containerDeclArg(tree: Ast, node: Node.Index) full.ContainerDecl { |
| 1642 | }); | 1642 | }); |
| 1643 | } | 1643 | } |
| 1644 | 1644 | ||
| 1645 | pub fn containerDeclRoot(tree: Ast) full.ContainerDecl { | ||
| 1646 | return .{ | ||
| 1647 | .layout_token = null, | ||
| 1648 | .ast = .{ | ||
| 1649 | .main_token = undefined, | ||
| 1650 | .enum_token = null, | ||
| 1651 | .members = tree.rootDecls(), | ||
| 1652 | .arg = 0, | ||
| 1653 | }, | ||
| 1654 | }; | ||
| 1655 | } | ||
| 1656 | |||
| 1645 | pub fn taggedUnionTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl { | 1657 | pub fn taggedUnionTwo(tree: Ast, buffer: *[2]Node.Index, node: Node.Index) full.ContainerDecl { |
| 1646 | assert(tree.nodes.items(.tag)[node] == .tagged_union_two or | 1658 | assert(tree.nodes.items(.tag)[node] == .tagged_union_two or |
| 1647 | tree.nodes.items(.tag)[node] == .tagged_union_two_trailing); | 1659 | tree.nodes.items(.tag)[node] == .tagged_union_two_trailing); |
src/AstGen.zig+1-10| ... | @@ -131,20 +131,11 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { | ... | @@ -131,20 +131,11 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir { |
| 131 | }; | 131 | }; |
| 132 | defer gz_instructions.deinit(gpa); | 132 | defer gz_instructions.deinit(gpa); |
| 133 | 133 | ||
| 134 | const container_decl: Ast.full.ContainerDecl = .{ | ||
| 135 | .layout_token = null, | ||
| 136 | .ast = .{ | ||
| 137 | .main_token = undefined, | ||
| 138 | .enum_token = null, | ||
| 139 | .members = tree.rootDecls(), | ||
| 140 | .arg = 0, | ||
| 141 | }, | ||
| 142 | }; | ||
| 143 | if (AstGen.structDeclInner( | 134 | if (AstGen.structDeclInner( |
| 144 | &gen_scope, | 135 | &gen_scope, |
| 145 | &gen_scope.base, | 136 | &gen_scope.base, |
| 146 | 0, | 137 | 0, |
| 147 | container_decl, | 138 | tree.containerDeclRoot(), |
| 148 | .Auto, | 139 | .Auto, |
| 149 | )) |struct_decl_ref| { | 140 | )) |struct_decl_ref| { |
| 150 | assert(refToIndex(struct_decl_ref).? == 0); | 141 | assert(refToIndex(struct_decl_ref).? == 0); |
src/Module.zig+2| ... | @@ -935,6 +935,8 @@ pub const Struct = struct { | ... | @@ -935,6 +935,8 @@ pub const Struct = struct { |
| 935 | .tagged_union_enum_tag_trailing, | 935 | .tagged_union_enum_tag_trailing, |
| 936 | => return queryFieldSrc(tree.*, query, file, tree.taggedUnionEnumTag(node)), | 936 | => return queryFieldSrc(tree.*, query, file, tree.taggedUnionEnumTag(node)), |
| 937 | 937 | ||
| 938 | .root => return queryFieldSrc(tree.*, query, file, tree.containerDeclRoot()), | ||
| 939 | |||
| 938 | else => unreachable, | 940 | else => unreachable, |
| 939 | } | 941 | } |
| 940 | } | 942 | } |