add missing code init

This commit is contained in:
Iuri Matias 2018-05-28 11:42:22 -04:00
parent ee460e3309
commit ef3bde1053
2 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,7 @@ class CodeGenerator {
this.contractsConfig = options.contractsConfig || {};
this.storageConfig = options.storageConfig || {};
this.communicationConfig = options.communicationConfig || {};
this.namesystemConfig = options.namesystemConfig || {};
// TODO: this should also be removed and use events instead
this.contractsManager = options.contractsManager;
this.plugins = options.plugins;
@ -224,6 +225,17 @@ class CodeGenerator {
return block;
}
generateNamesInitialization(useEmbarkJS) {
if (!useEmbarkJS || this.namesystemConfig === {}) return "";
let result = "\n";
result += Templates.define_when_env_loaded();
result += this._getInitCode('names', this.namesystemConfig);
return result;
}
generateStorageInitialization(useEmbarkJS) {
if (!useEmbarkJS || this.storageConfig === {}) return "";
@ -266,6 +278,7 @@ class CodeGenerator {
result += this.generateContracts(options.useEmbarkJS, options.deployment, true);
result += this.generateStorageInitialization(options.useEmbarkJS);
result += this.generateCommunicationInitialization(options.useEmbarkJS);
result += this.generateNamesInitialization(options.useEmbarkJS);
return result;
}
@ -331,6 +344,7 @@ class CodeGenerator {
code += self.generateCommunicationInitialization(true);
code += self.generateStorageInitialization(true);
code += self.generateNamesInitialization(true);
next();
},
function writeFile(next) {

View File

@ -173,6 +173,7 @@ class Engine {
contractsManager: this.contractsManager,
plugins: self.plugins,
storageConfig: self.config.storageConfig,
namesystemConfig: self.config.namesystemConfig,
communicationConfig: self.config.communicationConfig,
events: self.events
});