Skip to documentation
SLOP

tiny.chant.lower.scope

Reference tiny.chant lower scope

Defined in lower.

API (5)

Actions

Public operations.

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

Source

Called byCallsNo direct callslower.localdeclarelower.scopebindLoopVariablelowerlowerFunctionlower.scopebind
Static calls · unresolved targets: 1 · external targets: 0.
Called byCallsNo direct callerslower.scopebindlower.scopebindLoopVariable
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callslowerlowerFunctionlower.scopepop
Static calls · unresolved targets: 0 · external targets: 2.
Called byCallsNo direct callslowerlowerFunctionlower.scopepush
Static calls · unresolved targets: 1 · external targets: 0.

Source: lib/chant/src/lower/root.zig:9

zig
pub const scope = @import("scope.zig");

Source: lib/chant/src/lower/scope.zig

zig
const choir = @import("choir");const ast = @import("../ast/root.zig");const context = @import("context.zig");const Error = @import("error.zig").Error;const Lowerer = context.Lowerer;const Local = context.Local;pub fn push(lowerer: *Lowerer) Error!void {    try lowerer.scopes.append(lowerer.gpa, .empty);}pub fn pop(lowerer: *Lowerer) void {    var current = lowerer.scopes.pop() orelse return;    current.deinit(lowerer.gpa);}pub fn lookup(lowerer: *const Lowerer, name: []const u8) ?Local {    var i = lowerer.scopes.items.len;    while (i > 0) {        i -= 1;        if (lowerer.scopes.items[i].get(name)) |local| return local;    }    return null;}pub fn bind(lowerer: *Lowerer, name: []const u8, local: Local) Error!void {    const top = &lowerer.scopes.items[lowerer.scopes.items.len - 1];    try top.put(lowerer.gpa, name, local);}pub fn bindLoopVariable(lowerer: *Lowerer, name: []const u8, value: *choir.Value, c_type: *const ast.Type) Error!void {    try bind(lowerer, name, .{ .kind = .loop_iv, .value = value, .c_type = c_type });}

Audit

Definitions6
Public names6
Members0
Version26.7.0
Revisiondaab053ee433