Commit Graph

931 Commits

Author SHA1 Message Date
Lindsey Kuper
d3242b9644 Bug fixes.
Fixed infinite loop on anonymous objects in parser; added
expr_anon_obj to walk.rs; fixed syntax of test case.
2011-05-13 17:35:13 -07:00
Lindsey Kuper
6c1c5b3948 More progress on anonymous objects.
Still segfaulting on the method-overriding.rs test, though.
2011-05-13 17:35:13 -07:00
Patrick Walton
fac1342513 rustc: Move replace_expr_type() from ty to typeck, as it's only used in the latter 2011-05-13 17:06:30 -07:00
Brian Anderson
843e9435ab rustc: Fix long lines in typeck.rs 2011-05-13 20:06:02 -04:00
Patrick Walton
23d3b0ec57 rustc: Get ann_to_type_params() on board the ann_to_ty_param_substs_opt_and_ty() train 2011-05-13 16:53:35 -07:00
Patrick Walton
0739849e9f rustc: Make all type lookups go through the one ty::ann_to_ty_param_substs_opt_and_ty() function 2011-05-13 16:40:21 -07:00
Patrick Walton
4f2eb31870 rustc: Write types contained in "trivial annotations" to the table 2011-05-13 16:27:55 -07:00
Patrick Walton
e888fe6f9b rustc: Change ty::triv_ann() to take a node ID instead of a full annotation 2011-05-13 14:39:00 -07:00
Brian Anderson
2f440b1452 rustc: lowercase the link and link::write modules 2011-05-13 16:55:37 -04:00
Graydon Hoare
0d32ff723a Slight adjustments to shape, rename to type_glue.rs. 2011-05-13 13:29:50 -07:00
Patrick Walton
c97b05141a rustc: Add write_type() wherever ann_types are written, except for triv_ann() 2011-05-13 13:06:34 -07:00
Patrick Walton
be9aa1cc5e rustc: Fix the type of node_types; stub the write_type function 2011-05-13 12:12:54 -07:00
Patrick Walton
6e34679a65 rustc: Remove a minor rustboot workaround in typeck::resolve_local_types_in_block() 2011-05-13 11:23:00 -07:00
Patrick Walton
8a8f68aa75 rustc: Make typeck::instantiate_path() not return an annotation 2011-05-13 10:53:55 -07:00
Marijn Haverbeke
ae26b775b4 Implement module namespaces
Module names no longer clash with type and value names. The
tokenizer/parser still needs to be taught to be more careful in
identifying keywords, so that we can use 'str' and 'vec' and so as
module names.
2011-05-13 17:20:46 +02:00
Marijn Haverbeke
eb419fd8c7 Extend crate format to allow multiple definitions for a single name
The type/value namespace distinction pretty much works now. Module
namespace is up next.
2011-05-13 17:20:39 +02:00
Marijn Haverbeke
1a12a7b04b Make module indices hold a list of items
This way, they can support having both a type and a value
of the same name.
2011-05-13 13:34:59 +02:00
Marijn Haverbeke
58ec5d1654 Move capture checking into resolve.rs
Drops capture.rs. The new algorithm also checks for captures function
arguments and obj fields.
2011-05-13 12:44:05 +02:00
Marijn Haverbeke
89490e416b Change resolve to use walk instead of fold
Possibly, at some point, we should add a state-passing variant of
walk, or a wrapper that makes it easier to thread state. (See the
repetetive pop_state_for_* functions in this commit.)
2011-05-13 11:35:25 +02:00
Marijn Haverbeke
7082bf4478 Ensure visit_ty is called on type parameters during walk 2011-05-13 11:35:25 +02:00
Marijn Haverbeke
39a000714a Add visit_arm and visit_method to walk.rs
The resolver needs to update its state for individual arms and
methods.
2011-05-13 11:34:51 +02:00
Patrick Walton
5295a4dabd rustc: Flatten recursive vectors in trans::simplify_type(). Prevents an infinite loop. 2011-05-12 18:37:28 -07:00
Patrick Walton
b163247d4e rustc: Beginnings of a "shape" module to convert types to shapes 2011-05-12 18:30:21 -07:00
Patrick Walton
033b38b636 rustc: Make ty::expr_ann() terser 2011-05-12 16:57:08 -07:00
Patrick Walton
0b7dd0d918 rustc: Pass a node type table around, unused as of yet 2011-05-12 16:41:55 -07:00
Graydon Hoare
5ceaf345ed Add stats option and lazily emit glue. 2011-05-12 15:42:51 -07:00
Marijn Haverbeke
3816e57fd2 Downcase std modules again, move to :: for module dereferencing
This should be a snapshot transition.
2011-05-12 21:30:44 +02:00
Marijn Haverbeke
6510f1ce7c Change module dereference syntax from . to ::
This will need to be a snapshot.
2011-05-12 21:30:35 +02:00
Marijn Haverbeke
358a1aeec9 Keep resolve data in external hash table, rather than embedded defs
One step closer to removing fold and having a single, immutable AST.
Resolve still uses fold, because it has to detect and transform
expr_field expressions. If we go through on our plan of moving to a
different syntax for module dereferencing, the parser can spit out
expr_field expressions, and resolve can move to walk.

