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

@ -299,7 +299,7 @@ public class ContractNode {
packSourceFunctionAndDependentFunctions(getFunction(forkInfo.funcName), packSourceFunctionAndDependentFunctions(getFunction(forkInfo.funcName),
dependentFunctions); dependentFunctions);
methodForkInfoMap.add(doipOperationInfo.operationName, methodForkInfoMap.add(doipOperationInfo.operationName,
JsonUtil.parseObjectAsJsonObject(routeInfo)); JsonUtil.parseObjectAsJsonObject(forkInfo));
} }
} }
} }

View File

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