tiny.chant.ast.decl
Defined in ast.
API (3)
Types and contracts
Public types and contracts.
Source
Source: lib/chant/src/ast/decl.zig
zig
const std = @import("std");const types = @import("type/root.zig");const stmt = @import("stmt.zig");const storage = @import("storage.zig");const variable = @import("variable.zig");pub const Function = struct { name: []const u8, type: *const types.Type, storage: storage.Storage = .none, body: ?*stmt.Stmt = null,};pub const Decl = union(enum) { variable: variable.Variable, function: Function,};pub const TranslationUnit = struct { declarations: []Decl,};test "declarations model functions and globals" { const fn_type = types.Type{ .kind = .function, .child = &types.void_type, .params = &.{.{ .name = "n", .type = &types.int_type }}, }; const function = Function{ .name = "kernel", .type = &fn_type, .storage = .static }; try std.testing.expectEqualStrings("kernel", function.name); try std.testing.expect(function.body == null);}Source: lib/chant/src/ast/root.zig:4
zig
pub const decl = @import("decl.zig");Audit
| Definitions | 3 |
|---|---|
| Public names | 4 |
| Members | 6 |
| Version | 26.7.0 |
| Revision | daab053ee433 |