feat: support fork annotation

This commit is contained in:
CaiHQ 2023-08-23 16:00:47 +08:00
parent bb71895f6e
commit be4d25d260
2 changed files with 11 additions and 8 deletions

View File

@ -254,7 +254,7 @@ public class ContractNode {
packSourceFunctionAndDependentFunctions(getFunction(routeInfo.funcName),
dependentFunctions);
methodRouteInfoMap.add(doipOperationInfo.operationName,
JsonUtil.parseObjectAsJsonObject(routeInfo));
JsonUtil.parseObjectAsJsonObject(routeInfo));
}
if (joinInfo != null) {
packSourceFunctionAndDependentFunctions(getFunction(joinInfo.joinCountFuncName),
@ -299,7 +299,7 @@ public class ContractNode {
packSourceFunctionAndDependentFunctions(getFunction(forkInfo.funcName),
dependentFunctions);
methodForkInfoMap.add(doipOperationInfo.operationName,
JsonUtil.parseObjectAsJsonObject(routeInfo));
JsonUtil.parseObjectAsJsonObject(forkInfo));
}
}
}
@ -333,9 +333,9 @@ public class ContractNode {
}
functionNode.annotations.addAll(node.annotations);
} else {
//now we accept only interfaces.
//just ignore!
// throw new RuntimeException("unimplemented functions:" + node.functionName);
// now we accept only interfaces.
// just ignore!
// throw new RuntimeException("unimplemented functions:" + node.functionName);
}
}

View File

@ -24,12 +24,15 @@ public class FunctionDependencyVisitor extends YJSParserBaseVisitor<FunctionNode
public FunctionNode visitArgumentsExpression(YJSParser.ArgumentsExpressionContext ctx) {
super.visitArgumentsExpression(ctx);
String funText = ctx.singleExpression().getText();
if (funText.endsWith(APPLY)) funText = funText.replaceAll(APPLY + "$", "");
if (funText.endsWith(CALL)) funText = funText.replaceAll(CALL + "$", "");
if (funText.endsWith(APPLY))
funText = funText.replaceAll(APPLY + "$", "");
if (funText.endsWith(CALL))
funText = funText.replaceAll(CALL + "$", "");
if (cn.getFunction(funText) != null)
fn.addDependentFunctions(funText);
if (ctx.arguments() != null) {
List<YJSParser.SingleExpressionContext> singleExpress = ctx.arguments().singleExpression();
List<YJSParser.SingleExpressionContext> singleExpress =
ctx.arguments().singleExpression();
if (singleExpress != null && singleExpress.size() > 0) {
for (YJSParser.SingleExpressionContext sin : singleExpress) {
funText = sin.getText();