-
-
Notifications
You must be signed in to change notification settings - Fork 466
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
Elseif support #536
Elseif support #536
Conversation
elseif = else if? |
@ovr I thought about it, I don't like it. |
I prefer |
Current implementation does not work well with this structure: namespace Test;
class X
{
public static function x(a)
{
if a == 1 {
echo "x";
} elseif a == 2 {
echo "y";
} elseif a == 3 {
echo "z";
} else {
echo "?";
}
}
} |
@phalcon why do you think that? There is no PHP_METHOD(Test_Statements, echoElseifTest) {
zval *a_param = NULL;
int a;
zephir_fetch_params(0, 1, 0, &a_param);
a = zephir_get_intval(a_param);
if (a == 1) {
php_printf("x");
} else if (a == 2) {
php_printf("y");
} else if (a == 3) {
php_printf("z");
} else {
php_printf("?");
}
} |
Yeah, I know, it's not about compilation, it's about parsing: $ bin/zephir-parser a.zep
{ "type": "error", "message": "Syntax error", "file": "a.zep", "line": 4, "char": 7 } |
Compile from Zephir Funny |
@phalcon that is not problem of this PR, that is problem related to |
😢 you're right lol |
@ovr C and PHP also lets write code like: if (a < b) foo();
else bar(); And I hate this style, it helps to create stupid mistakes. |
I'm ok with |
@phalcon are you going to merge this? |
No description provided.