visitUnaryOperationAsync method

  1. @override
Future visitUnaryOperationAsync(
  1. UnaryOperation node
)

Implementation

@override
Future<dynamic> visitUnaryOperationAsync(UnaryOperation node) async {
  final expr = await node.expression.acceptAsync(this);
  switch (node.operator) {
    case 'not':
    case '!':
      return !isTruthy(expr);
    default:
      throw UnsupportedError('Unsupported operator: ${node.operator}');
  }
}