fn renderDocComments(r: *Render, end_token: Ast.TokenIndex) Error!void OutOfMemoryRan out of memory allocating call stack frames to complete rendering.
WriteFailedTransitive failure from
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130fn renderDocComments(r: *Render, end_token: Ast.TokenIndex) Error!void {
const tree = r.tree;
// Search backwards for the first doc comment.
if (end_token == 0) return;
var tok = end_token - 1;
while (tree.tokenTag(tok) == .doc_comment) {
if (tok == 0) break;
tok -= 1;
} else {
tok += 1;
}
const first_tok = tok;
if (first_tok == end_token) return;
if (first_tok != 0) {
const prev_token_tag = tree.tokenTag(first_tok - 1);
// Prevent accidental use of `renderDocComments` for a function argument doc comment
assert(prev_token_tag != .l_paren);
if (prev_token_tag != .l_brace) {
try renderExtraNewlineToken(r, first_tok);
}
}
while (tree.tokenTag(tok) == .doc_comment) : (tok += 1) {
try renderToken(r, tok, .newline);
}
}
end_token is the token one past the last doc comment token. This function searches backwards from there.