You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Santi once clarified that only the parent element had the qualified(identifier) role which with the AST that Python produces would be lib. Once we've a renormalization process to modify the three we could add a common parent with the Qualified role.
@juanjux Yes, I would be great to have something like Santi suggest in the comment you provided.
But then this parent identifier shouldn't have the token or full name lib1.lib2.lib3.var. Otherwise, it is confusing.
Also about LEFT role. In this case, parent qualified identifier should have it and not the last simple identifier.
I guess what to do depens on what Qualified means. Currently it's being used as a module identifier, but instead it probably should be used as currently defined: Qualified is a kind of property identifiers may have, when it's composed of multiple simple identifiers, that is, all but the last one should be qualified. If the AST doesn't provide a separate Qualified node, we shouldn't need it.
So what should be considered, I think, is whether it's possible to annotate it as commented with current AST. I think it should, but maybe I'm missing something. The same applies to the left role, I think.
I can change it so in a.b.ca and b has the Qualified role again and c doesn't have it if we agree (it's actually easier that way because in the native AST those nodes will have the Attribute internal type).
Reopening because I found that while now it works for qualified variable accesses, for method calls the Qualified is not applied to the first elements.
I've fixed the calls. There is another case that I think is impossible to solve with the current SDK, qualified expressions that are not part of assignments, function calls or arguments, like just:
a.b.c
In this case all three nodes will have the Qualified role, but as we've discussed in this thread c shouldn't.
The problem is that Python's AST generates exactly the same nodes for the three (same internalType and same internalRole) so there isn't really a way to tell the annotation to make c unqualified other than checking than the parent doesn't have the Attribute role, but we don't have a function that can check the parent of the node right now in the ann.go module.
Activity
juanjux commentedon Sep 21, 2017
Santi once clarified that only the parent element had the qualified(identifier) role which with the AST that Python produces would be lib. Once we've a renormalization process to modify the three we could add a common parent with the Qualified role.
#51 (comment)
We could rethink it, anyway.
cc @abeaumont
zurk commentedon Sep 22, 2017
@juanjux Yes, I would be great to have something like Santi suggest in the comment you provided.
But then this parent identifier shouldn't have the token or full name
lib1.lib2.lib3.var. Otherwise, it is confusing.Also about
LEFTrole. In this case, parent qualified identifier should have it and not the last simple identifier.So, as I think good to have something like:
abeaumont commentedon Sep 22, 2017
I guess what to do depens on what
Qualifiedmeans. Currently it's being used as amoduleidentifier, but instead it probably should be used as currently defined: Qualified is a kind of property identifiers may have, when it's composed of multiple simple identifiers, that is, all but the last one should be qualified. If the AST doesn't provide a separateQualifiednode, we shouldn't need it.So what should be considered, I think, is whether it's possible to annotate it as commented with current AST. I think it should, but maybe I'm missing something. The same applies to the
leftrole, I think.juanjux commentedon Sep 22, 2017
Previously it was just as @abeaumont said, I changed it when Santi told me about the first element if there wasn't a parent element (and there isn't: in the AST, the parent is "Assignment" directly as you can see here: https://github.com/bblfsh/python-driver/blob/master/tests/qualified.py.native).
I can change it so in
a.b.caandbhas theQualifiedrole again andcdoesn't have it if we agree (it's actually easier that way because in the native AST those nodes will have theAttributeinternal type).juanjux commentedon Nov 14, 2017
Reopening because I found that while now it works for qualified variable accesses, for method calls the Qualified is not applied to the first elements.
juanjux commentedon Nov 14, 2017
I've fixed the calls. There is another case that I think is impossible to solve with the current SDK, qualified expressions that are not part of assignments, function calls or arguments, like just:
a.b.c
In this case all three nodes will have the
Qualifiedrole, but as we've discussed in this threadcshouldn't.The problem is that Python's AST generates exactly the same nodes for the three (same internalType and same internalRole) so there isn't really a way to tell the annotation to make
cunqualified other than checking than the parent doesn't have theAttributerole, but we don't have a function that can check the parent of the node right now in theann.gomodule.