summary refs log tree commit diff
path: root/src/comp/syntax/fold.rs
AgeCommit message (Collapse)AuthorLines
2012-01-19Remove support for the '.' after a nullary tag in a patternTim Chevalier-1/+1
(Commit also includes lots of changes to remove '.'s that a git merge messed up, or else it was monkeys.)
2012-01-18Remove '.' after nullary tags in patternsTim Chevalier-5/+5
Does what it says on the tin. The next commit will remove support for this syntax.
2012-01-17Allow omission of the '.' after nullary tag patternsTim Chevalier-6/+6
This commit allows patterns like: alt x { some(_) { ... } none { } } without the '.' after none. The parser suspends judgment about whether a bare ident is a tag or a new bound variable; instead, the resolver disambiguates. This means that any code after resolution that pattern-matches on patterns needs to call pat_util::normalize_pat, which consults an environment to do this disambiguation. In addition, local variables are no longer allowed to shadow tag names, so this required changing some code (e.g. renaming variables named "mut", and renaming ast::sub to subtract). The parser currently accepts patterns with and without the '.'. Once the compiler and libraries are changed, it will no longer accept the '.'.
2012-01-16Don't evaluate discriminator value constants when parsing.Kevin Atkinson-13/+4
Remove disr_val from ast::variant_ and always use ty::variant_info when the value is needed. Move what was done during parsing into other passes, primary typeck.rs. This move also correctly type checks the disr. value expression; thus, fixing rustc --pretty=typed when disr. values are used.
2012-01-13Obj system? What obj system?Marijn Haverbeke-38/+0
Removes the obj system from the compiler. Closes #1484
2012-01-12Cleanups to previous commits for issue #1393.Kevin Atkinson-1/+1
2012-01-10Fold and re-evaluate expr in tag discriminant.Graydon Hoare-3/+16
2012-01-10Support explicit discriminant numbers on tag variants.Kevin Atkinson-1/+3
Addresses issue #1393. For now disallow disr. values unless all variants use nullary contractors (i.e. "enum-like"). Disr. values are now encoded in the crate metadata, but only when it will differ from the inferred value based on the order.
2012-01-05require a non-semi expr acting as a stmt to have unit return typeNiko Matsakis-2/+3
2011-12-29split proto from fn_decl, as not all fn_decls know the proto.Niko Matsakis-6/+5
this will address the (crashing) new test added.
2011-12-23Parse `iface` items and interface references in `impl` items.Marijn Haverbeke-6/+9
The (temporary) syntax is iface seq<T> { fn len() -> uint; fn iter(f: block(T)); } // The 'blah<T>' can be left of to default the name of the // impl to seq<T>. The 'of seq<T>' can be left off when // not implementing a named interface. impl blah<T> of seq<T> for [T] { fn len() -> uint { vec::len(self) } fn iter(f: block(T)) { for x in self { f(x); } } }
2011-12-22Work around unwinding bugMarijn Haverbeke-1/+2
See issue #1374
2011-12-22Unify some data structures in syntax::ast that were doing the same thingMarijn Haverbeke-30/+20
As a preparation to removing some duplication in typeck.
2011-12-21Switch log_expr to carrying a full expr:u32 for level. Add log_full variant ↵Graydon Hoare-1/+2
that parses that expr, prepare for snapshot.
2011-12-21Make { || ... } sugar for any type of closure, inferredNiko Matsakis-10/+12
2011-12-19Add type argument field to expr_pathMarijn Haverbeke-2/+3
This way, you can explicitly provide type parameters when calling a generic method. Issue #1227
2011-12-16reorder args to the various vec, option fns so blk comes lastNiko Matsakis-47/+47
2011-12-16Make polymorphic impl methods workMarijn Haverbeke-1/+2
Something will still have to be done to the AST to make it possible to say `x.foo::<int>()`, since currently field access never allows type parameters. Issue #1227
2011-12-16Change syntax for implMarijn Haverbeke-2/+2
Move the name of the bundle to the front, allow type parameters (not handled yet), and add a 'for' keyword: impl utils for int { fn str() -> str { int::str(self) } fn times(f: block()) { ... } }
2011-12-16Make uses of self in impls compileMarijn Haverbeke-1/+0
Get rid of expr_self_call, introduces def_self. `self` is now, syntactically, simply a variable. A method implicitly brings a `self` binding into scope. Issue #1227
2011-12-16Parse and resolve implementations.Marijn Haverbeke-0/+4
Issue #1227
2011-12-14first attempt, not happy with itNiko Matsakis-1/+2
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-1/+1
2011-12-08Allow binding of nested patternsMarijn Haverbeke-1/+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-07Remove stmt_crate_directive, it's vestigial and confusing.Graydon Hoare-4/+1
2011-11-30Box ast::path valuesMarijn Haverbeke-4/+4
It seems inefficient to copy them around. Let's measure whether that's actually > the case
2011-11-24rustc: Add a path attribute for crate directivesHaitao Li-4/+4
The path information was an optional "filename" component of crate directive AST. It is now replaced by an attribute with metadata named "path". With this commit, a directive mod foo = "foo.rs"; should be written as: #[path = "foo.rs"] mod foo; Closes issue #906.
2011-11-23Allow import directives in any blockMarijn Haverbeke-1/+2
Closes #49
2011-11-23Remove last traces of auth keywordMarijn Haverbeke-1/+0
The reference now has an empty hole where the auth keyword used to be. Changing the keyword table seems to require manually sorting the keywords and putting them back into some kind of arcane interleaved order. I'll open an issue to actually fix this. Closes #1211
2011-11-21rustc: Remove abi from ast::native_modHaitao Li-2/+1
2011-11-17remove compile-command from local variable blocksNiko Matsakis-1/+0
2011-11-16Use attributes for native module ABI and link nameHaitao Li-2/+1
This patch changes how to specify ABI and link name of a native module. Before: native "cdecl" mod llvm = "rustllvm" {...} After: #[abi = "cdecl"] #[link_name = "rustllvm"] native mod llvm {...} The old optional syntax for ABI and link name is no longer supported. Fixes issue #547
2011-11-16rustc: Use link_name attribute for native functionHaitao Li-3/+2
Fixes issue #906
2011-10-21Remove hack to break the AST fold cycle. Closes #998Brian Anderson-38/+2
2011-10-21Change the way block calls are parsed, mark them as block-calls.Marijn Haverbeke-2/+3
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-21Drop support for iter, put, and for-eachMarijn Haverbeke-5/+0
Closes #1056
2011-10-20Make fn denote a bare function. Convert fn to fn@ as neededBrian Anderson-77/+80
2011-10-10Adjust function signatures to allow for vecs being immediateMarijn Haverbeke-5/+5
Some code was relying on vectors being implicitly by-reference (as non-immediate value). This adds the necessary &&-sigils. Closes #1021
2011-10-07Give up on providing a by-value version of map, convert fold over toMarijn Haverbeke-78/+76
passing pointers by ref Issue #1008
2011-10-07Parse and typecheck by-value and by-ref arg specsMarijn Haverbeke-31/+31
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-0/+1
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-1/+0
This reverts commit ce0f054f9d56df4e60291fc2e1b89ce979cf374f.
2011-09-21Implement pattern ranges for all numeric types.Josh Matthews-0/+1
2011-09-20Represent unique creation as a unop in the AST instead of its own exprBrian Anderson-1/+0
Like the box unop. Issue #409
2011-09-19Break fold's circular reference during unwindingBrian Anderson-2/+7
This converts the AST fold into a resource that breaks it's own circular reference (just a temporary workaround until GC), so that failure during fold will unwind correctly. Issue #936
2011-09-15Add representation for by-ref let bindingsMarijn Haverbeke-1/+4
Issue #918
2011-09-12Factor imports mindlessly.Graydon Hoare-2/+1
2011-09-12Reformat for new mode syntax, step 1Marijn Haverbeke-131/+129
Long lines were fixed in a very crude way, as I'll be following up with another reformat in a bit.
2011-09-10Fuzzer: move tys around in addition to exprsJesse Ruderman-0/+1