Skip to content
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

Cannot have local enums #152

Open
graphitemaster opened this issue Sep 29, 2014 · 1 comment
Open

Cannot have local enums #152

graphitemaster opened this issue Sep 29, 2014 · 1 comment

Comments

@graphitemaster
Copy link
Owner

Enums cannot be local to block scope, they must be global. Suggest allowing block-scope enums

@graphitemaster
Copy link
Owner Author

This cannot be implemented easily because the parser insists on being really stupid. It never ceases to amaze me that something as simple as 'block-scope', 'local' and 'global' is so confusing for a parser.

The parser->globals field is in fact not 'global' in the sense that globals are stored there exclusively. No, not at all. For some insane reason locals that need to be used immediately are stored there because all of them are guaranteed to be generated.

Blindly putting something into an ast_block's locals vector won't work for function locals if they need to be used because generation happens way later. The parser's _locals is just downright stupid in that it too is not actually locals but rather the current block-scope's parent block-scope. Then to make it even more confusing the hashtables for searching for the globals which contain locals also finds aliases, and for some reason there are locals that search for variables up to a 'certain' block-scope depth (what the actual fuck?). The hashtables have no relation to locals or globals at all. To make it worse, for some insane reason, the parser has 'variables' which are globals and locals and labels and parameters and everything else under the sun.

For some other pointlessly nonsensical reason an ast_value that is CV_CONST and hasvalue=true is in fact uninitialized, even when expression.flags contains AST_FLAGS_INITIALIZED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants