// SPDX-FileCopyrightText: 2024 Himbeer // // SPDX-License-Identifier: GPL-3.0-or-later package main var funcs = map[string]*funcInfo{} var localConsts = map[string]map[string]*localConst{} var localMuts = map[string]map[string]*localMut{} type funcInfo struct { params []paramInfo returnType cerType } type paramInfo struct { typ cerType } type localConst struct { typ cerType } type localMut struct { typ cerType } func isDeclared(name string, toplevel bool) (ok bool, mutable bool) { if toplevel { return isDeclaredToplevel(name) } return isDeclaredLocal(currentFunc, name) } func isDeclaredToplevel(name string) (ok bool, mutable bool) { _, ok = funcs[name] return } func isDeclaredLocal(function string, local string) (ok bool, mutable bool) { _, constant := localConsts[function][local] _, mutable = localMuts[function][local] return constant || mutable, mutable }