diff --git a/src/main/java/org/bdware/sc/compiler/YJSCompiler.java b/src/main/java/org/bdware/sc/compiler/YJSCompiler.java index a7daebd..82c203b 100644 --- a/src/main/java/org/bdware/sc/compiler/YJSCompiler.java +++ b/src/main/java/org/bdware/sc/compiler/YJSCompiler.java @@ -163,13 +163,14 @@ public class YJSCompiler { czb.put(preSubConName + ".yjs", preSubNode); LOGGER.info("--compile-- " + preSubConName); - String setGlobalName = cm.main.substring(0, cm.main.length() - 4) + "SetGlobal"; - String setGlobalContract = - "contract " + setGlobalName + "{ function setGlobal (_global) { Global = _global; }}"; - czb.put(setGlobalName + ".yjs", - compile(new ByteArrayInputStream(setGlobalContract.getBytes(StandardCharsets.UTF_8)), - setGlobalName + ".yjs")); - LOGGER.info("--compile-- " + setGlobalName); + String globalBeanName = cm.main.substring(0, cm.main.length() - 4) + "GlobalBean"; + String globalBeanContract = + "contract " + globalBeanName + "{ function setGlobal (_global) { Global = _global; }\n" + + " function getGlobal () { return Global; }}"; + czb.put(globalBeanName + ".yjs", + compile(new ByteArrayInputStream(globalBeanContract.getBytes(StandardCharsets.UTF_8)), + globalBeanName + ".yjs")); + LOGGER.info("--compile-- " + globalBeanName); return czb; }