Skip to documentation
SLOP

tiny.chant.ast.decl

Reference tiny.chant ast decl

Defined in ast.

API (3)

Types and contracts

Public types and contracts.

No direct callersNo direct callsastdecl
Static calls · unresolved targets: unknown · external targets: unknown.

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

Definitions3
Public names4
Members6
Version26.7.0
Revisiondaab053ee433