Why isn't `tok->next` in `is_function()`
sunshaoce opened this issue · 3 comments
sunshaoce commented
sunshaoce commented
static bool is_function(Token *tok) {
if (equal(tok, ";"))
return false;
Type dummy = {};
Type *ty = declarator(&tok, tok, &dummy);
return ty->kind == TY_FUNC;
}
I think if (equal(tok, ";"))
could be if (equal(tok->next, ";"))
siriusdemon commented
Hey @sunshaoce I am also studying these code too.
I think the if
check whether this is a type declaration. like
int; // this is type declaration
int main() { ... }
sunshaoce commented
I see, thank you!