Closed cbuttner closed 2 weeks ago
I've changed this in dev
, please have a try.
Works great, thank you.
Any chance this could also be improved?
module test;
import std::io;
macro @macro_2(#x) {
int a = #x;
}
macro @macro_1(#x) {
@macro_2(#x);
}
fn int main(String[] args) {
@macro_1(TEST);
return 0;
}
2: import std::io;
3:
4: macro @macro_2(#x) {
5: int a = #x;
^^
(/tmp/test/src/main.c3:5:11) Error: 'TEST' could not be found, did you spell it right?
Tracing was missing a bit, try it now.
Better, but I found another case:
module test;
import std::io;
macro void @macro_2(x) {
int a = x;
}
macro void @macro_1(#x) {
@macro_2(#x);
}
fn int main(String[] args) {
@macro_1(TEST);
return 0;
}
6: }
7:
8: macro void @macro_1(#x) {
9: @macro_2(#x);
^^
(/tmp/test/src/main.c3:9:12) Error: 'TEST' could not be found, did you spell it right?
Heh, fixed one side of the if, but not the other... Try it again @cbuttner
That case is fixed, but here's one more:
module test;
struct Foo {
bool a;
int b;
}
fn int main(String[] args) {
mem::new(Foo, {
.test = 1,
});
return 0;
}
555:
556: /**
557: * @require $vacount < 2 : "Too many arguments."
558: * @require $or($vacount == 0, $assignable($vaexpr(0), $Type)) : "The second argument must be an initializer for |
^^^^^^^^^^
(/home/christian/Github/c3c/lib/std/core/mem.c3:558:44) Error: This is not a valid member of 'Foo'.
Thanks! Fixed now @cbuttner
Cool, I'll let you know if I stumble across another case.
Emits
But there is no information on where this macro was invoked from.
The error should trace all the way back to the origin. Kind of like so: