about summary refs log tree commit diff
path: root/src/comp/syntax/ast_util.rs
AgeCommit message (Collapse)AuthorLines
2011-12-16Parse and resolve implementations.Marijn Haverbeke-0/+1
Issue #1227
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-3/+4
2011-12-08Allow binding of nested patternsMarijn Haverbeke-2/+3
See src/test/run-pass/nested-patterns.rs for some examples. The syntax is boundvar@subpattern Which will match the subpattern as usual, but also bind boundvar to the whole matched value. Closes #838
2011-12-07Check for literals that are out of range for their typeMarijn Haverbeke-0/+18
2011-12-07Change literal representation to not truncateMarijn Haverbeke-19/+37
Also shuffles around the organization of numeric literals and types, separating by int/uint/float instead of machine-vs-non-machine types. This simplifies some code. Closes #974 Closes #1252
2011-12-07repair more hash functionsNiko Matsakis-1/+1
2011-12-06fix hash function: + binds tighter than <<Niko Matsakis-1/+4
2011-12-02parse: typeck: enabling trivial casts of tail-call return valuesStefan Plantikow-0/+8
introduces ctypes::m_* machine type aliases for int, uint, float depending on cfg(target_arch) that are used in tests
2011-12-02ty: trans: added support for dropping trivial castsStefan Plantikow-1/+8
2011-12-02Allow literal patterns to contain arbitrary literal expressionsMarijn Haverbeke-32/+69
This removes the need for the unary minus hacks, and allows some other neat things like matching on 1 >> 4. Issue #954
2011-11-30Box ast::path valuesMarijn Haverbeke-1/+1
It seems inefficient to copy them around. Let's measure whether that's actually > the case
2011-11-23Allow import directives in any blockMarijn Haverbeke-1/+1
Closes #49
2011-11-23Rollback return-by-referenceMarijn Haverbeke-7/+0
It's proving too inflexible, so I'm ripping out the extra complexity in the hope that regions will, at some point, provide something similar. Closes #918
2011-11-22Only warn about unreachable range patterns when appropriateMarijn Haverbeke-1/+41
Also simplifies the literal-munging, and moves it into ast_util Closes #1170
2011-11-18Update stdlib, compiler, and tests to new kind systemMarijn Haverbeke-5/+5
This involved adding 'copy' to more generics than I hoped, but an experiment with making it implicit showed that that way lies madness -- unless enforced, you will not remember to mark functions that don't copy as not requiring copyable kind. Issue #1177
2011-11-18Preparation for kind system overhaulMarijn Haverbeke-1/+1
This goes before a snapshot, so that subsequenct patches can make the transition without breaking the build. Disables kind checking pass, makes parser accept both new and old-style kind annotation. Issue #1177
2011-11-17remove compile-command from local variable blocksNiko Matsakis-1/+0
2011-10-28Make shared kind the default only for generic functionsMarijn Haverbeke-1/+5
You almost never want a function with pinned type params. For types, objects, resources, and tags, pinned types are actually often more sane. For most of these, shared rarely makes sense. Only tricky case is objs -- you'll have to think about the kinds you want there. Issue #1076
2011-10-25Update our code to new type parameter kind syntaxMarijn Haverbeke-2/+2
Closes #1067
2011-10-21Change the way block calls are parsed, mark them as block-calls.Marijn Haverbeke-1/+1
This makes it possible to omit the semicolon after the block, and will cause the pretty-printer to properly print such calls (if pretty-printing of blocks wasn't so broken). Block calls (with the block outside of the parentheses) can now only occur at statement level, and their value can not be used. When calling a block-style function that returns a useful value, the block must be put insde the parentheses. Issue #1054
2011-10-21Move ast_util::pat_bindings over to new iter system.Marijn Haverbeke-16/+10
Issue #1056
2011-10-20Fix the problem with check-fast randomly failingBrian Anderson-0/+12
Trans has been assuming that tag node id's are unique across crates and they are not so, depending on which way the wind is blowing, it would choose to use a crate-local tag variant instead of the correct one from std. No test case since I can't come up with a reliable one that compiles in a reasonable amount of time.
2011-10-12make native functions markable as unsafe and incorporate thatNiko Matsakis-1/+1
into the type check
2011-10-12make treatment of unchecked/unsafe blocks more uniformNiko Matsakis-3/+3
also repair various errors in the parser related to such blocks. rename checked_blk to default_blk to reflect the fact that it inherits its purity from the surrounding context.
2011-10-12Extend the unchecked block stuff to allow unsafe blocks as well.Niko Matsakis-3/+3
2011-10-07Parse and typecheck by-value and by-ref arg specsMarijn Haverbeke-2/+2
Add sprinkle && throughout the compiler to make it typecheck again. Issue #1008
2011-09-28Revert "Revert "Implement pattern ranges for all numeric types.""Brian Anderson-1/+2
This reverts commit a034f87146e60e1db2327c6f6807c47406a1bb0b. Conflicts: src/comp/middle/check_alt.rs src/comp/middle/trans_alt.rs src/comp/syntax/ast.rs src/comp/syntax/ast_util.rs src/comp/syntax/fold.rs src/comp/syntax/print/pprust.rs Conflicts: src/comp/middle/trans_alt.rs
2011-09-23Begin to support pattern matching on unique boxesBrian Anderson-0/+1
Issue #409
2011-09-21Revert "Implement pattern ranges for all numeric types."Marijn Haverbeke-2/+1
This reverts commit ce0f054f9d56df4e60291fc2e1b89ce979cf374f.
2011-09-21Implement pattern ranges for all numeric types.Josh Matthews-1/+2
2011-09-20Represent unique creation as a unop in the AST instead of its own exprBrian Anderson-0/+1
Like the box unop. Issue #409
2011-09-15Require the parameter that will be referenced to be notedMarijn Haverbeke-1/+1
Issue #918
2011-09-15Forbid assignment to by-reference bindingsMarijn Haverbeke-1/+1
Issue #918
2011-09-14Add syntax and representation for return-by-mutably-rooted-refMarijn Haverbeke-0/+7
This will be used in the near future to decide what can safely be done with the returned reference. Issue #918
2011-09-12Factor imports mindlessly.Graydon Hoare-2/+1
2011-09-12Reformat for new mode syntax, step 1Marijn Haverbeke-12/+12
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
2011-09-02Reformat. Issue #855Brian Anderson-43/+41
2011-09-01Rename std::istr to std::str. Issue #855Brian Anderson-3/+3
2011-09-01Remove std::str. Issue #855Brian Anderson-1/+0
2011-09-01Make resolve recognize upvarsMarijn Haverbeke-1/+10
Upvars are now marked with def_upvar throughout, not just when going through freevars::lookup_def. This makes things less error-prone. One thing to watch out for is that def_upvar is used in `for each` bodies too, when they refer to a local outside the body.
2011-09-01Move mutability checking into its own pass.Marijn Haverbeke-5/+5
Having it in the alias pass was slightly more efficient (finding expression roots has to be done in both passes), but further muddled up the already complex alias checker. Also factors out some duplication in the mutability-checking code.
2011-09-01Store arg mode and objfield mutability in their defMarijn Haverbeke-2/+2
2011-08-27Convert rustc::syntax::ast_util to istrs. Issue #855Brian Anderson-39/+39
2011-08-27Convert ast::ident to istr. Issue #855Brian Anderson-3/+5
2011-08-27Convert std::map::new_str_hash to istrs. Issue #855Brian Anderson-2/+3
2011-08-26Revert "Revert "Use typestate constraints for trans_be""Tim Chevalier-2/+2
This reverts commit b0db13956f4f106c4bf5a9210c7df439b34506a4. (Should work now that we have a new snapshot)
2011-08-25Support unchecked blocksTim Chevalier-1/+5
This patch supports the syntax unchecked { ... } to disable purity checking within a block. Presumably it will only be used within a declared "pure fn". However, there is no checking that it doesn't occur elsewhere, and it would be harmless for it to do so. I went with Lindsey's suggestion for the syntax, but it's subject to change. This allows you to write code that uses predicates that call arbitrary Rust functions, but you must declare your intentions by wrapping it in an unchecked { ... } block. The test case run-pass/unchecked-predicates.rs demonstrates how to do that.
2011-08-25Change "pred" to "pure fn" within the compiler.Tim Chevalier-1/+1
2011-08-25Move ast::pat_id_map to ast::utilBrian Anderson-0/+2
2011-08-23Add kind-checking for assign-op, copy, ret, be, fail exprs. Fix caught ↵Graydon Hoare-1/+1
kinding-violations in rustc and libstd.