Skip to main content

luaur_code_gen/functions/
can_invalidate_safe_env.rs

1use crate::enums::ir_cmd::IrCmd;
2
3#[inline]
4pub fn can_invalidate_safe_env(cmd: IrCmd) -> bool {
5    match cmd {
6        IrCmd::CMP_ANY
7        | IrCmd::DO_ARITH
8        | IrCmd::DO_LEN
9        | IrCmd::GET_TABLE
10        | IrCmd::SET_TABLE
11        | IrCmd::CONCAT // TODO: if only strings and numbers are concatenated, there will be no user calls
12        | IrCmd::CALL
13        | IrCmd::FORGLOOP_FALLBACK
14        | IrCmd::FALLBACK_GETGLOBAL
15        | IrCmd::FALLBACK_SETGLOBAL
16        | IrCmd::FALLBACK_GETTABLEKS
17        | IrCmd::FALLBACK_SETTABLEKS
18        | IrCmd::FALLBACK_NAMECALL
19        | IrCmd::FALLBACK_FORGPREP => true,
20        _ => false,
21    }
22}