Skip to content

Commit 8eeffb7

Browse files
committed
---
yaml --- r: 917 b: refs/heads/master c: e94af48 h: refs/heads/master i: 915: f38c043 v: v3
1 parent 3691659 commit 8eeffb7

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 77ff12c435aeb6181ee2678a526b6f6ea3831938
2+
refs/heads/master: e94af48bc9d9b2b1bec39368614af14cdb3a296a

trunk/src/comp/front/parser.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,17 @@ impure fn parse_arg(parser p) -> ast.arg {
198198
ret rec(mode=m, ty=t, ident=i, id=p.next_def_id());
199199
}
200200

201+
// FIXME: workaround for a bug in the typestate walk of
202+
// the while-graph; the while-loop header doesn't drop
203+
// its slots, so "while (p.peek() ...) { ... }" leaks.
204+
205+
fn peeking_at(parser p, token.token t) -> bool {
206+
if (p.peek() == t) {
207+
ret true;
208+
}
209+
ret false;
210+
}
211+
201212
impure fn parse_seq[T](token.token bra,
202213
token.token ket,
203214
option.t[token.token] sep,
@@ -207,7 +218,7 @@ impure fn parse_seq[T](token.token bra,
207218
auto lo = p.get_span();
208219
expect(p, bra);
209220
let vec[T] v = vec();
210-
while (p.peek() != ket) {
221+
while (!peeking_at(p, ket)) {
211222
alt(sep) {
212223
case (some[token.token](?t)) {
213224
if (first) {
@@ -925,7 +936,7 @@ impure fn parse_mod_items(parser p, token.token term) -> ast._mod {
925936
let vec[@ast.item] items = vec();
926937
let hashmap[ast.ident,uint] index = new_str_hash[uint]();
927938
let uint u = 0u;
928-
while (p.peek() != term) {
939+
while (!peeking_at(p, term)) {
929940
auto pair = parse_item(p);
930941
append[@ast.item](items, pair._1);
931942
index.insert(pair._0, u);

0 commit comments

Comments
 (0)