From 7dcae55b8bf1e4afacf7e3644f2b1735c7a88e9e Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Fri, 23 Mar 2018 08:28:42 -0400 Subject: [PATCH] Added events to graph and fixed problems in IDE --- lib/cmds/graph.js | 21 +++++++++++++-------- lib/index.js | 5 ----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/cmds/graph.js b/lib/cmds/graph.js index b9dfcb4c..073ddd6c 100644 --- a/lib/cmds/graph.js +++ b/lib/cmds/graph.js @@ -33,15 +33,22 @@ class GraphGenerator { for(let i = 0; i < this.engine.contractsManager.contracts[contract].abiDefinition.length; i++){ switch(this.engine.contractsManager.contracts[contract].abiDefinition[i].type){ case 'fallback': - contractLabel += "«fallback»()" + '\\l'; + contractLabel += "«fallback»()\\l"; break; - case 'constructor': + case 'constructor': contractLabel += "«constructor»("; for(let j = 0; j < this.engine.contractsManager.contracts[contract].abiDefinition[i].inputs.length; j++){ contractLabel += (j == 0 ? "" : ", ") + this.engine.contractsManager.contracts[contract].abiDefinition[i].inputs[j].type; } contractLabel += ")\\l"; break; + case 'event': + contractLabel += "«event»" + this.engine.contractsManager.contracts[contract].abiDefinition[i].name + "("; + for(let j = 0; j < this.engine.contractsManager.contracts[contract].abiDefinition[i].inputs.length; j++){ + contractLabel += (j == 0 ? "" : ", ") + this.engine.contractsManager.contracts[contract].abiDefinition[i].inputs[j].type; + } + contractLabel += ")\\l"; + break; default: break; } } @@ -54,23 +61,21 @@ class GraphGenerator { } - contractString += `${id}[label = "{${contractLabel}}"]` - contractString += "\n"; + contractString += `${id}[label = "{${contractLabel}}"]\n`; + } for (let c in this.engine.contractsManager.contractDependencies){ let contractDependencies = Array.from(new Set(this.engine.contractsManager.contractDependencies[c])); contractDependencies.forEach(function(d){ if(idMapping[c] !== undefined && idMapping[d] !== undefined){ - relationshipString += `${idMapping[d]}->${idMapping[c]}[constraint=true, arrowtail=diamond]` - relationshipString += "\n"; + relationshipString += `${idMapping[d]}->${idMapping[c]}[constraint=true, arrowtail=diamond]\n`; } }); } for (let c in contractInheritance){ - relationshipString += `${idMapping[contractInheritance[c]]}->${idMapping[c]}` - relationshipString += "\n"; + relationshipString += `${idMapping[contractInheritance[c]]}->${idMapping[c]}\n`; } diff --git a/lib/index.js b/lib/index.js index d31decd9..42315373 100644 --- a/lib/index.js +++ b/lib/index.js @@ -186,11 +186,6 @@ class Embark { } graph(options) { - - - - let self = this; - options.onlyCompile = true; let engine = new Engine({