-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolution Design #27
Comments
BTW, to perform
But it's fine if we implement each step parallelly. |
Yes this is a really good idea. The way i envision things is many "Passes" and a pass i mean a Class using the ASTVisitor pattern and we have a state machine to work the work in there. We can even flesh out later with warning passes such as DeadCode recounting the names as it goes and when things go out of scope we iterate all nodes with a refcount == 0 as dead code. I recently Added a simple pass rust-scan.cc which we will need in subsequent passes to know about global declarations as functions can be declared after they are used etc. |
Name resolution and macro expansion need to be interleaved for the following to work: macro_rules! a {
() => {
macro_rules! b {
() => {}
}
}
}
a!();
b!(); #![feature(decl_macro)]
macro a($b:ident) {
macro $b() {}
}
b!();
a!(b); |
@bjorn3 Ah yes, thanks for mention, I'll keep it. |
@philberty Yes, the pass, I think this term implies everything, extensible and can be disabled for certain purposes. We need a tiny framework for these passes (and options for disabling and debug), maybe we can do it after resolution an expansion. |
This adds type inferencing and validation for arrays such as: let x: [i32, 5] = [1,2,3,4,5] ley y = [1,2,3]; It checks that each element is of a valid type and they line up correctly. There needs to be some refactoring of the type resolution to handle the array index expressions so this is a good save point for now. Addresses: #27 #55
This adds type inferencing and validation for arrays such as: let x: [i32, 5] = [1,2,3,4,5] ley y = [1,2,3]; It checks that each element is of a valid type and they line up correctly. There needs to be some refactoring of the type resolution to handle the array index expressions so this is a good save point for now. Addresses: #27 #55
I have now pushed a big pr for the new resolution frameworks. For macros we need a toplevel name resolution pass and then we can do macro expansion. I will make some documentation on how the IDs are working to help. |
I will add documentation to the WIKI on how the resolution is working to be able to close this issue. |
I think it's better to separate type and name resolution, fortunately, if we do it now, it's just a little change. Here're the steps:
Resolution
class inherited fromAST::ASTVisitor
, and movestatic bool ResolveNamesAndTypes
into it.TypeResolution
andNameResolution
class inherited fromResolution
class.This is better for maintenance and working parallelly.
And the name resolution will distinct names from different namespaces, like values, macros, so it's an important prerequisite for the rest of the work.
If it's OK, then I can raise PR for it.
What do you think? @philberty @SimplyTheOther
The text was updated successfully, but these errors were encountered: