def hit

bolt@1.27.0.0 · src/rules/table.bend:236

import bolt@1.27.0.0/src/rules/table.bend as Table
import Base
import bolt@1.27.0.0/src/finding.bend as F
import bolt@1.27.0.0/src/syntax/tree.bend as Tree
import bolt@1.27.0.0/src/rules/calls.bend as Calls

236# a get or a set of a fixed table at a computed index
237def hit(
238  +open: Bool,
239  +tt: String,
240  kids: Tree.Node,
241  +fixed: List<&2, String>,
242  +path: String,
243  +line: U32,
244  +col: U32
245) -> List<&2, F.Finding>:
246  +get = String.eq(tt, "List.get")
247  +set = String.eq(tt, "List.set")
248  +op = Bool.and(open, Bool.or(get, set))
249  +as = Calls.args(kids)
250  +fire = Bool.and(op, Bool.and(Bool.not(literal(Calls.arg(as, 3n))), owns(Calls.arg(as, 2n), fixed)))
251  Bool.pick(List<&2, F.Finding>, fire,
252    [cite(get, path, line, col, U32.from_nat(String.length(tt)))], [])

Uses (18)

Used by (0)

No other definition uses this definition.