feat: update YJSCompiler

compile getGlobal in all contracts
This commit is contained in:
Frank.R.Wu 2022-03-22 16:37:36 +08:00
parent ad8de7a92c
commit c077d425ab

View File

@ -163,13 +163,14 @@ public class YJSCompiler {
czb.put(preSubConName + ".yjs", preSubNode); czb.put(preSubConName + ".yjs", preSubNode);
LOGGER.info("--compile-- " + preSubConName); LOGGER.info("--compile-- " + preSubConName);
String setGlobalName = cm.main.substring(0, cm.main.length() - 4) + "SetGlobal"; String globalBeanName = cm.main.substring(0, cm.main.length() - 4) + "GlobalBean";
String setGlobalContract = String globalBeanContract =
"contract " + setGlobalName + "{ function setGlobal (_global) { Global = _global; }}"; "contract " + globalBeanName + "{ function setGlobal (_global) { Global = _global; }\n" +
czb.put(setGlobalName + ".yjs", " function getGlobal () { return Global; }}";
compile(new ByteArrayInputStream(setGlobalContract.getBytes(StandardCharsets.UTF_8)), czb.put(globalBeanName + ".yjs",
setGlobalName + ".yjs")); compile(new ByteArrayInputStream(globalBeanContract.getBytes(StandardCharsets.UTF_8)),
LOGGER.info("--compile-- " + setGlobalName); globalBeanName + ".yjs"));
LOGGER.info("--compile-- " + globalBeanName);
return czb; return czb;
} }