isASTLiteralDouble function

bool isASTLiteralDouble(
  1. Node? astNode
)

Implementation

bool isASTLiteralDouble(Node? astNode) {
  if (astNode != null && astNode is LiteralNode) {
    final LiteralNode literalNode = astNode;
    if (literalNode.raw != null) {
      final containsPoint = literalNode.raw!.contains('.');
      final containsExponent = literalNode.raw!.contains('e');
      if (containsPoint || containsExponent) {
        var isDouble = containsPoint;
        if (containsExponent) {
          final matches = _pattern.firstMatch(literalNode.raw!);
          if (matches != null) {
            final integer = matches[1]!;
            final comma = matches[2]!;
            final exponent = matches[3]!;
            isDouble = _isDoubleWithExponential(integer, comma, exponent);
          }
        }
        return isDouble;
      }
    }
  }
  return false;
}