feat: sharable var integration

This commit is contained in:
Xuxin Wang 2023-06-25 16:42:54 +08:00
parent 3bf508b088
commit 5598a2ba8c
2 changed files with 4 additions and 2 deletions

View File

@ -122,7 +122,8 @@ public class ContractReader extends YJSParserBaseVisitor<ContractNode> {
SharableDeclarationContext sharableCtx = clzOrFunction.sharableDeclaration(); SharableDeclarationContext sharableCtx = clzOrFunction.sharableDeclaration();
sharableCtx.sharableStatement().variableDeclarationList(); sharableCtx.sharableStatement().variableDeclarationList();
SharableReader reader = new SharableReader(fileName); SharableReader reader = new SharableReader(fileName);
SharableNode sharable = reader.visitVariableDeclarationList(sharableCtx.sharableStatement().variableDeclarationList()); SharableNode sharable = reader.visitVariableDeclarationList(
sharableCtx.sharableStatement().variableDeclarationList());
node.addSharable(sharable); node.addSharable(sharable);
} }
} }

View File

@ -18,7 +18,8 @@ public class SharableReader extends YJSParserBaseVisitor<SharableNode> {
public SharableNode visitVariableDeclarationList(YJSParser.VariableDeclarationListContext ctx) { public SharableNode visitVariableDeclarationList(YJSParser.VariableDeclarationListContext ctx) {
SharableNode sharableNode = new SharableNode(); SharableNode sharableNode = new SharableNode();
List<String> statements = new ArrayList<>(); List<String> statements = new ArrayList<>();
for (YJSParser.VariableDeclarationContext variableDeclarationContext : ctx.variableDeclaration()) { for (YJSParser.VariableDeclarationContext variableDeclarationContext : ctx
.variableDeclaration()) {
statements.add(variableDeclarationContext.getText()); statements.add(variableDeclarationContext.getText());
} }
sharableNode.setVariableStatements(statements); sharableNode.setVariableStatements(statements);