Skip to content

Commit

Permalink
parser: fix for unsafe pointer dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
kucjac committed Nov 23, 2021
1 parent c1c68c3 commit a17433f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions parser/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func (r *rootPackage) extractAliasExpr(expr ast.Expr) (types.Type, error) {
if tp, ok := types.GetBuiltInType(x.Name); ok {
return tp, nil
}
if r.refPkg.Path == "unsafe" && x.Name == "Pointer" {
return types.UnsafePointer, nil
}
tp, ok := r.refPkg.GetType(x.Name)
if !ok {
return nil, fmt.Errorf("ident: '%s' not found in the package: '%s'", x.Name, r.refPkg.Path)
Expand Down
3 changes: 3 additions & 0 deletions parser/load-packages.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ func (r *rootPackage) parseTypePkg(initWg, fg *sync.WaitGroup) {
continue
}

if _, ok := tt.(*types.Alias); ok {
continue
}
if ok := r.finishNamedType(t, tt); !ok {
if r.loadConfig.Verbose {
fmt.Printf("package: %s, type: %s not mapped\n", p.Path, t.Obj().Name())
Expand Down

0 comments on commit a17433f

Please sign in to comment.