IParametersOwner vs IDeclarationWithParameters

What's the difference between IParametersOwner and IDeclarationWithParameters?


IAccessor is IParametersOwner, but IAccessorDeclaration is NOT IDeclarationWithParameters
Others similar pairs seem to obey the rule, may be this is just a bug?

Sincerely,
Ilya Ryzhenkov


2 comments
Comment actions Permalink

Hello Ilya,

in PSI there are two separate hierarchies of interfaces: one rooted at the
IDeclaredElement,
and another one - at the IDeclaration. IParametersOwner is a part of the
first hierarchy, while
IDeclarationWithParameter belongs to the second one. Generally, the first
hierarchy reflects
the high-level program structure (and bears some resemblance to the CLR type
system), while the second
one is closer to C# source code. Although I'm not sure about this particular
case, let's bettr wait
for someone who is more proficient in PSI.


Regards,
Dmitry Shaporenkov
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

What's the difference between IParametersOwner and
IDeclarationWithParameters?

IAccessor is IParametersOwner, but IAccessorDeclaration is NOT
IDeclarationWithParameters Others similar pairs seem to obey the rule,
may be this is just a bug?

Sincerely,
Ilya Ryzhenkov



0
Comment actions Permalink

What's the difference between IParametersOwner and
IDeclarationWithParameters?

There are two hierarchies in PSI. One is code-centric it has IElement as
a root. The hierarchy represents abstract syntax trees of source files. Another
hierarchy is metadata-centric; it has IDeclaredElement as a root. The metadata-centric
hierarchy is language-independent, for example, it may represent classes
extracted from a compiled assembly. An important point is that metadata-centric
hierarchy is stored in caches and, thus, sometimes does not require memory-consuming
AST to be build.
IParametersOwner is a part of IDeclaredElement hierarchy. It prepresents
a metadata entity that has parameters.
IAccessor is a metadata entity that represents an accessor method, which
means something that is a CLR method present in property-method or event-method
tables (if the code compiles successfully).
IDeclaration is a part of IElement hierarchy. It represents a declaration
of something in the source file. IDeclarationWithParameters is a C#-specific
declaration that has parameter declarations as its part. In C# (contrary,
for example, to VB) accessors have no parameter declarations, thus, IAccessorDeclaration
is not a IDeclarationWithParameters.


IAccessor is IParametersOwner, but IAccessorDeclaration is NOT
IDeclarationWithParameters Others similar pairs seem to obey the rule,
may be this is just a bug?

Sincerely,
Ilya Ryzhenkov

Thanks,
Andrey Simanovsky


0

Please sign in to leave a comment.