evaluate method

  1. @override
List<Fact> evaluate(
  1. Map<String, List<List<Object>>> facts,
  2. Map<String, List<List<Object>>> derived
)
override

Evaluates the rule and returns derived facts.

Implementation

@override
List<Fact> evaluate(
  Map<String, List<List<Object>>> facts,
  Map<String, List<List<Object>>> derived,
) {
  final result = <Fact>[];
  final heapPointsTo = getCombined('HeapPointsTo', facts, derived);
  final mutable = getCombined('Mutable', facts, derived);

  for (final hpt in heapPointsTo) {
    final heap = hpt[0];
    final targetHeap = hpt[2];

    for (final m in mutable) {
      if (m[0] == targetHeap) {
        result.add(Fact('Mutable', [heap]));
      }
    }
  }

  return result;
}