compute method Null safety

  1. @override
Map compute(
  1. SymbolTable? scope
)
override

Implementation

@override
Map compute(scope) {
  return pairs.fold<Map>({}, (out, p) {
    dynamic key;
    dynamic value;

    if (p.colon == null) {
      if (p.key is! Identifier) {
        key = value = p.key.compute(scope);
      } else {
        key = (p.key as Identifier).name;
        value = p.key.compute(scope);
      }
    } else {
      key = p.key.compute(scope);
      value = p.value?.compute(scope);
    }

    return out..[key] = value;
  });
}