rustcodegraph 1.2.10

Local-first code intelligence graph and CLI for AI agents
Documentation
//! Core built-in symbol allowlists.
//!
//! 这些表用于短路语言内建和标准库名字,防止 resolver 为 `console`、`print`、
//! `fmt` 等外部/内建符号制造错误边。

pub(super) const JS_BUILT_INS: &[&str] = &[
    "console",
    "window",
    "document",
    "global",
    "process",
    "Promise",
    "Array",
    "Object",
    "String",
    "Number",
    "Boolean",
    "Date",
    "Math",
    "JSON",
    "RegExp",
    "Error",
    "Map",
    "Set",
    "setTimeout",
    "setInterval",
    "clearTimeout",
    "clearInterval",
    "fetch",
    "require",
    "module",
    "exports",
    "__dirname",
    "__filename",
];

pub(super) const REACT_HOOKS: &[&str] = &[
    // React 官方 hook 由框架提供,不应解析到用户自定义同名函数。
    "useState",
    "useEffect",
    "useContext",
    "useReducer",
    "useCallback",
    "useMemo",
    "useRef",
    "useLayoutEffect",
    "useImperativeHandle",
    "useDebugValue",
];

pub(super) const PYTHON_BUILT_INS: &[&str] = &[
    "print",
    "len",
    "range",
    "str",
    "int",
    "float",
    "list",
    "dict",
    "set",
    "tuple",
    "open",
    "input",
    "type",
    "isinstance",
    "hasattr",
    "getattr",
    "setattr",
    "super",
    "self",
    "cls",
    "None",
    "True",
    "False",
];

pub(super) const PYTHON_BUILT_IN_TYPES: &[&str] = &[
    "list",
    "dict",
    "set",
    "tuple",
    "str",
    "int",
    "float",
    "bool",
    "bytes",
    "bytearray",
    "frozenset",
    "object",
    "super",
];

pub(super) const PYTHON_BUILT_IN_METHODS: &[&str] = &[
    "append",
    "extend",
    "insert",
    "remove",
    "pop",
    "clear",
    "sort",
    "reverse",
    "copy",
    "update",
    "keys",
    "values",
    "items",
    "get",
    "add",
    "discard",
    "union",
    "intersection",
    "difference",
    "split",
    "join",
    "strip",
    "lstrip",
    "rstrip",
    "replace",
    "lower",
    "upper",
    "startswith",
    "endswith",
    "find",
    "index",
    "count",
    "encode",
    "decode",
    "format",
    "isdigit",
    "isalpha",
    "isalnum",
    "read",
    "write",
    "readline",
    "readlines",
    "close",
    "flush",
    "seek",
];

pub(super) const GO_STDLIB_PACKAGES: &[&str] = &[
    // 只列常见导入包名的第一段,用于把标准库 import 留在图外。
    "fmt",
    "os",
    "io",
    "net",
    "http",
    "log",
    "math",
    "sort",
    "sync",
    "time",
    "path",
    "bytes",
    "strings",
    "strconv",
    "errors",
    "context",
    "json",
    "xml",
    "csv",
    "html",
    "template",
    "regexp",
    "reflect",
    "runtime",
    "testing",
    "flag",
    "bufio",
    "crypto",
    "encoding",
    "filepath",
    "hash",
    "mime",
    "rand",
    "signal",
    "sql",
    "syscall",
    "unicode",
    "unsafe",
    "atomic",
    "binary",
    "debug",
    "exec",
    "heap",
    "ring",
    "scanner",
    "tar",
    "zip",
    "gzip",
    "zlib",
    "tls",
    "url",
    "user",
    "pprof",
    "trace",
    "ast",
    "build",
    "parser",
    "printer",
    "token",
    "types",
    "cgo",
    "plugin",
    "race",
    "ioutil",
    "utilruntime",
    "utilwait",
    "utilnet",
];

pub(super) const GO_BUILT_INS: &[&str] = &[
    "make",
    "new",
    "len",
    "cap",
    "append",
    "copy",
    "delete",
    "close",
    "panic",
    "recover",
    "print",
    "println",
    "complex",
    "real",
    "imag",
    "error",
    "nil",
    "true",
    "false",
    "iota",
    "int",
    "int8",
    "int16",
    "int32",
    "int64",
    "uint",
    "uint8",
    "uint16",
    "uint32",
    "uint64",
    "uintptr",
    "float32",
    "float64",
    "complex64",
    "complex128",
    "string",
    "bool",
    "byte",
    "rune",
    "any",
];