sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Some nodes don't have roles anymore

Open smacker opened this issue 7 years ago • 3 comments

Examples:

java: screen shot 2018-08-10 at 12 58 56

go: screen shot 2018-08-10 at 13 00 57

smacker avatar Aug 10 '18 11:08 smacker

Nodes inside semantic objects (like in this case the Identifier inside the QualifiedIdentifier) doesn't have roles because the parent semantic object itself (QualifiedIdentifier) have a standard structure and, if it's parent is not a semantic object, it would be the one doing a "role".

For example, for the elements inside a FunctionGroup semantic objects you don't need roles because the children are already separated into Arguments, Block, Return, etc.

Could you paste the full java code here you're running in the dashboard.

juanjux avatar Aug 10 '18 11:08 juanjux

Ok. The issue came from the misunderstanding of new semantic things.

Though I would like to keep this issue open because user experience for querying is confusing for me now. I need to mix both role&semantic concepts to do queries and I need to know uast implementation details. Which part of native AST is considered semantic and which not...

smacker avatar Aug 10 '18 11:08 smacker

The problem is that, as @juanjux mentioned, semantic object don't have roles, since they are known upfront. And all semantic types have a uast:* prefix for their types, so they can be found easily.

But again, since we are emulating for an old libuast, we have to hide the uast: namespace. As an alternative, we can emulate a uast=true attribute on v1 nodes. But this won't resolve the usability issue.

Will leave it open for now with a plan to support implicit roles on semantic objects with a custom XPath implementation.

dennwc avatar Aug 10 '18 12:08 dennwc