aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle/fold.rs
Commit message (Collapse)AuthorAgeFilesLines
* More anon obj work; whitespace police in middle::foldLindsey Kuper2011-05-131-31/+39
| | | | | | Passing args to middle::fold::fold_expr_anon_obj by reference to be consistent with the other folds; adding a dummy fold_expr_anon_obj to typeck to be filled in later.
* Use new module namespace syntax.Lindsey Kuper2011-05-131-30/+30
|
* More progress on anonymous objects.Lindsey Kuper2011-05-131-1/+74
| | | | Still segfaulting on the method-overriding.rs test, though.
* Downcase std modules again, move to :: for module dereferencingMarijn Haverbeke2011-05-121-374/+375
| | | | This should be a snapshot transition.
* Keep resolve data in external hash table, rather than embedded defsMarijn Haverbeke2011-05-121-18/+15
| | | | | | | | | | | | | 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.)
* Remove mod indices from the ASTMarijn Haverbeke2011-05-111-8/+2
| | | | | They are now created by the resolve pass, which is the only pass that needs them, and kept internal to that pass.
* Get rid of arm indicesMarijn Haverbeke2011-05-111-1/+1
|
* Get rid of block indicesMarijn Haverbeke2011-05-111-3/+1
|
* Rewrite comp/middle/resolve.rsMarijn Haverbeke2011-05-111-9/+6
| | | | | | | | | * 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)
* Fix long lines in fold.rs, typeck.rsBrian Anderson2011-05-091-1/+2
|
* Alias-ify fold and its users, remove another 85kb.Graydon Hoare2011-05-091-279/+297
|
* Rename std modules to be camelcasedMarijn Haverbeke2011-05-061-49/+49
| | | | (Have fun mergining your stuff with this.)
* Bring back "pred" syntax for writing predicates for checkTim Chevalier2011-05-051-5/+8
| | | | | | | | | | This commit reinstates the requirement that the predicate in a "check" must be a manifest call to a special kind of function declared with the new "pred" keyword instead of "fn". Preds must have a boolean return type and can only call other preds; they can't have any effects (as enforced by the typechecker). The arguments to a predicate in a check expression must be slot variables or literals.
* Check that the operand in a check is a callTim Chevalier2011-05-051-1/+1
| | | | | | In addition, fix bug in fold that was turning asserts into checks. More typechecking still needs to be done.
* Un-revert "Use different syntax for checks that matter to typestate", fixing ↵Patrick Walton2011-05-021-7/+24
| | | | | | the problem. This reverts commit d08b443fffb1181d8d45ae5d061412f202dd4118.
* Revert "Use different syntax for checks that matter to typestate"Graydon Hoare2011-05-021-24/+7
| | | | This reverts commit aa25f22f197682de3b18fc4c8ba068d1feda220f. It broke stage2, not sure why yet.
* Use different syntax for checks that matter to typestateTim Chevalier2011-05-021-7/+24
| | | | | | | | | | This giant commit changes the syntax of Rust to use "assert" for "check" expressions that didn't mean anything to the typestate system, and continue using "check" for checks that are used as part of typestate checking. Most of the changes are just replacing "check" with "assert" in test cases and rustc.
* Fix the signature of expr_extBrian Anderson2011-04-211-2/+2
| | | | The extension body is just a string, not an expression.
* Handle nested items correctly in typestate_checkTim Chevalier2011-04-191-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | Summary says it all. Actually, only nested objects and functions are handled, but that's better than before. The fold that I was using before to traverse a crate wasn't working correctly, because annotations have to reflect the number of local variables of the nearest enclosing function (in turn, because annotations are represented as bit vectors). The fold was traversing the AST in the wrong order, first filling in the annotations correctly, but then re-traversing them with the bit vector length for any outer nested functions, and so on. Remedying this required writing a lot of tedious boilerplate code because I scrapped the idea of using a fold altogether. I also made typestate_check handle unary, field, alt, and fail. Also, some miscellaneous changes: * added annotations to blocks in typeck * fix pprust so it can handle spawn * added more logging functions in util.common * fixed _vec.or * added maybe and from_maybe in option * removed fold_block field from ast_fold, since it was never used
* Remove effect system from src.Graydon Hoare2011-04-191-17/+15
|
* add log_err to rustcMarijn Haverbeke2011-04-191-6/+6
|
* Work on destructors, not entirely functional yet (no tydesc integration).Graydon Hoare2011-04-141-6/+6
|
* typestate_check can now handle expr_block, expr_if, and expr_binaryTim Chevalier2011-04-121-1/+2
| | | | | | | | | | | | | | | | (caveat for the latter: it assumes that binary operations are strict; a TODO is to detect or and and and correctly reflect that they're lazy in the second argument). I had to add an ann field to ast.block, resulting in the usual boilerplate changes. Test cases that currently work (if you uncomment the typestate pass in the driver) (all these are under test/compile-fail): fru-typestate ret-uninit use-uninit use-uninit-2 use-uninit-3
* Further work on typestate. Handles expr_rec and expr_assign now.Tim Chevalier2011-04-121-10/+12
| | | | | | | | | | | | Also changed the ts_ann field on statements to be an ann instead, which explains most of the changes. As well, got rid of the "warning: no type for expression" error by filling in annotations for local decls in typeck (not sure whether this was my fault or not). Finally, in bitv, added a clone() function to copy a bit vector, and fixed is_true, is_false, and to_str to not be nonsense.
* rustc: Add the ability to fold over annotationsPatrick Walton2011-04-081-36/+83
|
* Support for self-calls that take arguments.Lindsey Kuper2011-04-071-10/+8
| | | | | | | Nicer parsing of self-calls (expr_self_method nodes inside expr_call nodes, rather than a separate expr_call_self) makes typechecking tractable. We can now write self-calls that take arguments and return values (see: test/run-pass/obj-self-*.rs).
* Continued sketching out code for checking states against preconditions.Tim Chevalier2011-04-061-12/+17
| | | | | | | | | It's still sketchy. I added a typestate annotation field to statements tagged stmt_decl or stmt_expr, because a stmt_decl statement has a typestate that's different from that of its child node. This necessitated trivial changes to a bunch of other files all over to the compiler. I also added a few small standard library functions, some of which I didn't actually end up using but which I thought might be useful anyway.
* Further on the path toward self-awareness.Lindsey Kuper2011-04-051-6/+5
| | | | | | | | | | | | | Mostly: * Merciless refactoring of trans.rs so that trans_call can work for self-calls as well as other kinds of calls Also: * Various changes to go with having idents, rather than exprs, in expr_call_self AST nodes * Added missing case for SELF token to token.to_str()
* Started adding support for typestate checking.Tim Chevalier2011-04-011-48/+50
| | | | | | | | | | | | | | | I added a new field to the ast "ann" type for typestate information. Currently, the field contains a record of a precondition bit vector and postcondition vector, but I tried to structure things so as to make it easy to change the representation of the typestate annotation type. I also had to add annotations to some syntactic forms that didn't have them before (fail, ret, be...), with all the boilerplate changes that that would imply. The main call to the typestate_check entry point is commented out and the actual pre-postcondition algorithm only has a few cases implemented, though the overall AST traversal is there. The rest of the typestate algorithm isn't implemented yet.
* rustc: Add a type annotation to tag itemsPatrick Walton2011-03-311-6/+6
|
* More machinery for adding an expr_call_self AST node.Lindsey Kuper2011-03-311-1/+18
|
* Improve line comment positioningMarijn Haverbeke2011-03-311-3/+4
| | | | This involved making ast.variant spanned.
* Add effect field to ast.ty_fn.Marijn Haverbeke2011-03-311-11/+12
| | | | Still not used, except by the pretty-printer.
* rustc: Thread an item-to-type mapping throughout the typechecking and ↵Patrick Walton2011-03-301-5/+5
| | | | translation phases
* Add expr_spawn, spawn parsing, folding, typechecking, ty_taskBrian Anderson2011-03-281-0/+18
|
* Add support for break and cont to rustcMarijn Haverbeke2011-03-271-0/+22
| | | | | Testing proper cleanup is hampered by https://github.com/graydon/rust/issues/293
* Another go at changing compile-command, this time using RBUILD env var.Graydon Hoare2011-03-251-1/+1
|
* Revert "Bulk-edit compile commands in emacs chatter to point to assumed ↵Graydon Hoare2011-03-251-1/+1
| | | | | | build/ dir off src root." This reverts commit 846f2e2ba994268725f38c36fa12f1a09f21615c.
* Bulk-edit compile commands in emacs chatter to point to assumed build/ dir ↵Graydon Hoare2011-03-251-1/+1
| | | | off src root.
* rustc: Store cached crate metadata in the sessionPatrick Walton2011-03-251-5/+6
|
* Implement local declarations with receive. Un-XFAIL decl-with-recv.rs.Brian Anderson2011-03-251-5/+4
|
* Refactor ast.local to make room for initialization via recvBrian Anderson2011-03-251-4/+6
|
* Support for 'float' in type signatures.Lindsey Kuper2011-03-231-1/+8
|
* Modify native_item_fn to handle trailing linkage names that differ from the ↵Graydon Hoare2011-03-201-4/+7
| | | | item name (used in win32 build of std.dll)
* rustc: Switch mutability from being a type constructor to a field annotationPatrick Walton2011-03-171-35/+28
|
* Switch all vases of vec += elt to vec += vec. Prohibit former in rustboot. ↵Graydon Hoare2011-03-161-19/+18
| | | | Tweak std lib vec fns in process.
* rustc: Add an annotation for the crate definition to view_item_usePatrick Walton2011-03-151-6/+6
|
* Merge remote branch 'brson/recursive-elseif'Graydon Hoare2011-03-141-21/+9
|\
| * Merge branch 'master' into recursive-elseifBrian Anderson2011-03-131-8/+32
| |\ | | | | | | | | | | | | | | | Conflicts: src/comp/middle/typeck.rs
| * \ Merge branch 'master' into recursive-elseifBrian Anderson2011-03-071-89/+318
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/Makefile src/comp/front/ast.rs src/comp/front/parser.rs src/comp/middle/fold.rs src/comp/middle/trans.rs