MCPcopy Index your code
hub / github.com/RustPython/RustPython / take_docstring

Function take_docstring

crates/vm/src/stdlib/_ast.rs:560–570  ·  view source on GitHub ↗
(body: &mut Vec<ast::Stmt>)

Source from the content-addressed store, hash-verified

558
559#[cfg(feature = "parser")]
560fn take_docstring(body: &mut Vec<ast::Stmt>) -> Option<TextRange> {
561 let ast::Stmt::Expr(expr_stmt) = body.first()? else {
562 return None;
563 };
564 if matches!(expr_stmt.value.as_ref(), ast::Expr::StringLiteral(_)) {
565 let range = expr_stmt.range;
566 body.remove(0);
567 return Some(range);
568 }
569 None
570}
571
572#[cfg(feature = "parser")]
573fn fold_stmts(stmts: &mut [ast::Stmt]) {

Callers 1

strip_docstring_in_bodyFunction · 0.85

Calls 3

SomeClass · 0.50
firstMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected