tuples
This commit is contained in:
24
src/ast.zig
24
src/ast.zig
@@ -65,6 +65,9 @@ pub const Node = struct {
|
||||
foreign_expr: ForeignExpr,
|
||||
library_decl: LibraryDecl,
|
||||
function_type_expr: FunctionTypeExpr,
|
||||
tuple_type_expr: TupleTypeExpr,
|
||||
tuple_literal: TupleLiteral,
|
||||
ufcs_alias: UfcsAlias,
|
||||
|
||||
pub fn declName(self: Data) ?[]const u8 {
|
||||
return switch (self) {
|
||||
@@ -75,6 +78,7 @@ pub const Node = struct {
|
||||
.struct_decl => |d| d.name,
|
||||
.union_decl => |d| d.name,
|
||||
.namespace_decl => |d| d.name,
|
||||
.ufcs_alias => |d| d.name,
|
||||
else => null,
|
||||
};
|
||||
}
|
||||
@@ -153,6 +157,7 @@ pub const BinaryOp = struct {
|
||||
or_op,
|
||||
bit_and,
|
||||
bit_or,
|
||||
in_op,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -394,3 +399,22 @@ pub const FunctionTypeExpr = struct {
|
||||
param_types: []const *Node,
|
||||
return_type: ?*Node, // null = void return
|
||||
};
|
||||
|
||||
pub const TupleTypeExpr = struct {
|
||||
field_types: []const *Node,
|
||||
field_names: ?[]const []const u8, // null for positional
|
||||
};
|
||||
|
||||
pub const TupleLiteral = struct {
|
||||
elements: []const TupleElement,
|
||||
};
|
||||
|
||||
pub const TupleElement = struct {
|
||||
name: ?[]const u8, // null for positional
|
||||
value: *Node,
|
||||
};
|
||||
|
||||
pub const UfcsAlias = struct {
|
||||
name: []const u8,
|
||||
target: []const u8,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user