Skip to content

Commit 94d98db

Browse files
committed
---
yaml --- r: 6428 b: refs/heads/master c: bd16aac h: refs/heads/master v: v3
1 parent 6601db6 commit 94d98db

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
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: 5d6a74f020dba8d25c21670bdcf7bdf8744bffaf
2+
refs/heads/master: bd16aac903357e30e1e3d3fe8390d6a6e2b7434c

trunk/src/comp/middle/trans_alt.rs

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,9 @@ fn assoc(key: str, list: bind_map) -> option::t<ValueRef> {
9191
type match_branch =
9292
@{pats: [@ast::pat],
9393
bound: bind_map,
94-
data:
95-
@{body: BasicBlockRef,
96-
guard: option::t<@ast::expr>,
97-
id_map: ast_util::pat_id_map}};
94+
data: @{body: BasicBlockRef,
95+
guard: option::t<@ast::expr>,
96+
id_map: ast_util::pat_id_map}};
9897
type match = [match_branch];
9998

10099
fn matches_always(p: @ast::pat) -> bool {
@@ -114,18 +113,15 @@ fn enter_match(m: match, col: uint, val: ValueRef, e: enter_pat) -> match {
114113
for br: match_branch in m {
115114
alt e(br.pats[col]) {
116115
some(sub) {
117-
let pats =
118-
vec::slice(br.pats, 0u, col) + sub +
119-
vec::slice(br.pats, col + 1u, vec::len(br.pats));
120-
let new_br =
121-
@{pats: pats,
122-
bound:
123-
alt br.pats[col].node {
124-
ast::pat_bind(name) {
125-
br.bound + [{ident: name, val: val}]
126-
}
127-
_ { br.bound }
128-
} with *br};
116+
let pats = sub + vec::slice(br.pats, 0u, col) +
117+
vec::slice(br.pats, col + 1u, vec::len(br.pats));
118+
let new_br = @{pats: pats,
119+
bound: alt br.pats[col].node {
120+
ast::pat_bind(name) {
121+
br.bound + [{ident: name, val: val}]
122+
}
123+
_ { br.bound }
124+
} with *br};
129125
result += [new_br];
130126
}
131127
none. { }
@@ -386,7 +382,6 @@ fn compile_submatch(bcx: @block_ctxt, m: match, vals: [ValueRef], f: mk_fail,
386382
let ccx = bcx.fcx.lcx.ccx;
387383
let pat_id = 0;
388384
for br: match_branch in m {
389-
390385
// Find a real id (we're adding placeholder wildcard patterns, but
391386
// each column is guaranteed to have at least one real pattern)
392387
if pat_id == 0 { pat_id = br.pats[col].id; }

0 commit comments

Comments
 (0)