(I am truly sorry for the things I did in typestate_check.rs. I expect
we'll want to change that to walk as well in the near future, at which
point it should probably pass around a context record, which could
hold the def_map.)
2011-05-12 15:40:21 +02:00
Marijn Haverbeke
2b36e40c58 Ensure ann tags are actually kept around during typechecking
This way, the tag assigned by the parser stays with the node.
I realize ann replacing is probably going away real soon, but
I needed this now for moving the resolve defs out of the AST.
2011-05-12 10:51:13 +02:00
Marijn Haverbeke
d719b5cae7 Provide a more useful message when failing to translate a const 2011-05-12 09:17:59 +02:00
Patrick Walton
531515d7ae rustc: Represent types as uints. Cuts typechecking down from 14s to 12s. 2011-05-11 17:05:39 -07:00
Patrick Walton
da09a0320e rustc: Remove a few kludges intended to work around rustboot's lack of structural comparison from equal_type_structures() 2011-05-11 16:18:02 -07:00
Patrick Walton
6953841e25 rustc: Remove magic numbers; they aren't a win 2011-05-11 16:10:17 -07:00
Patrick Walton
df914e8904 rustc: Intern all types. 4s regression. 2011-05-11 15:56:23 -07:00
Patrick Walton
26ab36afb1 rustc: Hoist derived type descriptors to the top of the function 2011-05-11 12:05:02 -07:00
Marijn Haverbeke
14f1fe0e29 Remove mod indices from the AST
They are now created by the resolve pass, which is the only pass that
needs them, and kept internal to that pass.
2011-05-11 17:11:44 +02:00
Marijn Haverbeke
fe29d24b6e Get rid of arm indices 2011-05-11 15:26:36 +02:00
Marijn Haverbeke
5405f45274 Get rid of block indices 2011-05-11 15:10:24 +02:00
Marijn Haverbeke
7d086df095 Stop depending on block indices in capture.rs 2011-05-11 13:49:48 +02:00
Marijn Haverbeke
9cb20153a8 Hash only on def_num when storing def_ids that are local 2011-05-11 13:06:43 +02:00
Marijn Haverbeke
7f222423b7 Use a const for crate-num-zero (ast.local_crate) 2011-05-11 12:59:34 +02:00
Marijn Haverbeke
6b46113afc Cache external crate lookups in resolve.rs
According to --time-passes, resolution went from 2 to 0 seconds. Not
really the bottleneck... but if we want to be crazy fast, just
consider this a future bottleneck that was fixed very timely.
2011-05-11 12:32:37 +02:00
Marijn Haverbeke
e9c12ab1d0 Rewrite comp/middle/resolve.rs
* Cleans up the algorithm
 * Move first pass to walk (second still folds)
 * Support part of a type/value namespace split
   (crate metadata and module indices still need to be taught about this)
 * Remove a few blatant inefficiencies (import tables being recreated for
   every lookup, most importantly)
2011-05-11 12:32:37 +02:00
Graydon Hoare
dc0aab47a7 More alias-ification of trans. 2011-05-11 05:11:59 +00:00
Patrick Walton
f627c2ff21 rustc: Don't interleave allocas with stores when copying arguments to allocas 2011-05-10 18:29:14 -07:00
Graydon Hoare
390ce40165 Begin alias-ifying trans. 2011-05-10 18:07:40 -07:00
Graydon Hoare
cf3e737eee Avoid mangle_name_by_type_only call in tydesc names unless debugging. 2011-05-10 18:07:40 -07:00
Patrick Walton
1448fc1a24 rustc: Lower the size limit on ty_to_short_str() and always call it in favor of direct calls to metadata.Encode.ty_str() in trans 2011-05-10 17:50:39 -07:00
Patrick Walton
10c9266525 rustc: Number everything with an annotation 2011-05-10 17:27:59 -07:00