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
Conditional compilation issue #7108
Comments
haxe 4.0.0 preview As always sorry if I'm misunderstanding something. |
PS: from google searches it seems that #elif was never supported, but somehow gets through the parser anyhow. (EDIT: well the code is somewhat succint, but I don't know if it applies to all targets) |
It's a valid token as far as the lexer is concerned. All tokens are skipped in inactive branches, so this never comes up as a problem. Maybe we should indeed error on invalid |
You mean: "It's a valid token as any space-delimited set of characters is a [skipped] token in inactive compilation branches," right? It would be nice if inactive CC branches did spit out syntax errors, but then you couldn't #if 0 ... { invalid, half written, code } #endif' any more just to get a test compile. Well.. actually, you could detect '0' as a special circumstance... @azrafe7 '#elseif' is the token that denotes a second branch for conditional compilation. @Simn - If you're going to think about creating an error when you see '#unrecognized' in a source file, hxcpp_debugger.hx
#if !hxcpp
#error "hxcpp debugging can only be used in C++ targets."
#endif And that would stop the compiler with an error message:
(or whatever the 4.0 error message format will be.) |
That's not true, we still lex normally in inactive branches. The lexer dies on
|
My bad. Not sure why I thought it wasn't. |
Probably because it's not properly documented. |
Thanks @EricBishton (figure that out just after posting). @Simn, yes, why not error out in this cases? (I see you only added the documentation label) |
Have not been able to make a general and succint example out of this, but it was reproducing in my code base and this snippet (http://try-haxe.mrcdk.com/#e66Ed) seems to somehow reproduce the issue (although not faithfully):
Maybe "elif" was allowed some time ago and has not been supported in latest versions?
The text was updated successfully, but these errors were encountered: