getSpan function

SourceSpan getSpan(
  1. SourceFile sourceFile,
  2. AstNode node, {
  3. bool skipCommentAndMetadata = true,
})

Implementation

SourceSpan getSpan(SourceFile sourceFile, AstNode node,
    {bool skipCommentAndMetadata = true}) {
  if (skipCommentAndMetadata && node is AnnotatedNode) {
    return sourceFile.span(
        node.firstTokenAfterCommentAndMetadata.offset, node.end);
  }

  return sourceFile.span(node.offset, node.end);
}