mirror of
https://gitee.com/BDWare/common
synced 2025-01-10 01:44:16 +00:00
fix: fix syntax error in compiling functions
fix syntax error in DesktopEngine.compileFunction
This commit is contained in:
parent
24123435be
commit
5ed245459c
@ -62,11 +62,7 @@ public class ContractNode {
|
|||||||
cn.initText(cts);
|
cn.initText(cts);
|
||||||
}
|
}
|
||||||
for (FunctionNode fun : functions) {
|
for (FunctionNode fun : functions) {
|
||||||
if (fun.isExport) {
|
fun.initTextWithCleaning(cts, fun.isExport, fun.isView());
|
||||||
fun.initTextWithoutExport(cts);
|
|
||||||
} else {
|
|
||||||
fun.initText(cts);
|
|
||||||
}
|
|
||||||
if (fun.isExport || fun.functionName.equals("onCreate")) {
|
if (fun.isExport || fun.functionName.equals("onCreate")) {
|
||||||
fun.initTextWithRequester();
|
fun.initTextWithRequester();
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,16 @@ public class Script {
|
|||||||
|
|
||||||
public void initText(CommonTokenStream cts) {
|
public void initText(CommonTokenStream cts) {
|
||||||
plainText = cts.getText(interval);
|
plainText = cts.getText(interval);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initTextWithoutExport(CommonTokenStream cts) {
|
public void initTextWithCleaning(CommonTokenStream cts, boolean isExported, boolean isView) {
|
||||||
plainText = cts.getText(interval).replaceFirst("export", "");
|
String plainText = cts.getText(interval);
|
||||||
|
if (isExported) {
|
||||||
|
plainText = plainText.replaceFirst("exported", "");
|
||||||
|
}
|
||||||
|
if (isView) {
|
||||||
|
plainText = plainText.replaceFirst("\\)\\s?view\\s?\\{", "){");
|
||||||
|
}
|
||||||
|
this.plainText = plainText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ public class FunctionReader extends YJSParserBaseVisitor<FunctionNode> {
|
|||||||
node.setInterval(
|
node.setInterval(
|
||||||
new Interval(ctx.Function().getSourceInterval().a, ctx.getSourceInterval().b));
|
new Interval(ctx.Function().getSourceInterval().a, ctx.getSourceInterval().b));
|
||||||
|
|
||||||
|
|
||||||
List<AnnotationContext> annotations = new ArrayList<>();
|
List<AnnotationContext> annotations = new ArrayList<>();
|
||||||
if (null != ctx.annotations()) {
|
if (null != ctx.annotations()) {
|
||||||
annotations = ctx.annotations().annotation();
|
annotations = ctx.annotations().annotation();
|
||||||
|
Loading…
Reference in New Issue
Block a user