From 2ead3f469e63523347d9f6b606374f68dd6ad663 Mon Sep 17 00:00:00 2001 From: hrkrshnn Date: Mon, 13 Sep 2021 11:47:32 +0200 Subject: [PATCH] Added a user defined type mapping into the ASTJSON test. --- .../ASTJSON/userDefinedValueType.json | 86 +++++++++++++++++-- .../ASTJSON/userDefinedValueType.sol | 1 + .../userDefinedValueType_parseOnly.json | 56 +++++++++++- 3 files changed, 131 insertions(+), 12 deletions(-) diff --git a/test/libsolidity/ASTJSON/userDefinedValueType.json b/test/libsolidity/ASTJSON/userDefinedValueType.json index 09b81a4d4..f929122b1 100644 --- a/test/libsolidity/ASTJSON/userDefinedValueType.json +++ b/test/libsolidity/ASTJSON/userDefinedValueType.json @@ -4,7 +4,7 @@ { "C": [ - 21 + 27 ], "MyAddress": [ @@ -19,7 +19,7 @@ 16 ] }, - "id": 22, + "id": 28, "nodeType": "SourceUnit", "nodes": [ @@ -193,7 +193,7 @@ "parameters": [], "src": "61:0:1" }, - "scope": 22, + "scope": 28, "src": "48:47:1", "stateMutability": "nonpayable", "virtual": false, @@ -205,10 +205,10 @@ "contractDependencies": [], "contractKind": "contract", "fullyImplemented": true, - "id": 21, + "id": 27, "linearizedBaseContracts": [ - 21 + 27 ], "name": "C", "nameLocation": "105:1:1", @@ -253,12 +253,82 @@ "typeString": "uint256" } } + }, + { + "constant": false, + "functionSelector": "97682884", + "id": 26, + "mutability": "mutable", + "name": "m", + "nameLocation": "205:1:1", + "nodeType": "VariableDeclaration", + "scope": 27, + "src": "169:37:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_userDefinedValueType$_MyAddress_$18_$_t_userDefinedValueType$_MyUInt_$20_$", + "typeString": "mapping(user defined type MyAddress => user defined type MyUInt)" + }, + "typeName": + { + "id": 25, + "keyType": + { + "id": 22, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 21, + "name": "MyAddress", + "nodeType": "IdentifierPath", + "referencedDeclaration": 18, + "src": "177:9:1" + }, + "referencedDeclaration": 18, + "src": "177:9:1", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyAddress_$18", + "typeString": "user defined type MyAddress" + } + }, + "nodeType": "Mapping", + "src": "169:28:1", + "typeDescriptions": + { + "typeIdentifier": "t_mapping$_t_userDefinedValueType$_MyAddress_$18_$_t_userDefinedValueType$_MyUInt_$20_$", + "typeString": "mapping(user defined type MyAddress => user defined type MyUInt)" + }, + "valueType": + { + "id": 24, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 23, + "name": "MyUInt", + "nodeType": "IdentifierPath", + "referencedDeclaration": 20, + "src": "190:6:1" + }, + "referencedDeclaration": 20, + "src": "190:6:1", + "typeDescriptions": + { + "typeIdentifier": "t_userDefinedValueType$_MyUInt_$20", + "typeString": "user defined type MyUInt" + } + } + }, + "visibility": "public" } ], - "scope": 22, - "src": "96:70:1", + "scope": 28, + "src": "96:113:1", "usedErrors": [] } ], - "src": "0:167:1" + "src": "0:210:1" } diff --git a/test/libsolidity/ASTJSON/userDefinedValueType.sol b/test/libsolidity/ASTJSON/userDefinedValueType.sol index cc179b118..f1124f8cd 100644 --- a/test/libsolidity/ASTJSON/userDefinedValueType.sol +++ b/test/libsolidity/ASTJSON/userDefinedValueType.sol @@ -7,6 +7,7 @@ function f() { contract C { type MyAddress is address; type MyUInt is uint; + mapping(MyAddress => MyUInt) public m; } // ---- diff --git a/test/libsolidity/ASTJSON/userDefinedValueType_parseOnly.json b/test/libsolidity/ASTJSON/userDefinedValueType_parseOnly.json index 1dd4b0edd..36315b443 100644 --- a/test/libsolidity/ASTJSON/userDefinedValueType_parseOnly.json +++ b/test/libsolidity/ASTJSON/userDefinedValueType_parseOnly.json @@ -1,6 +1,6 @@ { "absolutePath": "a", - "id": 22, + "id": 28, "nodeType": "SourceUnit", "nodes": [ @@ -154,7 +154,7 @@ "baseContracts": [], "contractDependencies": [], "contractKind": "contract", - "id": 21, + "id": 27, "name": "C", "nameLocation": "105:1:1", "nodeType": "ContractDefinition", @@ -190,11 +190,59 @@ "src": "159:4:1", "typeDescriptions": {} } + }, + { + "constant": false, + "id": 26, + "mutability": "mutable", + "name": "m", + "nameLocation": "205:1:1", + "nodeType": "VariableDeclaration", + "src": "169:37:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": {}, + "typeName": + { + "id": 25, + "keyType": + { + "id": 22, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 21, + "name": "MyAddress", + "nodeType": "IdentifierPath", + "src": "177:9:1" + }, + "src": "177:9:1", + "typeDescriptions": {} + }, + "nodeType": "Mapping", + "src": "169:28:1", + "typeDescriptions": {}, + "valueType": + { + "id": 24, + "nodeType": "UserDefinedTypeName", + "pathNode": + { + "id": 23, + "name": "MyUInt", + "nodeType": "IdentifierPath", + "src": "190:6:1" + }, + "src": "190:6:1", + "typeDescriptions": {} + } + }, + "visibility": "public" } ], - "src": "96:70:1", + "src": "96:113:1", "usedErrors": [] } ], - "src": "0:167:1" + "src": "0:210:1" }