Brian Anderson
9e01e05f3b
Convert rustc::middle::trans to istrs. Issue #855
2011-08-27 15:54:45 -07:00
Brian Anderson
9c9c5c9054
Remove ast::identistr. Issue #855
2011-08-27 15:54:44 -07:00
Brian Anderson
03119fe269
Convert ast::ident to istr. Issue #855
2011-08-27 15:54:44 -07:00
Brian Anderson
652332f9d4
Convert std::map::new_str_hash to istrs. Issue #855
2011-08-27 15:54:44 -07:00
Brian Anderson
608f7ccded
Move ast::pat_id_map to ast::util
2011-08-25 14:15:54 -07:00
Marijn Haverbeke
b9112525ba
Move to a more lightweight builder system
...
You now do
bld::Ret(bcx, someval)
where you used to say
bcx.build.Ret(someval)
Two fewer boxes are allocated for each block context, and build calls
no longer go through a vtable.
2011-08-24 16:48:10 +02:00
Marijn Haverbeke
9f44df65ef
Ensure values created in an alt guard are cleaned up properly
2011-08-24 14:01:56 +02:00
Brian Anderson
152cbaade7
Move functions from syntax::ast to syntax::ast_util
...
This leaves syntax::ast just defining the AST, which strikes me as somewhat
nicer
2011-08-22 10:44:04 -07:00
Marijn Haverbeke
7d08678b74
Implement pattern guards
...
The syntax is
alt x {
mypat where mycond { ... }
}
The condition may refer to any of the variables bound by the pattern.
When a guard fails, pattern-matching continues with the next pattern.
Closes #857
2011-08-22 17:49:31 +02:00
Marijn Haverbeke
a2466233b4
Fix bug introduced by 1a45a84e73
2011-08-22 17:49:31 +02:00
Marijn Haverbeke
1a45a84e73
Start using copy glue to copy bits that may contain ivecs
...
This is not currently necessary, but will be, when I land the new ivec
representation.
2011-08-22 14:17:27 +02:00
Marijn Haverbeke
7588a89553
Rename copy_glue back to take_glue
2011-08-22 10:42:56 +02:00
Brian Anderson
518dc52f85
Reformat
...
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00
Marijn Haverbeke
cd440d338e
Remove or _-prefix all unused function arguments
...
This should make the compilation process a bit less noisy.
2011-08-18 10:02:13 +02:00
Erick Tryzelaar
e4a0f997fb
Port the compiler to the typaram foo<T> syntax.
2011-08-16 15:05:56 -07:00
Brian Anderson
f05a91a0dc
Rename std::ivec to std::vec
2011-08-16 10:36:19 -07:00
Lindsey Kuper
f91351aaf6
The wonky for...in... whitespace was bothering me. Sorry!
2011-08-15 22:19:50 -07:00
Graydon Hoare
814bf41d89
Add operator 'copy', translates as fall-through.
2011-08-15 15:44:41 -07:00
Paul Stansifer
ebb16e6a25
Use span stacks to track macro expansion for less troublesome error messages.
2011-08-15 15:35:28 -07:00
Paul Stansifer
c48036c0b7
Make spans into stacks (to store expansion backtraces).
2011-08-15 15:35:27 -07:00
Paul Stansifer
d2f9b15052
Rename a field (so that macros can mention it).
2011-08-15 15:35:27 -07:00
Marijn Haverbeke
3f127e397f
Add tuple patterns
2011-08-15 13:20:16 +02:00
Erick Tryzelaar
8b15045224
Port the compiler to the ivec type [T] syntax.
2011-08-09 15:53:26 -07:00
Tim Chevalier
e0985c1060
Handle alt on a _|_ - typed value
...
Return the result of the discriminant from trans_alt,
rather than nil, in the _|_ case. This was breaking the
enclosed test case (alt-bot-2) when optimization was disabled.
Closes #769
2011-08-04 16:07:26 -07:00
Tim Chevalier
948f8090ae
Handle _|_ - typed discriminants in alts correctly
...
Stop me, won't you, if you've heard this one before?
Closes #794
2011-08-02 19:02:38 -07:00
Tim Chevalier
731797d075
In trans, don't assume both sides of a binop have the same type
...
This was at least partially responsible for Issue 777.
The only solution I can think of is for trans to just not generate
code for a comparison if one or both sides has type _|_. Since
that means evaluating that subexpression diverges, it should be ok
to never do the comparison. Actually generating code for the
comparison would trip an LLVM assertion failure.
2011-08-02 17:36:41 -07:00
Marijn Haverbeke
6c9b90d06a
Be a little more clever about picking columns to match on in trans_alt
...
This should result in slightly more efficient matching of 'complex'
patterns with multiple discriminants in them.
2011-08-02 12:57:27 +02:00
Marijn Haverbeke
f8fa574864
Copy locals created by destructuring on the content of a box
...
This is required so that assigning to these locals doesn't clobber
the content of the box.
(A possible optimization would be to only do this copying for
locals that actually are assigned to.)
2011-08-02 12:09:15 +02:00
Marijn Haverbeke
985c32ef4c
Partially implement destructuring locals
...
You can now say
let {bcx, val} = some_result_returner();
Similar for loop variables. Assigning to such variables is not safe
yet. Function arguments also remain a TODO.
2011-08-01 17:51:37 +02:00
Marijn Haverbeke
6e2a7bff7f
Fix damage done by the pretty-printer
2011-07-27 15:54:33 +02:00
Marijn Haverbeke
df7f21db09
Reformat for new syntax
2011-07-27 15:54:33 +02:00
Marijn Haverbeke
aea537779e
Remove all uses of tuples from the compiler and stdlib
2011-07-26 14:06:02 +02:00
Michael Sullivan
3b2d23b2cd
Move a bunch of trans into trans_common, including the context structures.
...
Probably more should be moved or split off into other files. My algorithm
was something along the lines of: move the contexts and their transitive
dependencies along with some functions to work with them. I stopped when
I was going to have to start pulling glue generation, which really
should go into a trans_glue file.
2011-07-21 17:39:06 -07:00
Marijn Haverbeke
a0ab57b3f6
Fix trans_alt to handle unreachable branches without blowing up
2011-07-19 17:07:51 +02:00
Eric Holk
8afb1a7c63
refactor: Move the LLVM type and constant constructors into a new module.
2011-07-14 17:08:45 -07:00
Patrick Walton
e76f44453b
rustc: First stab at interior string literals, untested as of yet
2011-07-14 11:47:20 -07:00
Graydon Hoare
39151f2ad8
Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases.
2011-07-13 15:44:09 -07:00
Marijn Haverbeke
8d68b0462a
Refactor out some repetetive code in trans_alt
2011-07-13 11:33:46 +02:00
Marijn Haverbeke
be4f7354b4
Add box patterns
...
An @ can now be prepended to a pattern to unbox something during
pattern matching.
Closes #661
2011-07-13 11:11:43 +02:00
Marijn Haverbeke
12d5532166
Use switches rather than chained conditionals to compile alt matches
...
This also moves the alt-related trans code into its own file.
Closes #467
2011-07-13 00:38:24 +02:00