From b9decda1d7a33aae48845e87e1ab74a34cea7fa1 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 10 Jan 2017 13:43:09 +0100 Subject: [PATCH] es6 class function --- src/solidity/types/Enum.js | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/solidity/types/Enum.js b/src/solidity/types/Enum.js index 8928d9cb18..3673f4a371 100644 --- a/src/solidity/types/Enum.js +++ b/src/solidity/types/Enum.js @@ -13,30 +13,30 @@ class Enum extends ValueType { super(1, storageBytes, 'enum') this.enumDef = enumDef } -} -Enum.prototype.decodeFromStorage = function (location, storageContent) { - var value = util.extractHexValue(location, storageContent, this.storageBytes) - value = parseInt(value, 16) - return output(value, this.enumDef) -} + decodeFromStorage (location, storageContent) { + var value = util.extractHexValue(location, storageContent, this.storageBytes) + value = parseInt(value, 16) + return output(value, this.enumDef) + } -Enum.prototype.decodeFromStack = function (stackDepth, stack, memory) { - var defaultValue = 0 - if (stack.length - 1 < stackDepth) { - defaultValue = 0 - } else { - defaultValue = util.extractHexByteSlice(stack[stack.length - 1 - stackDepth], this.storageBytes, 0) - defaultValue = parseInt(defaultValue, 16) + decodeFromStack (stackDepth, stack, memory) { + var defaultValue = 0 + if (stack.length - 1 < stackDepth) { + defaultValue = 0 + } else { + defaultValue = util.extractHexByteSlice(stack[stack.length - 1 - stackDepth], this.storageBytes, 0) + defaultValue = parseInt(defaultValue, 16) + } + return output(defaultValue, this.enumDef) } - return output(defaultValue, this.enumDef) -} -Enum.prototype.decodeFromMemory = function (offset, memory) { - var value = memory.substr(offset, 64) - value = util.extractHexByteSlice(value, this.storageBytes, 0) - value = parseInt(value, 16) - return output(value, this.enumDef) + decodeFromMemory (offset, memory) { + var value = memory.substr(offset, 64) + value = util.extractHexByteSlice(value, this.storageBytes, 0) + value = parseInt(value, 16) + return output(value, this.enumDef) + } } function output (value, enumDef) {