Skip to content

Commit d3ef81e

Browse files
committed
---
yaml --- r: 3006 b: refs/heads/master c: 1c48102 h: refs/heads/master v: v3
1 parent c4d9273 commit d3ef81e

File tree

6 files changed

+43
-26
lines changed

6 files changed

+43
-26
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: 1408e1aa16d6212613f18c6e0b833433a959c975
2+
refs/heads/master: 1c481028388b076c74bc68c001f173b8ec5a4b83

trunk/src/comp/front/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,10 @@ tag ty_ {
334334
ty_machine(util::common::ty_mach);
335335
ty_char;
336336
ty_str;
337+
ty_istr; // interior string
337338
ty_box(mt);
338339
ty_vec(mt);
340+
ty_ivec(mt); // interior vector
339341
ty_ptr(mt);
340342
ty_task;
341343
ty_port(@ty);
@@ -346,8 +348,6 @@ tag ty_ {
346348
ty_obj(vec[ty_method]);
347349
ty_path(path, ann);
348350
ty_type;
349-
ty_ivec(@ty); // interior vector
350-
ty_istr; // interior string
351351
ty_constr(@ty, vec[@constr]);
352352
}
353353

trunk/src/comp/front/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ fn parse_ty(&parser p) -> @ast::ty {
573573
expect(p, token::RBRACKET);
574574
} else if (eat_word(p, "ivec")) {
575575
expect(p, token::LBRACKET);
576-
t = ast::ty_ivec(parse_ty(p));
576+
t = ast::ty_ivec(parse_mt(p));
577577
hi = p.get_hi_pos();
578578
expect(p, token::RBRACKET);
579579
} else if (eat_word(p, "mutable")) {

trunk/src/comp/middle/ty.rs

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ tag sty {
105105
ty_machine(util::common::ty_mach);
106106
ty_char;
107107
ty_str;
108+
ty_istr;
108109
ty_tag(ast::def_id, vec[t]);
109110
ty_box(mt);
110111
ty_vec(mt);
112+
ty_ivec(mt);
111113
ty_ptr(mt);
112114
ty_port(t);
113115
ty_chan(t);
@@ -162,11 +164,12 @@ const uint idx_f32 = 13u;
162164
const uint idx_f64 = 14u;
163165
const uint idx_char = 15u;
164166
const uint idx_str = 16u;
165-
const uint idx_task = 17u;
166-
const uint idx_native = 18u;
167-
const uint idx_type = 19u;
168-
const uint idx_bot = 20u;
169-
const uint idx_first_others = 21u;
167+
const uint idx_istr = 17u;
168+
const uint idx_task = 18u;
169+
const uint idx_native = 19u;
170+
const uint idx_type = 20u;
171+
const uint idx_bot = 21u;
172+
const uint idx_first_others = 22u;
170173

171174
type type_store = interner::interner[raw_t];
172175

@@ -193,6 +196,7 @@ fn populate_type_store(&ctxt cx) {
193196
intern(cx, ty_machine(ty_f64), none[str]);
194197
intern(cx, ty_char, none[str]);
195198
intern(cx, ty_str, none[str]);
199+
intern(cx, ty_istr, none[str]);
196200
intern(cx, ty_task, none[str]);
197201
intern(cx, ty_native, none[str]);
198202
intern(cx, ty_type, none[str]);
@@ -388,6 +392,7 @@ fn mk_mach(&ctxt cx, &util::common::ty_mach tm) -> t {
388392

389393
fn mk_char(&ctxt cx) -> t { ret idx_char; }
390394
fn mk_str(&ctxt cx) -> t { ret idx_str; }
395+
fn mk_istr(&ctxt cx) -> t { ret idx_istr; }
391396

392397
fn mk_tag(&ctxt cx, &ast::def_id did, &vec[t] tys) -> t {
393398
ret gen_ty(cx, ty_tag(did, tys));
@@ -407,6 +412,8 @@ fn mk_imm_box(&ctxt cx, &t ty) -> t {
407412

408413
fn mk_vec(&ctxt cx, &mt tm) -> t { ret gen_ty(cx, ty_vec(tm)); }
409414

415+
fn mk_ivec(&ctxt cx, &mt tm) -> t { ret gen_ty(cx, ty_ivec(tm)); }
416+
410417
fn mk_imm_vec(&ctxt cx, &t typ) -> t {
411418
ret gen_ty(cx, ty_vec(rec(ty=typ, mut=ast::imm)));
412419
}
@@ -494,10 +501,12 @@ fn walk_ty(&ctxt cx, ty_walk walker, t ty) {
494501
case (ty_machine(_)) { /* no-op */ }
495502
case (ty_char) { /* no-op */ }
496503
case (ty_str) { /* no-op */ }
504+
case (ty_istr) { /* no-op */ }
497505
case (ty_type) { /* no-op */ }
498506
case (ty_native) { /* no-op */ }
499507
case (ty_box(?tm)) { walk_ty(cx, walker, tm.ty); }
500508
case (ty_vec(?tm)) { walk_ty(cx, walker, tm.ty); }
509+
case (ty_ivec(?tm)) { walk_ty(cx, walker, tm.ty); }
501510
case (ty_port(?subty)) { walk_ty(cx, walker, subty); }
502511
case (ty_chan(?subty)) { walk_ty(cx, walker, subty); }
503512
case (ty_tag(?tid, ?subtys)) {
@@ -998,48 +1007,50 @@ fn hash_type_structure(&sty st) -> uint {
9981007
}
9991008
case (ty_char) { ret 15u; }
10001009
case (ty_str) { ret 16u; }
1010+
case (ty_istr) { ret 17u; }
10011011
case (ty_tag(?did, ?tys)) {
1002-
auto h = hash_def(17u, did);
1012+
auto h = hash_def(18u, did);
10031013
for (t typ in tys) {
10041014
h += h << 5u + hash_ty(typ);
10051015
}
10061016
ret h;
10071017
}
1008-
case (ty_box(?mt)) { ret hash_subty(18u, mt.ty); }
1009-
case (ty_vec(?mt)) { ret hash_subty(19u, mt.ty); }
1010-
case (ty_port(?typ)) { ret hash_subty(20u, typ); }
1011-
case (ty_chan(?typ)) { ret hash_subty(21u, typ); }
1012-
case (ty_task) { ret 22u; }
1018+
case (ty_box(?mt)) { ret hash_subty(19u, mt.ty); }
1019+
case (ty_vec(?mt)) { ret hash_subty(20u, mt.ty); }
1020+
case (ty_ivec(?mt)) { ret hash_subty(21u, mt.ty); }
1021+
case (ty_port(?typ)) { ret hash_subty(22u, typ); }
1022+
case (ty_chan(?typ)) { ret hash_subty(23u, typ); }
1023+
case (ty_task) { ret 24u; }
10131024
case (ty_tup(?mts)) {
1014-
auto h = 23u;
1025+
auto h = 25u;
10151026
for (mt tm in mts) {
10161027
h += h << 5u + hash_ty(tm.ty);
10171028
}
10181029
ret h;
10191030
}
10201031
case (ty_rec(?fields)) {
1021-
auto h = 24u;
1032+
auto h = 26u;
10221033
for (field f in fields) {
10231034
h += h << 5u + hash_ty(f.mt.ty);
10241035
}
10251036
ret h;
10261037
}
10271038
// ???
1028-
case (ty_fn(_, ?args, ?rty, _, _)) { ret hash_fn(25u, args, rty); }
1029-
case (ty_native_fn(_, ?args, ?rty)) { ret hash_fn(26u, args, rty); }
1039+
case (ty_fn(_, ?args, ?rty, _, _)) { ret hash_fn(27u, args, rty); }
1040+
case (ty_native_fn(_, ?args, ?rty)) { ret hash_fn(28u, args, rty); }
10301041
case (ty_obj(?methods)) {
1031-
auto h = 27u;
1042+
auto h = 29u;
10321043
for (method m in methods) {
10331044
h += h << 5u + str::hash(m.ident);
10341045
}
10351046
ret h;
10361047
}
1037-
case (ty_var(?v)) { ret hash_uint(28u, v as uint); }
1038-
case (ty_param(?pid)) { ret hash_uint(29u, pid); }
1039-
case (ty_type) { ret 30u; }
1040-
case (ty_native) { ret 31u; }
1041-
case (ty_bot) { ret 32u; }
1042-
case (ty_ptr(?mt)) { ret hash_subty(33u, mt.ty); }
1048+
case (ty_var(?v)) { ret hash_uint(30u, v as uint); }
1049+
case (ty_param(?pid)) { ret hash_uint(31u, pid); }
1050+
case (ty_type) { ret 32u; }
1051+
case (ty_native) { ret 33u; }
1052+
case (ty_bot) { ret 34u; }
1053+
case (ty_ptr(?mt)) { ret hash_subty(35u, mt.ty); }
10431054
}
10441055
}
10451056

trunk/src/comp/middle/typeck.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,12 +277,16 @@ fn ast_ty_to_ty(&ty::ctxt tcx, &ty_getter getter, &@ast::ty ast_ty) -> ty::t {
277277
case (ast::ty_machine(?tm)) { typ = ty::mk_mach(tcx, tm); }
278278
case (ast::ty_char) { typ = ty::mk_char(tcx); }
279279
case (ast::ty_str) { typ = ty::mk_str(tcx); }
280+
case (ast::ty_istr) { typ = ty::mk_istr(tcx); }
280281
case (ast::ty_box(?mt)) {
281282
typ = ty::mk_box(tcx, ast_mt_to_mt(tcx, getter, mt));
282283
}
283284
case (ast::ty_vec(?mt)) {
284285
typ = ty::mk_vec(tcx, ast_mt_to_mt(tcx, getter, mt));
285286
}
287+
case (ast::ty_ivec(?mt)) {
288+
typ = ty::mk_ivec(tcx, ast_mt_to_mt(tcx, getter, mt));
289+
}
286290
case (ast::ty_ptr(?mt)) {
287291
typ = ty::mk_ptr(tcx, ast_mt_to_mt(tcx, getter, mt));
288292
}

trunk/src/comp/middle/walk.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,10 @@ fn walk_ty(&ast_visitor v, @ast::ty t) {
154154
case (ast::ty_machine(_)) {}
155155
case (ast::ty_char) {}
156156
case (ast::ty_str) {}
157+
case (ast::ty_istr) {}
157158
case (ast::ty_box(?mt)) { walk_ty(v, mt.ty); }
158159
case (ast::ty_vec(?mt)) { walk_ty(v, mt.ty); }
160+
case (ast::ty_ivec(?mt)) { walk_ty(v, mt.ty); }
159161
case (ast::ty_ptr(?mt)) { walk_ty(v, mt.ty); }
160162
case (ast::ty_task) {}
161163
case (ast::ty_port(?t)) { walk_ty(v, t); }

0 commit comments

Comments
 (0)