diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2015-11-11 18:26:14 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2015-11-12 09:23:37 +1300 |
| commit | f7dc917ba44c13e5ec00503dd82b857211437f48 (patch) | |
| tree | 4bc5443e5f6fa40d48822b3b66bd4e4e7d93ff03 /src/libsyntax/codemap.rs | |
| parent | f1f5c04c07f2e888c43cb577810659a7c1d87a00 (diff) | |
| download | rust-f7dc917ba44c13e5ec00503dd82b857211437f48.tar.gz rust-f7dc917ba44c13e5ec00503dd82b857211437f48.zip | |
Add -Zinput-stats
Emits loc, and node count - before and after expansion. E.g., ``` rustc: x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore Lines of code: 32060 Pre-expansion node count: 120205 Post-expansion node count: 482749 ```
Diffstat (limited to 'src/libsyntax/codemap.rs')
| -rw-r--r-- | src/libsyntax/codemap.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index a73fd4534c9..db011265c73 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -559,6 +559,10 @@ impl FileMap { pub fn is_imported(&self) -> bool { self.src.is_none() } + + fn count_lines(&self) -> usize { + self.lines.borrow().len() + } } /// An abstraction over the fs operations used by the Parser. @@ -1021,6 +1025,10 @@ impl CodeMap { debug!("span_allows_unstable? {}", allows_unstable); allows_unstable } + + pub fn count_lines(&self) -> usize { + self.files.borrow().iter().fold(0, |a, f| a + f.count_lines()) + } } // _____________________________________________________________________________ |
