diff --git a/driver/normalizer/normalizer.go b/driver/normalizer/normalizer.go index 047adae5..258932fb 100644 --- a/driver/normalizer/normalizer.go +++ b/driver/normalizer/normalizer.go @@ -397,10 +397,9 @@ var Normalizers = []Mapping{ uast.KeyPos: Any(), "name": Check(OfKind(nodes.KindString), Var("name")), "asname": Is(nil), - }, UASTType(uast.Identifier{}, Obj{ - uast.KeyPos: UASTType(uast.Positions{}, nil), - "Name": Var("name"), - })), + }, OpSplitPath{ + path: Var("name"), + }), // FIXME: aliases doesn't have a position (can't be currently fixed by the tokenizer // because they don't even have a line in the native AST) @@ -411,11 +410,12 @@ var Normalizers = []Mapping{ }, Obj{ "Name": UASTType(uast.Identifier{}, Obj{ - "Name": Var("alias"), + uast.KeyPos: UASTType(uast.Positions{}, nil), + "Name": Var("alias"), }), - "Node": UASTType(uast.Identifier{}, - Obj{"Name": Var("name")}, - ), + "Node": OpSplitPath{ + path: Var("name"), + }, }, )), @@ -439,14 +439,11 @@ var Normalizers = []Mapping{ }, Obj{ "All": Bool(true), - "Path": UASTType(uast.Identifier{}, Obj{ - "Name": OpPrependPath{ - // FIXME: no position for the module (path) in the native AST, only when the import starts - numLevel: Var("level"), - path: Var("module"), - prefix: "../", - }, - }), + "Path": OpSplitPath{ + // FIXME: no position for the module (path) in the native AST, only when the import starts + numLevel: Var("level"), + path: Var("module"), + }, }, )), @@ -463,13 +460,10 @@ var Normalizers = []Mapping{ }, Obj{ "Names": Var("names"), - "Path": UASTType(uast.Identifier{}, Obj{ - "Name": OpPrependPath{ - numLevel: Var("level"), - path: Var("module"), - prefix: "../", - }, - }), + "Path": OpSplitPath{ + numLevel: Var("level"), + path: Var("module"), + }, }, )), } diff --git a/driver/normalizer/util.go b/driver/normalizer/util.go index 13589e77..dd5961f2 100644 --- a/driver/normalizer/util.go +++ b/driver/normalizer/util.go @@ -1,6 +1,7 @@ package normalizer import ( + "github.com/bblfsh/sdk/v3/uast" "strings" "github.com/bblfsh/sdk/v3/uast/nodes" @@ -15,49 +16,57 @@ func num2dots(n nodes.Value, prefix string) nodes.Value { return n } -// FIXME: not reversible -type OpPrependPath struct { +type OpSplitPath struct { numLevel Op path Op - prefix string } -func (op OpPrependPath) Kinds() nodes.Kind { - return nodes.KindString +func (op OpSplitPath) Kinds() nodes.Kind { + return nodes.KindObject } -func (op OpPrependPath) Check(st *State, n nodes.Node) (bool, error) { - v, ok := n.(nodes.Value) - if !ok { - return false, nil - } +func (op OpSplitPath) Check(st *State, n nodes.Node) (bool, error) { + panic("TODO") // TODO: not reversible + return true, nil +} - res1, err := op.numLevel.Check(st, n) - if err != nil || !res1 { - return false, err +func (op OpSplitPath) Construct(st *State, n nodes.Node) (nodes.Node, error) { + var idents []uast.Identifier + if op.numLevel != nil { + nd, err := op.numLevel.Construct(st, nil) + if err != nil { + return nil, err + } + levels, ok := nd.(nodes.Int) + if !ok { + return nil, ErrUnexpectedType.New(nodes.Int(0), nd) + } + for i := 0; i < int(levels); i++ { + idents = append(idents, uast.Identifier{Name: ".."}) + } } - res2, err := op.path.Check(st, v) - if err != nil || !res2 { - return false, err + nd, err := op.path.Construct(st, n) + if err != nil { + return nil, err } - - return res1 && res2, nil -} - -func (op OpPrependPath) Construct(st *State, n nodes.Node) (nodes.Node, error) { - first, err := op.numLevel.Construct(st, n) - if err != nil || first == nil { - return n, err + if nd == nil { + if len(idents) == 0 { + idents = append(idents, uast.Identifier{Name: "."}) + } + } else { + path, ok := nd.(nodes.String) + if !ok { + return nil, ErrUnexpectedType.New(nodes.String(""), nd) + } + for _, name := range strings.Split(string(path), ".") { + idents = append(idents, uast.Identifier{Name: name}) + } } - firstVal := first.(nodes.Value) - prependVal := num2dots(firstVal, op.prefix) - - path, err := op.path.Construct(st, n) - if err != nil || path == nil { - return n, err + if len(idents) == 1 { + return uast.ToNode(idents[0]) } - return prependVal.(nodes.String) + path.(nodes.String), nil + return uast.ToNode(uast.QualifiedIdentifier{Names: idents}) } type OpLevelDotsNumConv struct { diff --git a/fixtures/bench_ethopian_multiplication.py.sem.uast b/fixtures/bench_ethopian_multiplication.py.sem.uast index d3761aea..57e39033 100644 --- a/fixtures/bench_ethopian_multiplication.py.sem.uast +++ b/fixtures/bench_ethopian_multiplication.py.sem.uast @@ -80,6 +80,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "itertools", }, Target: ~, diff --git a/fixtures/bench_javaobs.py.sem.uast b/fixtures/bench_javaobs.py.sem.uast index 3653203e..0eea2157 100644 --- a/fixtures/bench_javaobs.py.sem.uast +++ b/fixtures/bench_javaobs.py.sem.uast @@ -201,14 +201,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "BytesIO", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "StringIO", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "StringIO", }, Target: ~, @@ -257,6 +263,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "io", }, Target: ~, diff --git a/fixtures/issue62.py.sem.uast b/fixtures/issue62.py.sem.uast index 913ed7d1..5bdf9133 100644 --- a/fixtures/issue62.py.sem.uast +++ b/fixtures/issue62.py.sem.uast @@ -25,6 +25,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "os", }, Target: ~, @@ -60,9 +62,13 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "np", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "numpy", }, }, diff --git a/fixtures/issue62_b.py.sem.uast b/fixtures/issue62_b.py.sem.uast index d9546e41..f07c333d 100644 --- a/fixtures/issue62_b.py.sem.uast +++ b/fixtures/issue62_b.py.sem.uast @@ -25,6 +25,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "collections", }, Target: ~, @@ -45,8 +47,21 @@ Name: "SIMPLE_IDENTIFIER", }, ], - Path: { '@type': "uast:Identifier", - Name: "ast2vec.bblfsh_roles", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "ast2vec", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "bblfsh_roles", + }, + ], }, Target: ~, }, @@ -66,8 +81,26 @@ Name: "Repo2Base", }, ], - Path: { '@type': "uast:Identifier", - Name: "ast2vec.repo2.base", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "ast2vec", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "repo2", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "base", + }, + ], }, Target: ~, }, diff --git a/fixtures/issue94.py.sem.uast b/fixtures/issue94.py.sem.uast index c4eb5ba5..17a86e72 100644 --- a/fixtures/issue94.py.sem.uast +++ b/fixtures/issue94.py.sem.uast @@ -30,10 +30,21 @@ }, All: false, Names: ~, - Path: { '@type': "uast:Identifier", + Path: { '@type': "uast:QualifiedIdentifier", '@pos': { '@type': "uast:Positions", }, - Name: "lib2.lib21", + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib2", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib21", + }, + ], }, Target: ~, }, @@ -51,9 +62,13 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib3_alias", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib3", }, }, @@ -81,6 +96,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib4", }, Target: ~, @@ -101,8 +118,21 @@ Name: "lib511", }, ], - Path: { '@type': "uast:Identifier", - Name: "lib5.lib51", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib5", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib51", + }, + ], }, Target: ~, }, @@ -125,14 +155,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib611", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib61", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib6", }, Target: ~, diff --git a/fixtures/issue96.py.sem.uast b/fixtures/issue96.py.sem.uast index c4eb5ba5..17a86e72 100644 --- a/fixtures/issue96.py.sem.uast +++ b/fixtures/issue96.py.sem.uast @@ -30,10 +30,21 @@ }, All: false, Names: ~, - Path: { '@type': "uast:Identifier", + Path: { '@type': "uast:QualifiedIdentifier", '@pos': { '@type': "uast:Positions", }, - Name: "lib2.lib21", + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib2", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib21", + }, + ], }, Target: ~, }, @@ -51,9 +62,13 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib3_alias", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib3", }, }, @@ -81,6 +96,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib4", }, Target: ~, @@ -101,8 +118,21 @@ Name: "lib511", }, ], - Path: { '@type': "uast:Identifier", - Name: "lib5.lib51", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib5", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "lib51", + }, + ], }, Target: ~, }, @@ -125,14 +155,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib611", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib61", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "lib6", }, Target: ~, diff --git a/fixtures/issue_server101.py.sem.uast b/fixtures/issue_server101.py.sem.uast index 4ecc4c07..d22c4e72 100644 --- a/fixtures/issue_server101.py.sem.uast +++ b/fixtures/issue_server101.py.sem.uast @@ -246,10 +246,21 @@ { '@type': "uast:RuntimeImport", All: false, Names: ~, - Path: { '@type': "uast:Identifier", + Path: { '@type': "uast:QualifiedIdentifier", '@pos': { '@type': "uast:Positions", }, - Name: "os.path", + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "os", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "path", + }, + ], }, Target: ~, }, @@ -275,8 +286,21 @@ }, All: true, Names: ~, - Path: { '@type': "uast:Identifier", - Name: "epydoc.apidoc", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "epydoc", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "apidoc", + }, + ], }, Target: ~, }, @@ -296,6 +320,8 @@ All: true, Names: ~, Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "types", }, Target: ~, @@ -322,6 +348,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "epydoc", }, Target: ~, @@ -336,8 +364,21 @@ }, All: true, Names: ~, - Path: { '@type': "uast:Identifier", - Name: "epydoc.util", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "epydoc", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "util", + }, + ], }, Target: ~, }, @@ -351,10 +392,21 @@ }, All: false, Names: ~, - Path: { '@type': "uast:Identifier", + Path: { '@type': "uast:QualifiedIdentifier", '@pos': { '@type': "uast:Positions", }, - Name: "epydoc.docparser", + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "epydoc", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "docparser", + }, + ], }, Target: ~, }, @@ -385,8 +437,21 @@ }, All: true, Names: ~, - Path: { '@type': "uast:Identifier", - Name: "epydoc.compat", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "epydoc", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "compat", + }, + ], }, Target: ~, }, @@ -54341,15 +54406,37 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "_ZopeInterfaceClass", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "InterfaceClass", }, }, ], - Path: { '@type': "uast:Identifier", - Name: "zope.interface.interface", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "zope", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "interface", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "interface", + }, + ], }, Target: ~, }, @@ -54480,14 +54567,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "_ExtensionClass", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "ExtensionClass", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "ExtensionClass", }, Target: ~, @@ -54834,14 +54927,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "_ZopeMethodType", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "PythonMethodType", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "ExtensionClass", }, Target: ~, @@ -54865,14 +54964,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "_ZopeCMethodType", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "ExtensionMethodType", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "ExtensionClass", }, Target: ~, diff --git a/fixtures/u2_import_module_alias.py.sem.uast b/fixtures/u2_import_module_alias.py.sem.uast index ff3affad..af213c96 100644 --- a/fixtures/u2_import_module_alias.py.sem.uast +++ b/fixtures/u2_import_module_alias.py.sem.uast @@ -17,9 +17,13 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "y", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "x", }, }, diff --git a/fixtures/u2_import_path.py.sem.uast b/fixtures/u2_import_path.py.sem.uast index 280876dd..683245e7 100644 --- a/fixtures/u2_import_path.py.sem.uast +++ b/fixtures/u2_import_path.py.sem.uast @@ -107,6 +107,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "c", }, Target: ~, diff --git a/fixtures/u2_import_relativepath.py.sem.uast b/fixtures/u2_import_relativepath.py.sem.uast index fb6c24bd..d5938427 100644 --- a/fixtures/u2_import_relativepath.py.sem.uast +++ b/fixtures/u2_import_relativepath.py.sem.uast @@ -24,8 +24,21 @@ Name: "b", }, ], - Path: { '@type': "uast:Identifier", - Name: "../a", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "..", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "a", + }, + ], }, Target: ~, }, @@ -45,8 +58,31 @@ Name: "e", }, ], - Path: { '@type': "uast:Identifier", - Name: "../../c.d", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "..", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "..", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "c", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "d", + }, + ], }, Target: ~, }, @@ -66,8 +102,26 @@ Name: "f", }, ], - Path: { '@type': "uast:Identifier", - Name: ~, + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "..", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "..", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "..", + }, + ], }, Target: ~, }, diff --git a/fixtures/u2_import_rename.py.sem.uast b/fixtures/u2_import_rename.py.sem.uast index c029601c..394907b6 100644 --- a/fixtures/u2_import_rename.py.sem.uast +++ b/fixtures/u2_import_rename.py.sem.uast @@ -17,9 +17,13 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "b", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "a", }, }, @@ -44,14 +48,20 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "f", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "e", }, }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "c", }, Target: ~, diff --git a/fixtures/u2_import_subsymbol.py.sem.uast b/fixtures/u2_import_subsymbol.py.sem.uast index 2485d946..c5a2f70b 100644 --- a/fixtures/u2_import_subsymbol.py.sem.uast +++ b/fixtures/u2_import_subsymbol.py.sem.uast @@ -13,10 +13,21 @@ }, All: false, Names: ~, - Path: { '@type': "uast:Identifier", + Path: { '@type': "uast:QualifiedIdentifier", '@pos': { '@type': "uast:Positions", }, - Name: "a.b", + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "a", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "b", + }, + ], }, Target: ~, }, @@ -42,6 +53,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "f", }, Target: ~, @@ -78,6 +91,8 @@ }, ], Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "h", }, Target: ~, diff --git a/fixtures/u2_import_subsymbol_alias.py.sem.uast b/fixtures/u2_import_subsymbol_alias.py.sem.uast index 78e608ee..9bb79d4a 100644 --- a/fixtures/u2_import_subsymbol_alias.py.sem.uast +++ b/fixtures/u2_import_subsymbol_alias.py.sem.uast @@ -17,10 +17,25 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "z", }, - Node: { '@type': "uast:Identifier", - Name: "x.y", + Node: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "x", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "y", + }, + ], }, }, Target: ~, @@ -39,15 +54,32 @@ '@pos': { '@type': "uast:Positions", }, Name: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "d", }, Node: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "c", }, }, ], - Path: { '@type': "uast:Identifier", - Name: "a.b", + Path: { '@type': "uast:QualifiedIdentifier", + '@pos': { '@type': "uast:Positions", + }, + Names: [ + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "a", + }, + { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, + Name: "b", + }, + ], }, Target: ~, }, diff --git a/fixtures/u2_import_subsymbols_namespaced.py.sem.uast b/fixtures/u2_import_subsymbols_namespaced.py.sem.uast index b72db6fa..95ddd026 100644 --- a/fixtures/u2_import_subsymbols_namespaced.py.sem.uast +++ b/fixtures/u2_import_subsymbols_namespaced.py.sem.uast @@ -19,6 +19,8 @@ All: true, Names: ~, Path: { '@type': "uast:Identifier", + '@pos': { '@type': "uast:Positions", + }, Name: "a", }, Target: ~,