savePrecedings method

List<ASTAnnotation> savePrecedings()

To handle the comments & empty lines before a expr;

Implementation

List<ASTAnnotation> savePrecedings() {
  List<ASTAnnotation> precedings = [];
  while (curTok is TokenComment || curTok is TokenEmptyLine) {
    ASTAnnotation documentation;
    if (curTok is TokenComment) {
      documentation = ASTComment.fromCommentToken(advance() as TokenComment);
    } else {
      final token = advance();
      documentation = ASTEmptyLine(
        source: currentSource,
        line: token.line,
        column: token.column,
        offset: token.offset,
        length: token.length,
      );
    }
    precedings.add(documentation);
  }
  return precedings;
}