feat: update YJSCompiler

compile setGlobal in all contracts
This commit is contained in:
Frank.R.Wu 2022-03-22 16:27:50 +08:00
parent 639d8dc6cb
commit ad8de7a92c

View File

@ -120,7 +120,7 @@ public class YJSCompiler {
// 如果没有就不限制根据gas进行插装
if (0L != cm.getInsnLimit()) {
System.out.println("++++++++++++++++++++++true");
LOGGER.info("++++++++++++++++++++++true");
}
czb.setManifest(cm);
Set<String> toParse = new HashSet<>();
@ -162,6 +162,15 @@ public class YJSCompiler {
preSubConName + ".yjs");
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);
return czb;
}