From e3018f09db408131cdb41940fb93d654d92ef561 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 28 Feb 2022 10:26:59 +0100 Subject: [PATCH] add function type --- libs/remix-debug/src/solidity-decoder/decodeInfo.ts | 8 +++++++- .../src/solidity-decoder/types/FunctionType.ts | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 libs/remix-debug/src/solidity-decoder/types/FunctionType.ts diff --git a/libs/remix-debug/src/solidity-decoder/decodeInfo.ts b/libs/remix-debug/src/solidity-decoder/decodeInfo.ts index 44c620615a..f141a7e1f9 100644 --- a/libs/remix-debug/src/solidity-decoder/decodeInfo.ts +++ b/libs/remix-debug/src/solidity-decoder/decodeInfo.ts @@ -11,6 +11,7 @@ import { Struct as StructType } from './types/Struct' import { Int as IntType } from './types/Int' import { Uint as UintType } from './types/Uint' import { Mapping as MappingType } from './types/Mapping' +import { FunctionType } from './types/FunctionType' import { extractLocation, removeLocation } from './types/util' /** @@ -78,6 +79,10 @@ function bool (type) { return new BoolType() } +function functionType (type, stateDefinitions, contractName, location) { + return new FunctionType(type, stateDefinitions, contractName, location) +} + /** * DynamicByteArray decode the given @arg type * @@ -300,7 +305,8 @@ function parseType (type, stateDefinitions, contractName, location) { struct: struct, int: int, uint: uint, - mapping: mapping + mapping: mapping, + function: functionType } const currentType = typeClass(type) if (currentType === null) { diff --git a/libs/remix-debug/src/solidity-decoder/types/FunctionType.ts b/libs/remix-debug/src/solidity-decoder/types/FunctionType.ts new file mode 100644 index 0000000000..765edcf980 --- /dev/null +++ b/libs/remix-debug/src/solidity-decoder/types/FunctionType.ts @@ -0,0 +1,12 @@ +'use strict' +import { ValueType } from './ValueType' + +export class FunctionType extends ValueType { + constructor (type, stateDefinitions, contractName, location) { + super(1, 8, 'function') + } + + decodeValue (value) { + return value + } +}