Patrick Walton
cc59cea8b0
rustc: Thread an item-to-type mapping throughout the typechecking and translation phases
2011-03-30 17:28:06 -07:00
Patrick Walton
c67eb1a575
rustc: Partially resolve external module imports
2011-03-29 17:01:27 -07:00
Graydon Hoare
b2427509e2
Another go at changing compile-command, this time using RBUILD env var.
2011-03-25 15:07:27 -07:00
Graydon Hoare
91c2b82b09
Revert "Bulk-edit compile commands in emacs chatter to point to assumed build/ dir off src root."
...
This reverts commit 846f2e2ba9
.
2011-03-25 14:05:38 -07:00
Graydon Hoare
846f2e2ba9
Bulk-edit compile commands in emacs chatter to point to assumed build/ dir off src root.
2011-03-25 13:48:37 -07:00
Patrick Walton
e2d6475308
rustc: Store cached crate metadata in the session
2011-03-25 11:11:21 -07:00
Graydon Hoare
4e49ca8abd
Start hooking resolve into creater.
2011-03-24 17:37:32 -07:00
Graydon Hoare
4b946cea35
Modify native_item_fn to handle trailing linkage names that differ from the item name (used in win32 build of std.dll)
2011-03-20 20:18:19 -07:00
Patrick Walton
71b6e602c5
rustc: Add an annotation for the crate definition to view_item_use
2011-03-15 17:33:05 -07:00
Rafael Ávila de Espíndola
28d51e3fd2
Add support for indexing tags in blocks.
2011-03-11 17:12:25 -05:00
Rafael Ávila de Espíndola
0117cf2fc2
Handle resolving to native modules.
2011-03-10 21:33:53 -05:00
Graydon Hoare
90f299e710
Permit view items in native modules.
2011-03-07 11:48:43 -08:00
Rafael Avila de Espindola
012fa69ea5
More typechecking for native types and the needed plumbing in codegen.
2011-02-16 14:02:02 -05:00
Graydon Hoare
4a72a23171
Add basic front-end support for 'for each' loops.
2011-02-14 18:17:31 -08:00
Graydon Hoare
0043f99f83
Teach resolve about ty params on tags.
2011-02-14 13:36:20 -08:00
Rafael Avila de Espindola
580d527aa2
Add missing fold of native functions.
2011-02-10 14:36:38 -05:00
Rafael Avila de Espindola
3e613c1648
Add native modules to resolve. With this hello world gets to typecheck.
2011-02-07 15:07:27 -05:00
Rafael Avila de Espindola
ff6864aa5c
Fix expressions with paths with more than one element.
2011-02-07 14:57:34 -05:00
Rafael Ávila de Espíndola
57bb9d809b
Parse function declarations.
2011-02-04 11:10:04 -05:00
Rafael Ávila de Espíndola
3cac20dae3
Correctly handle "import foo = bar.zed;".
2011-01-28 11:54:59 -05:00
Rafael Ávila de Espíndola
a2081deb2d
Simplify and fix the resolution of expr_path. With this we now get to codegen
...
in
-------------------
type foo = rec(int a);
mod m1 {
mod m2 {
const foo bar = rec(a = 4);
}
}
fn main(vec[str] args) {
log m1.m2.bar.a;
}
-------------------
2011-01-27 16:51:41 -05:00
Rafael Ávila de Espíndola
c170e7edfd
Resolve type paths.
2011-01-27 16:39:31 -05:00
Rafael Ávila de Espíndola
21208f2343
Handle paths correctly. This lets us handle one more test :-)
2011-01-27 15:56:10 -05:00
Rafael Ávila de Espíndola
5066937f10
First step for supporting "case (foo.bar(?zed))": Change the ast of
...
pat_tag to hold a path.
2011-01-27 15:27:56 -05:00
Rafael Ávila de Espíndola
56441e19d1
Correctly split a.b.c into its path and field access components.
2011-01-27 11:19:02 -08:00
Rafael Ávila de Espíndola
1b82060c5e
Print an error if we try to refer to a module in an expr_path.
2011-01-25 18:16:52 -05:00
Rafael Ávila de Espíndola
9e2324ad1e
Small first step in expr_path. Call find_final_def just to detect
...
unresolved names. find_final_def is going to be extended to return the
final expr.
2011-01-25 17:54:38 -05:00
Rafael Ávila de Espíndola
d97137734b
Remove unimplemented erorr and enable test.
2011-01-24 15:29:38 -05:00
Rafael Ávila de Espíndola
c6dec379b0
Implement a bit of type parameter matching to get a simple case working.
2011-01-24 11:58:01 -08:00
Graydon Hoare
c9d2eceb45
Teach resolve about linear for loops.
2011-01-20 15:17:26 -08:00
Rafael Ávila de Espíndola
35d53b7eb1
Look at the type params of an item_ty when resolving.
2011-01-19 16:13:33 -05:00
Graydon Hoare
a0aedd14c7
Twiddle comment.
2011-01-18 17:19:04 -08:00
Rafael Ávila de Espíndola
41b7d6d74d
One last refactoring of the import handling:
...
* Create an import resolving stage. Currently this involves a copy of the ast,
we can probably revisit this once we revisit doing full copies of the ast in
general.
* Don't repeat work. Once we resolve a import, put it on a hash table and use
it next time we are asked for it. This solves a O(n^2) behaviour in
degenerated cases.
* Once import resolution is done, the target of an import is stored on the
import itself.
2011-01-18 15:43:13 -08:00
Rafael Ávila de Espíndola
9f3caed8a0
Enable more tests.
2011-01-17 18:13:55 -05:00
Rafael Ávila de Espíndola
58490d7fa0
Fix the last known (to me) bug in import resolution. We were not properly
...
dropping the inner part of the environment when an intermediate item resolved
in an outer scope.
2011-01-17 13:33:13 -08:00
Rafael Ávila de Espíndola
57b281533d
Some misc cleanups:
...
* Remove unused argument
* Move option.t wrapping to outer functions.
2011-01-17 14:58:18 -05:00
Rafael Ávila de Espíndola
5b9eda4a41
Fix the import handling in "complex" cases. When looking a.b.c and 'a' is a
...
module, we should look for 'b' *just* in the module 'a' and then continue
resolving b.c in the environment created by updating *with* a.
Still not 100% correct, but getting there.
2011-01-14 17:34:00 -05:00
Rafael Ávila de Espíndola
bdcb9d9b53
Make lookup non recursive and instead move the recursion just to
...
find_final_def. Use the fact that the recursion is in a simpler function to
detected import loops and exit.
2011-01-14 11:10:06 -08:00
Graydon Hoare
f3c3fc0353
Change single-ident expr_ident to greedy/fat multi-ident expr_path, to handle the module-path/value-indexing distinction.
2011-01-13 17:42:28 -08:00
Rafael Ávila de Espíndola
c1f2e29596
Produce better errors for invalid imports.
2011-01-12 12:27:31 -08:00
Rafael Ávila de Espíndola
c489abedb4
Call find_final_def directly in fold_view_item_import. It is both cleaner and
...
faster.
2011-01-12 12:26:59 -08:00
Rafael Ávila de Espíndola
359d72b4d0
Change mod_index_entry to point directly to items and view_items.
2011-01-12 12:26:23 -08:00
Rafael Ávila de Espíndola
34643eeac8
Fix another import case we got wrong: The local environment should not
...
interfere with the import statements.
2011-01-11 13:59:52 -08:00
Rafael Ávila de Espíndola
c5a766f133
Fix two invalid import cases we were not detecting:
...
* If an import was unused we would never print any errors for it.
* We would keep the existing environment in scope when descending 'foo.bar'
and would find 'bar' in the global environment if there was no 'bar' in
'foo'.
2011-01-11 13:58:39 -08:00
Rafael Ávila de Espíndola
2fb09eb585
Add sufficient import support to compile some simple single-crate programs.
...
This is likely not the final solution. It does repetitive work and doesn't produce
errors for invalid but unused imports. In any case, I think it is a useful step.
2011-01-07 15:17:18 -08:00
Rafael Ávila de Espíndola
7c8f99fdc1
Add names from imports to the namespace.
2011-01-04 17:58:10 -05:00
Rafael Ávila de Espíndola
e0fe271d34
Add support for looking up a name introduced by a 'use'.
...
With this we go from "error: unresolved name: foo" to
"unimplemented definition variant for: foo" in
use foo;
fn main(vec[str] args) {
foo.bar();
}
2011-01-04 11:35:13 -05:00
Graydon Hoare
ad889ba3ae
Change resolve errs to span_errs.
2010-12-31 14:43:43 -08:00
Graydon Hoare
bc9db2e972
Teach resolve to find obj fields and ty params from methods.
2010-12-30 15:27:52 -08:00
Patrick Walton
d1b2366983
rustc: Resolve type params
2010-12-15 13:13:36 -08:00