How to determine if an attribute is conditionally excluded? #140
Labels
No labels
Bug
Feature Request
NR6Pack
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-icsharpcode/NRefactory#140
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It is possible to specify a
[ConditionalAttribute]on an attribute type to indicate that the attribute should only be present in the compiled assembly if a certain symbol is defined when the attribute is instantiated. I need access to this information, so how can we represent it?I suggest a
bool IsConditionallyExcludedflag onIAttribute. What do you think?The
IsConditionallyExcludedproperty in the type system is a good idea.In SharpDevelop, we currently use this method in the semantic highlighter:
To implement
IsConditionallyExcluded, we'd just need to add aIList<string>reference toCSharpAttribute(+maybe cache the property value inCSharpResolvedAttribute).I don't understand 100% what you mean with the
IList<string>. Do you mean that the list should contain the list of defined symbols at the point of the attribute instantiation?Yes, the unresolved attribute needs to store a reference to the
cu.ConditionalSymbolslist.I'm thinking about starting to implement this feature.
What do you think about also adding members called
ConditionalSymbolstoITypeDefinitionandIMethod, and alsoIsConditionallyRemovedtoInvocationResolveResult?