-
Notifications
You must be signed in to change notification settings - Fork 197
gccrs: fix parser error on parenthesised types #4214
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9488,28 +9488,39 @@ Parser<ManagedTokenSource>::parse_paren_prefixed_type () | |
| { | ||
| // release vector pointer | ||
| std::unique_ptr<AST::Type> released_ptr = std::move (types[0]); | ||
|
|
||
| // We don't want to convert it to TraitBound as it could be a | ||
| // ParenthesisedType | ||
|
|
||
| return std::unique_ptr<AST::ParenthesisedType> ( | ||
| new AST::ParenthesisedType (std::move (released_ptr), | ||
| left_delim_locus)); | ||
|
|
||
| /* HACK: attempt to convert to trait bound. if fails, parenthesised | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably be removed. |
||
| * type */ | ||
| std::unique_ptr<AST::TraitBound> converted_bound ( | ||
| released_ptr->to_trait_bound (true)); | ||
| if (converted_bound == nullptr) | ||
| { | ||
| // parenthesised type | ||
| return std::unique_ptr<AST::ParenthesisedType> ( | ||
| new AST::ParenthesisedType (std::move (released_ptr), | ||
| left_delim_locus)); | ||
| } | ||
| else | ||
| { | ||
| // trait object type (one bound) | ||
|
|
||
| // get value semantics trait bound | ||
| AST::TraitBound value_bound (*converted_bound); | ||
| /* | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is dead code, if it isn't required it won't be touched again, delete it and put a comment if any information should remain. |
||
| std::unique_ptr<AST::TraitBound> converted_bound ( | ||
| released_ptr->to_trait_bound (true)); | ||
| if (converted_bound == nullptr) | ||
| { | ||
| // parenthesised type | ||
| return std::unique_ptr<AST::ParenthesisedType> ( | ||
| new AST::ParenthesisedType (std::move (released_ptr), | ||
| left_delim_locus)); | ||
| } | ||
| else | ||
| { | ||
| // trait object type (one bound) | ||
|
|
||
| return std::unique_ptr<AST::TraitObjectTypeOneBound> ( | ||
| new AST::TraitObjectTypeOneBound (value_bound, | ||
| left_delim_locus)); | ||
| } | ||
| // get value semantics trait bound | ||
| AST::TraitBound value_bound (*converted_bound); | ||
|
|
||
| return std::unique_ptr<AST::TraitObjectTypeOneBound> ( | ||
| new AST::TraitObjectTypeOneBound (value_bound, | ||
| left_delim_locus)); | ||
| } | ||
| */ | ||
| } | ||
| } | ||
| else | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment fails to cover one case, what if it isn't ?