From 583a45ff154b8709dae31e9a4dfbe46256d424ac Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 18 May 2015 15:15:20 +0200 Subject: [PATCH] Function hashes and new compiler version. --- index.html | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index 45960ac2fc..1a951a6e82 100644 --- a/index.html +++ b/index.html @@ -56,7 +56,7 @@ body { Source code on the left, compiled code and AST on the right (or error).
Note: Chrome/Chromium currently reports "Uncaught JavaScript Exception". To work around this problem, enable the debug console (Ctrl+Shift+i) and reload.
-Version: 0d48ad... 2015-04-22 +Version: dea8d55f... 2015-05-18
@@ -179,8 +179,7 @@ var renderContracts = function(data, source) { .append(tableRow('Bytecode', contract.bytecode)) .append(tableRow('Interface', contract['interface'])) .append(tableRow('Solidity Interface', contract.solidity_interface)) - .append(tableRow('Opcodes', contract.opcodes)) - .append(formatAssembly(contract.assembly, source)); + .append(getDetails(contract, source)); $('#output').append(contractOutput); } }; @@ -189,11 +188,20 @@ var tableRow = function(description, data) { .append($('').text(description)) .append($('').val(data)); }; -var formatAssembly = function(asm, source) { - var button = $(''); - var text = $('
').text(formatAssemblyText(asm, '', source));
-    button.click(function() { text.toggle(); });
-    return $('
').append(button).append(text); +var getDetails = function(contract, source) { + var button = $(''); + var details = $('
') + .append(tableRow('Opcodes', contract.opcodes)); + var funHashes = ''; + for (var fun in contract.functionHashes) + funHashes += contract.functionHashes[fun] + ' ' + fun + '\n'; + details.append($('Functions')); + details.append($('
').text(funHashes));
+    details.append($('Assembly'));
+    var assembly = $('
').text(formatAssemblyText(contract.assembly, '', source));
+    details.append(assembly);
+    button.click(function() { details.toggle(); });
+    return $('
').append(button).append(details); }; var formatAssemblyText = function(asm, prefix, source) { var text = ''; @@ -203,7 +211,11 @@ var formatAssemblyText = function(asm, prefix, source) { var src = ''; if (item.begin !== undefined && item.end != undefined) src = source.slice(item.begin, item.end).replace('\n', '\\n', 'g'); - text += ' ' + prefix + item.name + ' ' + v + '\t\t\t' + src + '\n'; + if (src.length > 30) + src = src.slice(0, 30) + '...'; + if (item.name != 'tag') + text += ' '; + text += prefix + item.name + ' ' + v + '\t\t\t' + src + '\n'; }); text += prefix + '.data\n'; if (asm['.data'])