Commit Graph

463 Commits

Author SHA1 Message Date
Graydon Hoare
1f2585f479 Teach trans to access object fields. 2010-12-30 17:01:20 -08:00
Graydon Hoare
9676fb2d0a Assign method types properly by sorted-order. 2010-12-30 17:00:59 -08:00
Graydon Hoare
153efb58bc Teach typeck to check obj field accesses. 2010-12-30 15:28:19 -08:00
Graydon Hoare
bc9db2e972 Teach resolve to find obj fields and ty params from methods. 2010-12-30 15:27:52 -08:00
Graydon Hoare
a9d03dd1a2 Add def id to ast for obj fields. 2010-12-30 15:27:19 -08:00
Rafael Ávila de Espíndola
09ef31caa0 Record the ast of uses and imports. 2010-12-30 11:21:37 -05:00
Patrick Walton
a634b21563 rustc: Make parametric return types go through an out pointer 2010-12-29 19:08:35 -05:00
Rafael Ávila de Espíndola
2c6dd18224 Add a -shared option to rustc and don't try to look for main if it is given. 2010-12-29 11:21:16 -05:00
Rafael Ávila de Espíndola
f900792fa3 Parse 'import' directives in rustc. 2010-12-24 21:06:14 -08:00
Rafael Ávila de Espíndola
8d2fdac93b Parse 'use' directives in rustc. 2010-12-24 17:03:46 -08:00
Graydon Hoare
5c7cd6419c Modify translation of obj methods to accept an initial recursive-self-typed (in the LLVM sense) obj argument. 2010-12-23 17:31:16 -08:00
Graydon Hoare
f2195d8b0a Print recursive LLVM types. 2010-12-23 17:05:27 -08:00
Patrick Walton
daac7a8b13 rustc: Add a type_has_dynamic_size predicate 2010-12-22 18:02:48 -08:00
Graydon Hoare
3f3a121043 Copy body tydesc and args into obj bodies. 2010-12-22 16:09:59 -08:00
Graydon Hoare
a2a642c17a Correct bug in typechecking ctor arguments to nonempty objects. 2010-12-22 13:57:18 -08:00
Graydon Hoare
ac270fc854 Allocate heap cells to store non-empty object bodies. 2010-12-22 13:56:51 -08:00
Patrick Walton
0411132679 rustc: Move unification out of typeck.rs; trans will need it too. 2010-12-21 17:47:13 -08:00
Patrick Walton
e06263ff4b rustc: Reference count the function context in typechecking so that passing it around via objects isn't as costly 2010-12-21 17:27:29 -08:00
Graydon Hoare
3504f4a4bf Sort methods in object types. 2010-12-21 16:43:28 -08:00
Patrick Walton
744b164b7d rustc: Move type logic out of typeck so trans doesn't look like it's calling into typeck 2010-12-21 16:24:17 -08:00
Patrick Walton
b9286a7179 rustc: Sanitize names better. Puts out burning tinderbox on OS X. 2010-12-20 19:52:14 -08:00
Patrick Walton
5cbf8889d0 rustc: Add bind expressions to the AST 2010-12-20 18:58:18 -08:00
Graydon Hoare
ed1dddc33f Null-check on obj box ptr, init to null. Un-XFAIL simple-obj.rs. 2010-12-20 17:28:07 -08:00
Graydon Hoare
399929ba0b Support ty_obj in trans_field; simple-obj.rs compiles (but crashes). 2010-12-20 16:48:28 -08:00
Graydon Hoare
86188da348 Mop up cases of s/copy/take/, remove 'binding' terminology, whitespace police, and make obj/fn structural. 2010-12-20 16:26:38 -08:00
Patrick Walton
e70c695ab9 rustc: Use the passed-in tydescs for take and drop glue in parametric fns. Also fix a level-of-indirection problem with tydesc params. 2010-12-20 15:23:24 -08:00
Patrick Walton
194d7844ea rustc: Print the type when we die in trans.make_drop_glue_inner 2010-12-20 14:44:04 -08:00
Patrick Walton
9fb2284600 rustc: Add a type param ID -> type descriptor mapping to function contexts 2010-12-20 14:35:04 -08:00
Graydon Hoare
7bd30f83e1 Put out burning tree (sizeof / alignof bug). 2010-12-20 12:54:50 -08:00
Graydon Hoare
490da3564b Use gvars for vtbls rather than returning const immediates. 2010-12-20 11:41:32 -08:00
Graydon Hoare
6a8518c97b Trailing whitespace police. 2010-12-20 11:41:32 -08:00
Patrick Walton
a7e9984999 rustc: Build tydescs for types, and make all take and drop operations go through the tydescs for simplicity (LLVM inlines them). 2010-12-20 10:23:37 -08:00
Patrick Walton
ad5e920276 rustc: Remove the unused "name" parameter from trans.new_builder 2010-12-17 18:42:15 -08:00
Patrick Walton
9b56b79296 rustc: Make some no-op take and drop glue for scalar types 2010-12-17 18:40:24 -08:00
Graydon Hoare
01bcb1d10e Split part of typeck.check_fn out into typeck.check_item_fn, then check all fns, including obj fns. 2010-12-17 18:25:14 -08:00
Patrick Walton
7210a31e2a rustc: Make all drop and take glue have the same signature, so we can put them in tydescs 2010-12-17 18:20:51 -08:00
Graydon Hoare
b00abd04e2 Record type annotations for methods. 2010-12-17 17:52:25 -08:00
Patrick Walton
c44c7c5ab3 rustc: Zero out slots after dropping them 2010-12-17 17:21:56 -08:00
Graydon Hoare
56e040e61a Trans methods more correctly, and store vtbl pointer in pair returned from obj ctor. 2010-12-17 00:31:41 -08:00
Graydon Hoare
62d62ce4da Remove calltup fields from ABI, add binding fields. 2010-12-16 23:26:07 -08:00
Graydon Hoare
a3f828f941 Sketch trans_vtbl. 2010-12-16 18:34:04 -08:00
Patrick Walton
bfdba2dbcc rustc: Translate parametric function signatures into task + type parameters + formal arguments 2010-12-16 16:35:19 -08:00
Graydon Hoare
31f0642da3 Stub out translation of obj ctors (no vtbl or body built). 2010-12-16 15:55:28 -08:00
Patrick Walton
51782d2c21 rustc: Add a type fold mechanism to the typechecker 2010-12-16 15:13:04 -08:00
Patrick Walton
a6c6e8679e rustc: Only generalize on definition types that can actually be parametric 2010-12-16 13:59:20 -08:00
Patrick Walton
680e858d61 rustc: Write types back when typechecking "ret" statements 2010-12-16 12:25:39 -08:00
Patrick Walton
13b889287b rustc: Make trans.type_of handle parameter types 2010-12-16 12:23:48 -08:00
Patrick Walton
e6908a66ec rustc: Infer the types of type-parametric functions 2010-12-16 11:12:45 -08:00
Graydon Hoare
9759d1e08a Annotate obj items while folding ast in typeck. 2010-12-16 10:34:54 -08:00
Graydon Hoare
7d2feae857 Collect obj items, translate obj-name references and obj-ctor types. 2010-12-16 10:23:47 -08:00
Graydon Hoare
d8d2220b30 Typecheck object method calls. 2010-12-15 20:23:36 -08:00
Graydon Hoare
482dc0c8fa Convert obj item type to ctor type rather than obj type. 2010-12-15 17:04:21 -08:00
Patrick Walton
e17473de07 rustc: Move next_var_id back to the crate context in typechecking; we'll need it when collecting item types 2010-12-15 15:10:41 -08:00
Patrick Walton
d1b2366983 rustc: Resolve type params 2010-12-15 13:13:36 -08:00
Graydon Hoare
76aab6b1a8 Teach typeck to stringify obj types. 2010-12-15 12:30:31 -08:00
Patrick Walton
42789c4b97 rustc: Fix bug involving extracting any variant element beyond the first. Un-XFAIL alt-tag.rs. 2010-12-15 10:11:33 -08:00
Patrick Walton
2a8350e8d9 rustc: Resolve tag names in the typechecker 2010-12-15 10:00:28 -08:00
Patrick Walton
0d3400fec2 rustc: Lex '_' as an underscore, not as an identifier 2010-12-15 09:44:48 -08:00
Patrick Walton
e17806e1c8 rustc: Translate pattern matching 2010-12-15 09:38:40 -08:00
Graydon Hoare
cd55b7ed89 Teach typeck.ty, typeck.collect_item_types and typeck.check_expr about obj items. 2010-12-14 18:04:39 -08:00
Graydon Hoare
b1e0c60d6d Add ty_obj to ast and parser. 2010-12-14 17:42:12 -08:00
Graydon Hoare
4cddeed651 Teach resolve about obj items. 2010-12-14 17:09:37 -08:00
Graydon Hoare
a7eb1ac90f Move call_expr parse rule to the place where it needs to be to understand complex calls. 2010-12-14 16:59:13 -08:00
Graydon Hoare
e0998847be Teach fold about objs. 2010-12-14 16:35:31 -08:00
Graydon Hoare
b606ba81cf Add obj items to AST and parser. 2010-12-14 15:32:13 -08:00
Graydon Hoare
525966a543 Fix a couple bugs in iter_sequence, un-XFAIL vec-drop.rs. 2010-12-13 17:48:42 -08:00
Patrick Walton
90807e240f rustc: Typecheck pattern bindings 2010-12-13 16:44:20 -08:00
Patrick Walton
0ef65780ca rustc: Check patterns before arm blocks in alt expressions; this will be needed for binding type resolution 2010-12-13 16:39:35 -08:00
Patrick Walton
29e6d7a4ad rustc: Hack to get rid of passing i1 types for unit around in most cases, suggested by Rafael 2010-12-13 16:12:45 -08:00
Graydon Hoare
a3cbdc661c Set the new vec fill-size on the compiler side, as in rustboot. Un-XFAIL first 3 vec tests. 2010-12-13 11:16:04 -08:00
Patrick Walton
04e15bf8f8 rustc: Typecheck "alt" expressions and patterns 2010-12-12 20:02:49 -08:00
Patrick Walton
7d0734bb96 rustc: Propagate types for vector, tuple, record, assignment, and if expressions downward again 2010-12-12 19:54:58 -08:00
Patrick Walton
833af6f6f3 Revert "rustc: Propagate types for vector, tuple, record, assignment, and if expressions downward" due to test bustage
This reverts commit 1cdf42dd63.
2010-12-12 19:16:08 -08:00
Patrick Walton
d08b5bc3d4 rustc: Fix nonexhaustive match failure on unresolved identifiers 2010-12-12 16:49:51 -08:00
Patrick Walton
9ac42ca743 rustc: Resolve variant names in patterns 2010-12-12 16:47:37 -08:00
Patrick Walton
bc5fa9bf67 rustc: "resoling" -> "resolving" typo 2010-12-12 16:37:31 -08:00
Patrick Walton
38ba0e6917 rustc: Add a definition ID to tag patterns 2010-12-12 16:30:34 -08:00
Patrick Walton
1cdf42dd63 rustc: Propagate types for vector, tuple, record, assignment, and if expressions downward 2010-12-11 23:22:06 -08:00
Patrick Walton
0d5724b773 rustc: Make return value inference use next_ty_var, now that we have it 2010-12-11 22:40:46 -08:00
Patrick Walton
c3ab601a89 rustc: Move next_var_id from typeck.crate_ctxt to typeck.fn_ctxt 2010-12-11 22:37:23 -08:00
Patrick Walton
368459db43 rustc: Remove "update_env_for_arm" debugging message 2010-12-11 22:30:12 -08:00
Patrick Walton
de118d79b6 rustc: Resolve pattern bindings 2010-12-10 18:08:32 -08:00
Patrick Walton
0509b1b9d7 rustc: Add update_env_for_arm to fold; we'll need it to resolve pattern bindings 2010-12-10 17:49:28 -08:00
Graydon Hoare
f97242c255 Fix bad GEP and missing branch in iter_sequence; vec.rs compiles now. 2010-12-10 17:46:47 -08:00
Graydon Hoare
60affafdcd Implement expr_vec. 2010-12-10 17:25:22 -08:00
Graydon Hoare
779b913348 Fix trans_index implementation. 2010-12-10 17:25:22 -08:00
Patrick Walton
0d43c198f0 rustc: Add def ids to pattern bindings 2010-12-10 17:24:53 -08:00
Patrick Walton
0b84707da7 rustc: Add tag support to ty_of_item in typeck 2010-12-10 16:44:12 -08:00
Patrick Walton
2c472c0de8 rustc: Add LLVM typedefs for rust_crate and rust_task for good measure 2010-12-10 16:29:41 -08:00
Patrick Walton
cf8ad5f56d rustc: Declare LLVM typedefs appropriately 2010-12-10 16:24:47 -08:00
Patrick Walton
e37c032eb0 rustc: Move refcount incrementing out of line too 2010-12-10 16:14:06 -08:00
Graydon Hoare
865c06c1f9 Preliminary translation of expr_index. 2010-12-10 16:10:35 -08:00
Patrick Walton
270b93bd71 rustc: Move refcount decrement-and-free (drop) logic out-of-line 2010-12-10 15:37:17 -08:00
Patrick Walton
10d5d32537 rustc: Change lazy "and" and "or" to use scope contexts rather than sub-block contexts, to run cleanups properly 2010-12-10 15:27:55 -08:00
Graydon Hoare
0565350b5f Typecheck vec and index exprs. 2010-12-10 15:05:19 -08:00
Patrick Walton
eaa76bd83f rustc: Decouple new_fn_ctxt() from AST function arguments, so that it can be used to generate glue 2010-12-09 17:38:57 -08:00
Graydon Hoare
4e1046a508 Fix another bug in expr_index parse rule. 2010-12-09 17:34:44 -08:00
Graydon Hoare
d5ed5e7044 Fix bug in parse rule for expr_index. 2010-12-09 17:12:08 -08:00
Graydon Hoare
e04c24769e Add 'unexpected' fn to parser. 2010-12-09 17:11:52 -08:00
Graydon Hoare
8383b1c435 Fix token span tracking in lexer. 2010-12-09 17:11:05 -08:00
Graydon Hoare
9ee3475e09 Rewrite second pass of collect_item_types to use fold, therefore process all items in crate. Add testcase to check. 2010-12-09 16:06:40 -08:00
Patrick Walton
1c9dc2ca52 rustc: Decouple new_fn_ctxt from AST items so that we can use it to generate glue too 2010-12-09 15:26:16 -08:00
Graydon Hoare
d213f9be95 Simplify second pass of collect_item_types so I can understand it better. 2010-12-09 15:19:38 -08:00
Graydon Hoare
b7e344622c Add a type abbreviation and redo first pass of collect_item_types to collect across the whole crate, not just top level. 2010-12-09 15:03:19 -08:00
Graydon Hoare
876282791e First sketch of support for const items, not including most of trans. 2010-12-09 14:37:50 -08:00
Patrick Walton
5a6cc341ad rustc: Add gross eq_ty() and hash_ty() functions 2010-12-09 14:03:43 -08:00
Patrick Walton
e5bbe93646 rustc: Mark constant strings as constants 2010-12-09 13:49:26 -08:00
Patrick Walton
e652e58bfc rustc: Fix indirection problem with tag constructors 2010-12-09 13:39:33 -08:00
Graydon Hoare
66b5dfabee Remove redundant trans_drop_str, fix buggy branch in trans_if. Un-XFAIL drop-on-ret.rs. 2010-12-09 12:32:16 -08:00
Graydon Hoare
440e637edf Fix boxed returns harder. Un-XFAIL output-slot-variants.rs. 2010-12-08 16:43:59 -08:00
Graydon Hoare
652ae9f50e Fix structure returns harder. 2010-12-08 16:34:16 -08:00
Graydon Hoare
e3a3a03572 Fix boxed returns. 2010-12-08 16:20:04 -08:00
Graydon Hoare
264de9c7fc Fix structure-returns. 2010-12-08 15:52:01 -08:00
Graydon Hoare
2b36a8eab4 Fix log upcall translation bug. Un-XFAIL rec-auto.rs. 2010-12-08 15:29:09 -08:00
Graydon Hoare
6ccfba34f3 Add missing case to parse_ty, un-XFAIL cast.rs. 2010-12-08 15:04:57 -08:00
Graydon Hoare
68af077e81 Implement binop= forms. Un-XFAIL bitwise.rs. 2010-12-08 14:50:47 -08:00
Graydon Hoare
b971d6312e Fix missing case in resolve, un-XFAIL rec-tup.rs. 2010-12-08 11:52:34 -08:00
Patrick Walton
e558ff907f rustc: Allow callees to use alias args 2010-12-07 12:34:10 -08:00
Patrick Walton
7f85945b05 rustc: Translate function calls with alias parameters (though the callee can't use them yet) 2010-12-07 11:57:19 -08:00
Patrick Walton
15a614acb4 rustc: Implement is_lval 2010-12-07 10:38:42 -08:00
Graydon Hoare
a059b4720c Null slots on missing init, null-check box ptrs on drop. Works around missing typestate pass. Un-XFAIL box-in-tup.rs. 2010-12-06 17:46:44 -08:00
Patrick Walton
3f9d5dab5b rustc: Run the verifier over LLVM modules before writing them out 2010-12-06 17:17:49 -08:00
Patrick Walton
a1c7d19836 rustc: Translate tag constructors. Can't call them at the moment due to lack of alias args, though. 2010-12-06 16:50:24 -08:00
Patrick Walton
fb05d9184b rustc: Make copy_args_to_allocas not insist on a function type so it's easier to make it work with tag constructors 2010-12-06 11:22:08 -08:00
Graydon Hoare
9f6a630519 Drop rec and tup alloca temporariles on block exit. 2010-12-03 18:43:40 -08:00
Patrick Walton
b4d9754347 rustc: Make new_fn_ctxt and copy_args_to_allocas receive a list of args rather than an AST fn, so we can use it for tag constructors 2010-12-03 18:20:41 -08:00
Patrick Walton
2e119698b7 rustc: Add def ids to variant arguments so we can turn them into function arguments later 2010-12-03 18:13:15 -08:00
Graydon Hoare
0c19c8e18f Parse layer and effect annotations. 2010-12-03 18:04:18 -08:00
Patrick Walton
afd3af9bb5 rustc: Remove LLVM unions and represent tags as (discriminant, byte blob) pairs 2010-12-03 16:55:59 -08:00
Patrick Walton
f371dc613a rustc: Set data layout and target triple 2010-12-03 13:52:54 -08:00
Graydon Hoare
aeef8cee29 Add load_non_structural and use it. 2010-12-03 13:03:07 -08:00
Patrick Walton
5347cac92d rustc: Handle n-ary tag constructors in iter_structural_ty (which lets us process their refcounts correctly) 2010-12-03 12:35:49 -08:00
Graydon Hoare
4316df6323 Trim whitespace. 2010-12-03 12:26:27 -08:00
Graydon Hoare
a98b2ebb4a Change 'stratum' to the friendlier term 'layer'. 2010-12-03 12:15:32 -08:00
Patrick Walton
7bdb93266d rustc: Translate nullary tag constructors 2010-12-03 10:24:55 -08:00
Graydon Hoare
d922b0ad9c Drop slots on the way out of scopes. Un-XFAIL box.rs. 2010-12-02 19:44:24 -08:00
Graydon Hoare
966cfed07c Modify block ctxt / cleanup handling to only occur on scope blocks. 2010-12-02 19:12:34 -08:00
Graydon Hoare
1e9c8b923d Implement translation for deref unop. 2010-12-02 19:12:09 -08:00
Graydon Hoare
97247bbb53 Change order of basic blocks in copy_ty, makes nicer disassembly. 2010-12-02 18:33:11 -08:00
Graydon Hoare
f69b4417e6 Don't drop context returned from decl-init call to copy_ty. 2010-12-02 18:32:43 -08:00
Graydon Hoare
0f41f5a8f9 Improve translations of unary box operator and drop_ty on boxes. 2010-12-02 17:43:24 -08:00
Patrick Walton
e233978891 rustc: Change fn_names and fn_ids to item_names and item_ids in trans, since we're soon to be storing tags in there too 2010-12-02 17:30:07 -08:00
Patrick Walton
49b3cd700e rustc: Remove the premature optimization for nullary tag constructors, since it'll be no longer necessary once LLVM gets a unit type 2010-12-02 17:18:06 -08:00
Graydon Hoare
a439f6ec68 Add ty_boxed to typeck.type_is_boxed. 2010-12-02 15:56:44 -08:00
Graydon Hoare
cdcab742a7 Fix fold bug on expr_unary. 2010-12-02 15:54:45 -08:00
Graydon Hoare
b79de6b76c Typecheck the box and deref unops properly. 2010-12-02 14:38:32 -08:00
Patrick Walton
376b35e618 rustc: Remove the overly complex variant_indices and n_ary_variant_indices tables 2010-12-02 11:00:10 -08:00
Patrick Walton
eeecc8d061 rustc: Add stub support for tag constructors in trans 2010-12-01 19:03:47 -08:00
Graydon Hoare
98a63bd1f9 Add code to fail on non-exhaustive alt matching. Fix all cases this picked up in rustc. 2010-12-01 17:09:02 -08:00
Patrick Walton
fd600bad46 rustc: Annotate variants with their types. This may be useful for trans! 2010-12-01 15:27:38 -08:00