From d944c7ca3cf9c0cdbea1c019012b335450b5f641 Mon Sep 17 00:00:00 2001 From: Pandurang Patil Date: Wed, 28 Jun 2023 12:08:17 +0530 Subject: [PATCH] patch modfile meta data addition (#24) 1. Updated node type information 2. Ignored .ast folder --- .gitignore | 3 ++- goastgen/libgoastgen.go | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 556e1d5..67eecdf 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,9 @@ dist .DS_Store .vscode .idea +.ast *.h *.lib *.so -*.dylib \ No newline at end of file +*.dylib diff --git a/goastgen/libgoastgen.go b/goastgen/libgoastgen.go index 4b09cdb..d5900a6 100644 --- a/goastgen/libgoastgen.go +++ b/goastgen/libgoastgen.go @@ -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