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)
- method / constant was impl on primitive type
- Invalid `self` import was made
- refutable pattern in local binding - `[E0005]` HOT 1
- Cannot find path `x` in this scope HOT 2
- ICE - `Copy` trait was implemented on `Drop implementation type` - [E0184] HOT 4
- missing unreachable pattern `[E0001]` warning HOT 2
- ICE - cannot mix `bin` crate type with others - `[E0601]` HOT 1
- Lexer tuple index lexed as an exponential notation
- Handle macro invocations expanding to new macro definitions HOT 2
- Invalid `repr options` error support
- Inconsistent behavior between gccrs and gccrs compiled with ASAN HOT 2
- Change `ErrorCode` location after the `error:`
- ICE - when `impl Trait` type expands to a recursive type `[E0720]`
- Legacy name mangling does not encode unicode characters
- `#[no_mangle]` should not be applied to non-ASCII items
- ErrorCode Support
- ICE when binding `richloc` to paser errors HOT 2
- ICE on match expression without any match arms HOT 1
- Fix cross compilation
- Bad uninit intrinsic
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.