Skip to content

Commit 4a85389

Browse files
committed
De-implicit-self librustc
1 parent cec1f38 commit 4a85389

26 files changed

+626
-569
lines changed

src/librustc/driver/session.rs

+48-38
Original file line numberDiff line numberDiff line change
@@ -165,49 +165,49 @@ pub struct Session_ {
165165
pub type Session = @Session_;
166166

167167
pub impl Session {
168-
fn span_fatal(sp: span, msg: ~str) -> ! {
168+
fn span_fatal(&self, sp: span, msg: ~str) -> ! {
169169
self.span_diagnostic.span_fatal(sp, msg)
170170
}
171-
fn fatal(msg: ~str) -> ! {
171+
fn fatal(&self, msg: ~str) -> ! {
172172
self.span_diagnostic.handler().fatal(msg)
173173
}
174-
fn span_err(sp: span, msg: ~str) {
174+
fn span_err(&self, sp: span, msg: ~str) {
175175
self.span_diagnostic.span_err(sp, msg)
176176
}
177-
fn err(msg: ~str) {
177+
fn err(&self, msg: ~str) {
178178
self.span_diagnostic.handler().err(msg)
179179
}
180-
fn has_errors() -> bool {
180+
fn has_errors(&self) -> bool {
181181
self.span_diagnostic.handler().has_errors()
182182
}
183-
fn abort_if_errors() {
183+
fn abort_if_errors(&self) {
184184
self.span_diagnostic.handler().abort_if_errors()
185185
}
186-
fn span_warn(sp: span, msg: ~str) {
186+
fn span_warn(&self, sp: span, msg: ~str) {
187187
self.span_diagnostic.span_warn(sp, msg)
188188
}
189-
fn warn(msg: ~str) {
189+
fn warn(&self, msg: ~str) {
190190
self.span_diagnostic.handler().warn(msg)
191191
}
192-
fn span_note(sp: span, msg: ~str) {
192+
fn span_note(&self, sp: span, msg: ~str) {
193193
self.span_diagnostic.span_note(sp, msg)
194194
}
195-
fn note(msg: ~str) {
195+
fn note(&self, msg: ~str) {
196196
self.span_diagnostic.handler().note(msg)
197197
}
198-
fn span_bug(sp: span, msg: ~str) -> ! {
198+
fn span_bug(&self, sp: span, msg: ~str) -> ! {
199199
self.span_diagnostic.span_bug(sp, msg)
200200
}
201-
fn bug(msg: ~str) -> ! {
201+
fn bug(&self, msg: ~str) -> ! {
202202
self.span_diagnostic.handler().bug(msg)
203203
}
204-
fn span_unimpl(sp: span, msg: ~str) -> ! {
204+
fn span_unimpl(&self, sp: span, msg: ~str) -> ! {
205205
self.span_diagnostic.span_unimpl(sp, msg)
206206
}
207-
fn unimpl(msg: ~str) -> ! {
207+
fn unimpl(&self, msg: ~str) -> ! {
208208
self.span_diagnostic.handler().unimpl(msg)
209209
}
210-
fn span_lint_level(level: lint::level, sp: span, +msg: ~str) {
210+
fn span_lint_level(&self, level: lint::level, sp: span, +msg: ~str) {
211211
match level {
212212
lint::allow => { },
213213
lint::warn => self.span_warn(sp, msg),
@@ -216,7 +216,7 @@ pub impl Session {
216216
}
217217
}
218218
}
219-
fn span_lint(lint_mode: lint::lint,
219+
fn span_lint(&self, lint_mode: lint::lint,
220220
expr_id: ast::node_id,
221221
item_id: ast::node_id,
222222
span: span,
@@ -225,45 +225,55 @@ pub impl Session {
225225
self.lint_settings, lint_mode, expr_id, item_id);
226226
self.span_lint_level(level, span, msg);
227227
}
228-
fn next_node_id() -> ast::node_id {
228+
fn next_node_id(&self) -> ast::node_id {
229229
return syntax::parse::next_node_id(self.parse_sess);
230230
}
231-
fn diagnostic() -> diagnostic::span_handler {
231+
fn diagnostic(&self) -> diagnostic::span_handler {
232232
self.span_diagnostic
233233
}
234-
fn debugging_opt(opt: uint) -> bool {
234+
fn debugging_opt(&self, opt: uint) -> bool {
235235
(self.opts.debugging_opts & opt) != 0u
236236
}
237237
// This exists to help with refactoring to eliminate impossible
238238
// cases later on
239-
fn impossible_case(sp: span, msg: &str) -> ! {
239+
fn impossible_case(&self, sp: span, msg: &str) -> ! {
240240
self.span_bug(sp, fmt!("Impossible case reached: %s", msg));
241241
}
242-
fn verbose() -> bool { self.debugging_opt(verbose) }
243-
fn time_passes() -> bool { self.debugging_opt(time_passes) }
244-
fn count_llvm_insns() -> bool { self.debugging_opt(count_llvm_insns) }
245-
fn count_type_sizes() -> bool { self.debugging_opt(count_type_sizes) }
246-
fn time_llvm_passes() -> bool { self.debugging_opt(time_llvm_passes) }
247-
fn trans_stats() -> bool { self.debugging_opt(trans_stats) }
248-
fn meta_stats() -> bool { self.debugging_opt(meta_stats) }
249-
fn no_asm_comments() -> bool { self.debugging_opt(no_asm_comments) }
250-
fn no_verify() -> bool { self.debugging_opt(no_verify) }
251-
fn trace() -> bool { self.debugging_opt(trace) }
252-
fn coherence() -> bool { self.debugging_opt(coherence) }
253-
fn borrowck_stats() -> bool { self.debugging_opt(borrowck_stats) }
254-
fn borrowck_note_pure() -> bool { self.debugging_opt(borrowck_note_pure) }
255-
fn borrowck_note_loan() -> bool { self.debugging_opt(borrowck_note_loan) }
256-
fn no_monomorphic_collapse() -> bool {
242+
fn verbose(&self) -> bool { self.debugging_opt(verbose) }
243+
fn time_passes(&self) -> bool { self.debugging_opt(time_passes) }
244+
fn count_llvm_insns(&self) -> bool {
245+
self.debugging_opt(count_llvm_insns)
246+
}
247+
fn count_type_sizes(&self) -> bool {
248+
self.debugging_opt(count_type_sizes)
249+
}
250+
fn time_llvm_passes(&self) -> bool {
251+
self.debugging_opt(time_llvm_passes)
252+
}
253+
fn trans_stats(&self) -> bool { self.debugging_opt(trans_stats) }
254+
fn meta_stats(&self) -> bool { self.debugging_opt(meta_stats) }
255+
fn no_asm_comments(&self) -> bool { self.debugging_opt(no_asm_comments) }
256+
fn no_verify(&self) -> bool { self.debugging_opt(no_verify) }
257+
fn trace(&self) -> bool { self.debugging_opt(trace) }
258+
fn coherence(&self) -> bool { self.debugging_opt(coherence) }
259+
fn borrowck_stats(&self) -> bool { self.debugging_opt(borrowck_stats) }
260+
fn borrowck_note_pure(&self) -> bool {
261+
self.debugging_opt(borrowck_note_pure)
262+
}
263+
fn borrowck_note_loan(&self) -> bool {
264+
self.debugging_opt(borrowck_note_loan)
265+
}
266+
fn no_monomorphic_collapse(&self) -> bool {
257267
self.debugging_opt(no_monomorphic_collapse)
258268
}
259269

260-
fn str_of(id: ast::ident) -> @~str {
270+
fn str_of(&self, id: ast::ident) -> @~str {
261271
self.parse_sess.interner.get(id)
262272
}
263-
fn ident_of(+st: ~str) -> ast::ident {
273+
fn ident_of(&self, +st: ~str) -> ast::ident {
264274
self.parse_sess.interner.intern(@st)
265275
}
266-
fn intr() -> @syntax::parse::token::ident_interner {
276+
fn intr(&self) -> @syntax::parse::token::ident_interner {
267277
self.parse_sess.interner
268278
}
269279
}

src/librustc/metadata/filesearch.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ pub fn pick_file(file: Path, path: &Path) -> Option<Path> {
2929
}
3030

3131
pub trait FileSearch {
32-
fn sysroot() -> Path;
33-
fn lib_search_paths() -> ~[Path];
34-
fn get_target_lib_path() -> Path;
35-
fn get_target_lib_file_path(file: &Path) -> Path;
32+
fn sysroot(&self) -> Path;
33+
fn lib_search_paths(&self) -> ~[Path];
34+
fn get_target_lib_path(&self) -> Path;
35+
fn get_target_lib_file_path(&self, file: &Path) -> Path;
3636
}
3737

3838
pub fn mk_filesearch(maybe_sysroot: Option<Path>,
@@ -44,8 +44,8 @@ pub fn mk_filesearch(maybe_sysroot: Option<Path>,
4444
target_triple: ~str
4545
}
4646
impl FileSearch for FileSearchImpl {
47-
fn sysroot() -> Path { /*bad*/copy self.sysroot }
48-
fn lib_search_paths() -> ~[Path] {
47+
fn sysroot(&self) -> Path { /*bad*/copy self.sysroot }
48+
fn lib_search_paths(&self) -> ~[Path] {
4949
let mut paths = /*bad*/copy self.addl_lib_search_paths;
5050

5151
paths.push(
@@ -61,10 +61,10 @@ pub fn mk_filesearch(maybe_sysroot: Option<Path>,
6161
}
6262
paths
6363
}
64-
fn get_target_lib_path() -> Path {
64+
fn get_target_lib_path(&self) -> Path {
6565
make_target_lib_path(&self.sysroot, self.target_triple)
6666
}
67-
fn get_target_lib_file_path(file: &Path) -> Path {
67+
fn get_target_lib_file_path(&self, file: &Path) -> Path {
6868
self.get_target_lib_path().push_rel(file)
6969
}
7070
}

0 commit comments

Comments
 (0)