diff --git a/src/main/base/org/bdware/sc/node/ContractNode.java b/src/main/base/org/bdware/sc/node/ContractNode.java index dffe64d..ad302d8 100644 --- a/src/main/base/org/bdware/sc/node/ContractNode.java +++ b/src/main/base/org/bdware/sc/node/ContractNode.java @@ -62,11 +62,7 @@ public class ContractNode { cn.initText(cts); } for (FunctionNode fun : functions) { - if (fun.isExport) { - fun.initTextWithoutExport(cts); - } else { - fun.initText(cts); - } + fun.initTextWithCleaning(cts, fun.isExport, fun.isView()); if (fun.isExport || fun.functionName.equals("onCreate")) { fun.initTextWithRequester(); } diff --git a/src/main/base/org/bdware/sc/node/Script.java b/src/main/base/org/bdware/sc/node/Script.java index 62fe552..805349d 100644 --- a/src/main/base/org/bdware/sc/node/Script.java +++ b/src/main/base/org/bdware/sc/node/Script.java @@ -34,10 +34,16 @@ public class Script { public void initText(CommonTokenStream cts) { plainText = cts.getText(interval); - } - public void initTextWithoutExport(CommonTokenStream cts) { - plainText = cts.getText(interval).replaceFirst("export", ""); + public void initTextWithCleaning(CommonTokenStream cts, boolean isExported, boolean isView) { + String plainText = cts.getText(interval); + if (isExported) { + plainText = plainText.replaceFirst("exported", ""); + } + if (isView) { + plainText = plainText.replaceFirst("\\)\\s?view\\s?\\{", "){"); + } + this.plainText = plainText; } } diff --git a/src/main/base/org/bdware/sc/visitor/FunctionReader.java b/src/main/base/org/bdware/sc/visitor/FunctionReader.java index b7c047f..445a49d 100644 --- a/src/main/base/org/bdware/sc/visitor/FunctionReader.java +++ b/src/main/base/org/bdware/sc/visitor/FunctionReader.java @@ -57,7 +57,6 @@ public class FunctionReader extends YJSParserBaseVisitor { node.setInterval( new Interval(ctx.Function().getSourceInterval().a, ctx.getSourceInterval().b)); - List annotations = new ArrayList<>(); if (null != ctx.annotations()) { annotations = ctx.annotations().annotation();