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

Method get_statement

crates/vm/src/vm/vm_new.rs:486–493  ·  view source on GitHub ↗

TODO: replace to SourceCode

(source: &str, loc: Option<SourceLocation>)

Source from the content-addressed store, hash-verified

484
485 // TODO: replace to SourceCode
486 fn get_statement(source: &str, loc: Option<SourceLocation>) -> Option<String> {
487 let line = source
488 .split('\n')
489 .nth(loc?.line.to_zero_indexed())?
490 .trim_end_matches('\r')
491 .to_owned();
492 Some(line + "\n")
493 }
494
495 let statement = if let Some(source) = source {
496 get_statement(source, error.location())

Callers

nothing calls this directly

Calls 4

trim_end_matchesMethod · 0.80
SomeClass · 0.50
to_ownedMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected