visitMapLiteralEntry method

  1. @override
void visitMapLiteralEntry(
  1. MapLiteralEntry node
)
override

Implementation

@override
void visitMapLiteralEntry(MapLiteralEntry node) {
  final mapLiteral = node.thisOrAncestorOfType<SetOrMapLiteral>();
  if (mapLiteral == null || mapLiteral.isSet) return;

  // Check key
  final keyType = mapLiteral.getIterableGenericType(IterableType.mapKey);
  if (keyType != null) {
    _checkExpression(node.key, keyType);
  }

  // Check value
  final valueType = mapLiteral.getIterableGenericType(IterableType.mapValue);
  if (valueType != null) {
    _checkExpression(node.value, valueType);
  }
}