diff --git a/pom.xml b/pom.xml
index a77dac3..d7867b5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,8 +9,9 @@
1.0-SNAPSHOT
UTF-8
+ true
+ true
-
diff --git a/src/main/java/depends/extractor/cpp/CppEntitiesListener.java b/src/main/java/depends/extractor/cpp/CppEntitiesListener.java
index 91c896d..94eac80 100644
--- a/src/main/java/depends/extractor/cpp/CppEntitiesListener.java
+++ b/src/main/java/depends/extractor/cpp/CppEntitiesListener.java
@@ -40,47 +40,12 @@ public class CppEntitiesListener extends CPP14BaseListener {
}
@Override
public void enterFunctiondefinition(FunctiondefinitionContext ctx) {
-// String functionName = "";
-// if (ctx.declarator().ptrdeclarator()!=null) {
-// if (ctx.declarator().ptrdeclarator().noptrdeclarator()!=null) {
-// functionName = getFunctionName(ctx.declarator().ptrdeclarator().noptrdeclarator());
-// }
-// }
-// if (ctx.declarator().noptrdeclarator()!=null) {
-// functionName = getFunctionName(ctx.declarator().ptrdeclarator().noptrdeclarator());
-// }
-// Collection parameters = new ArrayList<>();
-// String returnType = "void";
-// List throwedType = new ArrayList<>();
-// context.foundMethodDeclarator(functionName,
-// parameters, returnType, throwedType);
-
+ FunctiondefinitionContextHelper helper = new FunctiondefinitionContextHelper(ctx);
+ context.foundMethodDeclarator(helper.getFunctionName(),
+ helper.getParameters(),helper.getReturnType(), helper.getThrowedType());
super.enterFunctiondefinition(ctx);
}
- @Override
- public void enterDeclaratorid(DeclaratoridContext ctx) {
- IdexpressionContext id = ctx.idexpression();
- if (id.unqualifiedid()!=null) {
- Collection parameters = new ArrayList<>();
- String returnType = "void";
- List throwedType = new ArrayList<>();
- context.foundMethodDeclarator(id.unqualifiedid().Identifier().getText(),
- parameters, returnType, throwedType);
- }
- super.enterDeclaratorid(ctx);
- }
- private String getFunctionName(NoptrdeclaratorContext ctx) {
- System.out.println(ctx.getText());
- if (ctx.declaratorid()!=null) {
- IdexpressionContext id = ctx.declaratorid().idexpression();
- if (id.unqualifiedid()!=null) {
-
- return id.unqualifiedid().Identifier().getText();
- }
- }
- return "";
- }
@Override
public void exitFunctiondefinition(FunctiondefinitionContext ctx) {
context.exitLastedEntity();
diff --git a/src/test/java/depends/extractor/cpp/CppParameterParserTest.java b/src/test/java/depends/extractor/cpp/CppParameterParserTest.java
index b7646cc..e27413f 100644
--- a/src/test/java/depends/extractor/cpp/CppParameterParserTest.java
+++ b/src/test/java/depends/extractor/cpp/CppParameterParserTest.java
@@ -15,7 +15,7 @@ public class CppParameterParserTest {
CppFileParser parser = new CppFileParser(src,repo);
parser.parse();
repo.resolveAllBindings();
- //assertEquals(4,repo.getEntity("FunctionParameters.function_with_parameters_same_type").getRelations().size());
+ assertEquals(4,repo.getEntity("FunctionParameters.function_with_parameters_same_type").getRelations().size());
}
}