Comments (7)
BTW, to perform type resolution
correctly, I think the order should be:
name resolution -> macro expansion -> type resolution
But it's fine if we implement each step parallelly.
from gccrs.
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);
from gccrs.
@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.
from gccrs.
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.
from gccrs.
@bjorn3 Ah yes, thanks for mention, I'll keep it.
from gccrs.
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.
from gccrs.
I will add documentation to the WIKI on how the resolution is working to be able to close this issue.
from gccrs.
Related Issues (20)
- Add `#[rustc_unsafe_specialization_marker]` attribute
- Prevent `#[may_dangle]` attribute from being used in safe impl
- ICE when on invalid-code when construction enum
- Do not link with `-ldl` and `-lpthread` unless necessary
- Handle outer attributes properly for inline assembly
- Improve `-ldl -lpthread` checks in `./configure`
- Safe guard InlineAsm-related structs
- Remove unnecessary #include from rust-expr.h HOT 2
- Fully incorporate tl::expected into InlineAsm parsing
- asm! macro failed to exhaustively parse all of options(), clobber_abis() and register operands
- Typechecking of asm! failed in `let _` HOT 1
- Add ExprType::InlineAsm variant to ExprType enum HOT 1
- Cleanup vector copies from Rust to C++ in BIR HOT 2
- Add special `LangItemPath` AST node
- Make asm parser stores parse result
- Union pattern matching expecting all fields
- asm parser lacking `label` parse functionality
- Unable to find associated `type` in `trait`
- ICE in retrieving ambiguous associated type - `E0223`
- `include_str!(file!())` does not work on godbolt HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gccrs.