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

Restrict Decl Nesting. #3394

Closed
csyonghe opened this issue Dec 8, 2023 · 0 comments · Fixed by #3397
Closed

Restrict Decl Nesting. #3394

csyonghe opened this issue Dec 8, 2023 · 0 comments · Fixed by #3397
Assignees
Labels
kind:enhancement a desirable new feature, option, or behavior priority:critical blocking multiple users from getting things done

Comments

@csyonghe
Copy link
Collaborator

csyonghe commented Dec 8, 2023

The parser should check for illegal nesting of decls, such as a generic nested inside a generic, or a import nesting inside a function.

The solution is to declare a table of allowed decls for each decl, and perform that check systematically, e.g.

Dictionary<ASTNodeType, HashSet<ASTNodeType>> kAllowedChildNodeTypes;

For now, we can allow a fallback case that if a decl type does not have an entry in kAllowedChildNodeTypes, then it is allowed anywhere.

@csyonghe csyonghe added kind:enhancement a desirable new feature, option, or behavior priority:critical blocking multiple users from getting things done labels Dec 8, 2023
@csyonghe csyonghe added this to the Q1 2024 (Winter) milestone Dec 8, 2023
@csyonghe csyonghe self-assigned this Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:enhancement a desirable new feature, option, or behavior priority:critical blocking multiple users from getting things done
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant