summary refs log tree commit diff
path: root/src/comp/syntax/ast.rs
AgeCommit message (Collapse)AuthorLines
2012-01-19rustc: ";" to "," in enumsPatrick Walton-171/+171
2012-01-19rustc: Fix long linesPatrick Walton-2/+2
2012-01-19rustc: "tag" -> "enum"Patrick Walton-36/+36
2012-01-18Remove '.' after nullary tags in patternsTim Chevalier-2/+2
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-2/+12
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-1/+1
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-13distinguish "any closure" and "stack closure" (block)Niko Matsakis-0/+7
2012-01-13make blocks fn& and fn stand for "any closure"Niko Matsakis-2/+3
2012-01-13Obj system? What obj system?Marijn Haverbeke-22/+2
Removes the obj system from the compiler. Closes #1484
2012-01-10Support explicit discriminant numbers on tag variants.Kevin Atkinson-1/+2
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-10rename sendfn to fn~, lambda to fn@Niko Matsakis-4/+4
2012-01-09Remove proto_sugar and 'lambda' as keyword, commit to fn@.Graydon Hoare-6/+1
2012-01-05require a non-semi expr acting as a stmt to have unit return typeNiko Matsakis-0/+5
2011-12-29split proto from fn_decl, as not all fn_decls know the proto.Niko Matsakis-4/+3
this will address the (crashing) new test added.
2011-12-28Move the kind datatype to middle::tyMarijn Haverbeke-30/+0
The AST no longer references it.
2011-12-28Change representation of type params to handle interface boundsMarijn Haverbeke-2/+8
Issue #1227
2011-12-23Check impls methods against the type of their iface.Marijn Haverbeke-1/+1
2011-12-23Parse `iface` items and interface references in `impl` items.Marijn Haverbeke-1/+3
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-23Make ast::ty_method hold a fn_decl, rather than duplicating its fieldsMarijn Haverbeke-9/+1
2011-12-22Unify some data structures in syntax::ast that were doing the same thingMarijn Haverbeke-21/+10
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/+1
that parses that expr, prepare for snapshot.
2011-12-21Make { || ... } sugar for any type of closure, inferredNiko Matsakis-5/+2
2011-12-19implement capture clauses (move, in particular) and integrateNiko Matsakis-0/+4
them into type state and so forth
2011-12-19resolve capture clausesNiko Matsakis-7/+9
2011-12-19Add type argument field to expr_pathMarijn Haverbeke-1/+1
This way, you can explicitly provide type parameters when calling a generic method. Issue #1227
2011-12-16Reserve node_id 0 for the crate top-level moduleMarijn Haverbeke-0/+1
And define a const to refer to it.
2011-12-16Make polymorphic impl methods workMarijn Haverbeke-1/+1
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-1/+1
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-2/+1
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-3/+3
Issue #1227
2011-12-15massive refactor of how closures workNiko Matsakis-0/+9
2011-12-14change syntax from lambda[send] to sendfnNiko Matsakis-1/+0
2011-12-14push changes through to get things compiling, if not running.Niko Matsakis-0/+19
2011-12-14first attempt, not happy with itNiko Matsakis-2/+2
2011-12-14define ty and update parser for sendable lambdasNiko Matsakis-1/+11
2011-12-13Copy first batch of material from libstd to libcore.Graydon Hoare-1/+1
2011-12-08Allow binding of nested patternsMarijn Haverbeke-1/+1
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-07Inject the view_items for core in the right place, add comment documenting ↵Graydon Hoare-0/+7
why the wrong place was wrong.
2011-12-07Remove stmt_crate_directive, it's vestigial and confusing.Graydon Hoare-3/+0
2011-12-07Change literal representation to not truncateMarijn Haverbeke-28/+12
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-02Allow literal patterns to contain arbitrary literal expressionsMarijn Haverbeke-2/+2
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-11/+11
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-2/+2
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-3/+2
Closes #49
2011-11-23Rollback return-by-referenceMarijn Haverbeke-1/+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-23Remove last traces of auth keywordMarijn Haverbeke-3/+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-3/+1
2011-11-18Update stdlib, compiler, and tests to new kind systemMarijn Haverbeke-3/+1
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-18Add a pass-by-copy parameter passing conventionMarijn Haverbeke-1/+1
This is intended to solve the problem of how to pass arguments to constructor functions -- you want to move in rvalues, but not have to explicitly copy stuff that is not an rvalue. The by-copy passing convention will ensure the callee gets its own copy of the value. For rvalues, it'll just pass off the value. For lvalues, it'll make a copy. Issue #1177
2011-11-18Preparation for kind system overhaulMarijn Haverbeke-2/+3
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