spanForNode function

SourceSpan spanForNode(
  1. AstNode node
)

Returns a source span that spans the location where node is written.

Implementation

SourceSpan spanForNode(AstNode node) {
  final SourceFile file = SourceFile.fromString(node.toSource());
  return file.span(node.offset, node.offset + node.length);
}