ast: remove Expr Node (lives under Stmt)
This commit is contained in:
parent
b382c136ec
commit
1c8eda7305
3 changed files with 0 additions and 14 deletions
|
@ -14,7 +14,6 @@ pub const NodeType = enum {
|
||||||
ConstDecl,
|
ConstDecl,
|
||||||
Struct,
|
Struct,
|
||||||
Block,
|
Block,
|
||||||
Expr,
|
|
||||||
Stmt,
|
Stmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,7 +237,6 @@ pub const Node = union(NodeType) {
|
||||||
|
|
||||||
Block: StmtList,
|
Block: StmtList,
|
||||||
|
|
||||||
Expr: *Expr,
|
|
||||||
Stmt: *Stmt,
|
Stmt: *Stmt,
|
||||||
|
|
||||||
pub fn mkRoot(allocator: *std.mem.Allocator) !*Node {
|
pub fn mkRoot(allocator: *std.mem.Allocator) !*Node {
|
||||||
|
|
|
@ -70,12 +70,6 @@ pub fn printNode(node: *Node, ident: usize) void {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
.Expr => |expr| {
|
|
||||||
printIdent(ident);
|
|
||||||
printExpr(expr);
|
|
||||||
std.debug.warn("\n");
|
|
||||||
},
|
|
||||||
|
|
||||||
.Stmt => |stmt| {
|
.Stmt => |stmt| {
|
||||||
printIdent(ident);
|
printIdent(ident);
|
||||||
printStmt(ident, stmt);
|
printStmt(ident, stmt);
|
||||||
|
|
|
@ -162,12 +162,6 @@ pub const Parser = struct {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mkExpr(self: *Parser, expr: *Expr) !*ast.Node {
|
|
||||||
var node = try self.allocator.create(Node);
|
|
||||||
node.* = Node{ .Expr = expr };
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mkStmt(self: *Parser, stmt: *Stmt) !*ast.Node {
|
fn mkStmt(self: *Parser, stmt: *Stmt) !*ast.Node {
|
||||||
var node = try self.allocator.create(Node);
|
var node = try self.allocator.create(Node);
|
||||||
node.* = Node{ .Stmt = stmt };
|
node.* = Node{ .Stmt = stmt };
|
||||||
|
|
Loading…
Reference in a new issue