-
Notifications
You must be signed in to change notification settings - Fork 13
Driver returns twice the same comment #36
Comments
I confirm that for drivers import { PassportConfiguratorrr } from '@freecodecamp/loopback-component-passport';
|
@zurk It doesn't show the |
oh, I just mixed, and column |
@zurk Yes, but I'm talking about a different field :) But in case that @dpordomingo described, we can remove these duplicates from the tree safely. But for the case with names vs aliases, removing one of them will cause half of the UAST queries to break. The correct solution will require adding support for DAGs in SDK that I was advocating from the very beginning. This will happen later during v2 cycle, or even in v3. |
yeah, now I get it. If in
before it was |
This seems still to be the case: the query to the same file {"@pos":{"@type":"uast:Positions","end":{"@type":"uast:Position","col":22,"line":1,"offset":21},"start":{"@type":"uast:Position","col":8,"line":1,"offset":7}},"@type":"uast:Comment","Block":false,"Prefix":"","Suffix":"","Tab":"","Text":"comment here"}
{"@pos":{"@type":"uast:Positions","end":{"@type":"uast:Position","col":20,"line":2,"offset":41},"start":{"@type":"uast:Position","col":1,"line":2,"offset":22}},"@type":"uast:Comment","Block":true,"Prefix":" ","Suffix":" ","Tab":"","Text":"block comment"}
{"@pos":{"@type":"uast:Positions","end":{"@type":"uast:Position","col":22,"line":1,"offset":21},"start":{"@type":"uast:Position","col":8,"line":1,"offset":7}},"@type":"uast:Comment","Block":false,"Prefix":"","Suffix":"","Tab":"","Text":"comment here"}
{"@pos":{"@type":"uast:Positions","end":{"@type":"uast:Position","col":20,"line":2,"offset":41},"start":{"@type":"uast:Position","col":1,"line":2,"offset":22}},"@type":"uast:Comment","Block":true,"Prefix":" ","Suffix":" ","Tab":"","Text":"block comment"}
package main
import (
"encoding/json"
"fmt"
"gopkg.in/bblfsh/client-go.v3"
"gopkg.in/bblfsh/client-go.v3/tools"
"gopkg.in/bblfsh/sdk.v2/uast/nodes"
)
func main() {
client, err := bblfsh.NewClient("localhost:9432")
if err != nil {
panic(err)
}
res, _, err := client.NewParseRequest().ReadFile("js-driver-issue-36.js").UAST()
if err != nil {
panic(err)
}
query := "//*/uast:Comment"
it, _ := tools.Filter(res, query)
var nodeAr nodes.Array
for it.Next() {
nodeAr = append(nodeAr, it.Node().(nodes.Node))
}
data, err := json.MarshalIndent(nodeAr, "", " ")
if err != nil {
panic(err)
}
fmt.Println(string(data))
}
4 @dennwc do you know what is the reason? This seems like a 2 identical copies to me |
@bzz This is exactly the problem I talked about when reffering to DAGs. There are two pointers to the same comment node in the native AST. |
If it's parsed the following example:
It is returned each comment twice with different
internalRole
addendum:
This issue might be related to these similar ones in other languages drivers:
bblfsh/go-driver#28 bblfsh/python-driver#167 bblfsh/java-driver#86
The text was updated successfully, but these errors were encountered: