Skip to content

Commit ecde206

Browse files
committed
Merge pull request #54 from ebfe/fix-build-master
Fix enum variant/type name clashes
2 parents fdde847 + 425855e commit ecde206

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

src/racer/codecleaner.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ pub fn slice<'a>(src: &'a str, (begin, end): (uint, uint)) -> &'a str{
2020
}
2121

2222
enum State {
23-
Code,
24-
Comment,
25-
CommentBlock,
26-
String,
27-
Finished
23+
StateCode,
24+
StateComment,
25+
StateCommentBlock,
26+
StateString,
27+
StateFinished
2828
}
2929

3030
pub struct CodeIndicesIter<'a> {
@@ -39,11 +39,11 @@ impl<'a> Iterator<(uint, uint)> for CodeIndicesIter<'a> {
3939
#[inline]
4040
fn next(&mut self) -> Option<(uint, uint)> {
4141
return match self.state {
42-
Code => code(self),
43-
Comment => comment(self),
44-
CommentBlock => comment_block(self),
45-
String => string(self),
46-
Finished => None
42+
StateCode => code(self),
43+
StateComment => comment(self),
44+
StateCommentBlock => comment_block(self),
45+
StateString => string(self),
46+
StateFinished => None
4747
}
4848
}
4949
}
@@ -60,28 +60,28 @@ fn code(self_: &mut CodeIndicesIter) -> Option<(uint,uint)> {
6060
if pos > 0 && src_bytes[pos] == slash && src_bytes[pos-1] == slash {
6161
self_.start = pos+1;
6262
self_.pos = pos+1;
63-
self_.state = Comment;
63+
self_.state = StateComment;
6464
return Some((start, pos-1));
6565
}
6666

6767
if pos > 0 && src_bytes[pos] == star && src_bytes[pos-1] == slash {
6868
self_.start = pos+1;
6969
self_.pos = pos+1;
70-
self_.state = CommentBlock;
70+
self_.state = StateCommentBlock;
7171
self_.nesting_level = 0;
7272
return Some((start, pos-1));
7373
}
7474

7575
if src_bytes[pos] == dblquote {
7676
self_.start = pos+1;
7777
self_.pos = pos+1;
78-
self_.state = String;
78+
self_.state = StateString;
7979
return Some((start, pos+1)); // include the dblquote in the code
8080
}
8181

8282
pos += 1;
8383
}
84-
self_.state = Finished;
84+
self_.state = StateFinished;
8585
return Some((start, end));
8686
}
8787

@@ -94,12 +94,12 @@ fn comment(self_: &mut CodeIndicesIter) -> Option<(uint,uint)> {
9494
if src_bytes[pos] == newline {
9595
self_.start = pos+1;
9696
self_.pos = pos+1;
97-
self_.state = Code;
97+
self_.state = StateCode;
9898
return code(self_);
9999
}
100100
pos += 1;
101101
}
102-
self_.state = Finished;
102+
self_.state = StateFinished;
103103
return Some((start, end));
104104
}
105105

@@ -118,15 +118,15 @@ fn comment_block(self_: &mut CodeIndicesIter) -> Option<(uint,uint)> {
118118
if self_.nesting_level == 0 {
119119
self_.start = pos+1;
120120
self_.pos = pos+1;
121-
self_.state = Code;
121+
self_.state = StateCode;
122122
return code(self_);
123123
} else {
124124
self_.nesting_level -= 1;
125125
}
126126
}
127127
pos += 1;
128128
}
129-
self_.state = Finished;
129+
self_.state = StateFinished;
130130
return Some((start, end));
131131
}
132132

@@ -152,18 +152,18 @@ fn string(self_: &mut CodeIndicesIter) -> Option<(uint,uint)> {
152152
if src_bytes[pos] == dblquote && !escaped(src_bytes, pos) {
153153
self_.start = pos; // include the dblquote as code
154154
self_.pos = pos+1;
155-
self_.state = Code;
155+
self_.state = StateCode;
156156
return code(self_);
157157
}
158158
pos += 1;
159159
}
160-
self_.state = Finished;
160+
self_.state = StateFinished;
161161
return Some((start, end));
162162
}
163163

164164
/// Returns indices of chunks of code (minus comments and string contents)
165165
pub fn code_chunks<'a>(src: &'a str) -> CodeIndicesIter<'a> {
166-
CodeIndicesIter { src: src, start: 0, pos: 0, state: Code, nesting_level: 0 }
166+
CodeIndicesIter { src: src, start: 0, pos: 0, state: StateCode, nesting_level: 0 }
167167
}
168168

169169
#[test]

src/racer/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pub enum Namespace {
4545

4646
#[deriving(Show)]
4747
pub enum CompletionType {
48-
Field,
49-
Path
48+
CompleteField,
49+
CompletePath
5050
}
5151

5252
#[deriving(Clone)]
@@ -145,7 +145,7 @@ pub fn complete_from_file(src: &str, filepath: &path::Path, pos: uint) -> vec::M
145145
let mut out = Vec::new();
146146

147147
match completetype {
148-
Path => {
148+
CompletePath => {
149149
let mut v : Vec<&str> = expr.split_str("::").collect();
150150
let mut global = false;
151151
if v[0] == "" { // i.e. starts with '::' e.g. ::std::io::blah
@@ -162,7 +162,7 @@ pub fn complete_from_file(src: &str, filepath: &path::Path, pos: uint) -> vec::M
162162
out.push(m);
163163
}
164164
},
165-
Field => {
165+
CompleteField => {
166166
let context = ast::get_type_of(contextstr.to_string(), filepath, pos);
167167
debug!("PHIL complete_from_file context is {}", context);
168168
context.map(|m| {
@@ -190,7 +190,7 @@ pub fn find_definition_(src: &str, filepath: &path::Path, pos: uint) -> Option<M
190190
debug!("PHIL searching for |{}| |{}| {:?}",contextstr, searchstr, completetype);
191191

192192
return match completetype {
193-
Path => {
193+
CompletePath => {
194194
let mut v : Vec<&str> = expr.split_str("::").collect();
195195
let mut global = false;
196196
if v[0] == "" { // i.e. starts with '::' e.g. ::std::io::blah
@@ -206,7 +206,7 @@ pub fn find_definition_(src: &str, filepath: &path::Path, pos: uint) -> Option<M
206206
return nameres::resolve_path(&path, filepath, pos,
207207
ExactMatch, BothNamespaces).nth(0);
208208
},
209-
Field => {
209+
CompleteField => {
210210
let context = ast::get_type_of(contextstr.to_string(), filepath, pos);
211211
debug!("PHIL context is {}",context);
212212

src/racer/scopes.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@ pub fn split_into_context_and_completion<'a>(s: &'a str) -> (&'a str, &'a str, r
140140
}
141141

142142
if start != 0 && s_bytes[start-1] == dot { // field completion
143-
return (s.slice_to(start-1), s.slice_from(start), racer::Field);
143+
return (s.slice_to(start-1), s.slice_from(start), racer::CompleteField);
144144
}
145145

146146
if start > 0 && s_bytes[start-1] == colon { // path completion
147-
return (s.slice_to(start-2), s.slice_from(start), racer::Path);
147+
return (s.slice_to(start-2), s.slice_from(start), racer::CompletePath);
148148
}
149149

150-
return (s.slice_to(start), s.slice_from(start), racer::Path);
150+
return (s.slice_to(start), s.slice_from(start), racer::CompletePath);
151151
}
152152

153153
pub fn get_start_of_search_expr(msrc: &str, point: uint) -> uint {

0 commit comments

Comments
 (0)