未验证 提交 52ebfa9d 编写于 作者: P Phodal Huang

feat: try to add parameters

上级 e1098890
package call
package main
import (
"encoding/json"
......
package call
package main
import (
"fmt"
"github.com/antlr/antlr4/runtime/Go/antlr"
. "github.com/phodal/coca/bs/models"
. "github.com/phodal/coca/language/java"
......@@ -67,7 +68,7 @@ func (s *BadSmellListener) EnterInterfaceMethodDeclaration(ctx *InterfaceMethodD
var params []JFullParameter = nil
parameters := ctx.FormalParameters()
if parameters != nil {
fmt.Println(parameters.GetChild(2).(antlr.ParseTree).GetText())
}
method := &JFullMethod{
......@@ -113,7 +114,9 @@ func (s *BadSmellListener) EnterMethodDeclaration(ctx *MethodDeclarationContext)
parameters := ctx.FormalParameters()
if parameters != nil {
//parameters.GetBaseRuleContext().(antlr.BaseParserRuleContext).(FormalParameterListContext)
//context := parameters.GetBaseRuleContext()
//fmt.Println(parameters.GetChild(1).(antlr.RuleNode).GetText())
}
method := &JFullMethod{
......@@ -129,6 +132,11 @@ func (s *BadSmellListener) EnterMethodDeclaration(ctx *MethodDeclarationContext)
methods = append(methods, *method)
}
func (s *BadSmellListener) EnterFormalParameterList(ctx *FormalParameterListContext) {
//fmt.Println(ctx.GetParent().GetParent().(antlr.RuleNode).get)
//fmt.Println(ctx.AllFormalParameter()
}
func (s *BadSmellListener) EnterMethodCall(ctx *MethodCallContext) {
var targetCtx = ctx.GetParent().GetChild(0).(antlr.ParseTree).GetText()
var targetType = parseTargetType(targetCtx)
......
package main
import (
"encoding/json"
. "github.com/phodal/coca/utils"
)
func main() {
bsApp := new(BadSmellApp)
bsList := bsApp.AnalysisPath("examples")
bsModel, _ := json.MarshalIndent(bsList, "", "\t")
WriteToFile("bs.json", string(bsModel))
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册