Skip to content

Commit

Permalink
patch modfile meta data addition (#24)
Browse files Browse the repository at this point in the history
1. Updated node type information
2. Ignored .ast folder
  • Loading branch information
pandurangpatil authored Jun 28, 2023
1 parent 7e6f5d1 commit d944c7c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ dist
.DS_Store
.vscode
.idea
.ast

*.h
*.lib
*.so
*.dylib
*.dylib
10 changes: 6 additions & 4 deletions goastgen/libgoastgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,23 @@ func ParseModFromFile(file string) (string, error) {
}
objMap["node_filename"] = file
module := make(map[string]interface{})
module["name"] = modFile.Module.Mod.Path
module["Name"] = modFile.Module.Mod.Path
module["node_line_no"] = modFile.Module.Syntax.Start.Line
module["node_col_no"] = modFile.Module.Syntax.Start.LineRune
module["node_line_no_end"] = modFile.Module.Syntax.End.Line
module["node_col_no_end"] = modFile.Module.Syntax.End.LineRune
objMap["module"] = module
module["node_type"] = "mod.Module"
objMap["Module"] = module
dependencies := []interface{}{}
for _, req := range modFile.Require {
node := make(map[string]interface{})
node["module"] = req.Mod.Path
node["version"] = req.Mod.Version
node["Module"] = req.Mod.Path
node["Version"] = req.Mod.Version
node["node_line_no"] = req.Syntax.Start.Line
node["node_col_no"] = req.Syntax.Start.LineRune
node["node_line_no_end"] = req.Syntax.End.Line
node["node_col_no_end"] = req.Syntax.End.LineRune
node["node_type"] = "mod.Dependency"
dependencies = append(dependencies, node)
}
objMap["dependencies"] = dependencies
Expand Down

0 comments on commit d944c7c

Please sign in to comment.