Source location for named mapping keys

This commit is contained in:
Nikola Matic
2023-01-17 12:25:23 +01:00
parent 7b2f8a2e31
commit 83c1f62026
12 changed files with 177 additions and 31 deletions
@@ -49,6 +49,7 @@
{
"id": 3,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 1,
@@ -69,6 +70,7 @@
"typeString": "mapping(address => address payable)"
},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 2,
@@ -30,6 +30,7 @@
{
"id": 3,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 1,
@@ -42,6 +43,7 @@
"src": "17:35:1",
"typeDescriptions": {},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 2,
+78 -15
View File
@@ -4,10 +4,10 @@
{
"C":
[
19
23
]
},
"id": 20,
"id": 24,
"nodeType": "SourceUnit",
"nodes":
[
@@ -18,10 +18,10 @@
"contractDependencies": [],
"contractKind": "contract",
"fullyImplemented": true,
"id": 19,
"id": 23,
"linearizedBaseContracts":
[
19
23
],
"name": "C",
"nameLocation": "9:1:1",
@@ -67,19 +67,20 @@
"name": "a",
"nameLocation": "59:1:1",
"nodeType": "VariableDeclaration",
"scope": 19,
"scope": 23,
"src": "40:20:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$",
"typeIdentifier": "t_mapping$_t_contract$_C_$23_$_t_bool_$",
"typeString": "mapping(contract C => bool)"
},
"typeName":
{
"id": 8,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 6,
@@ -93,14 +94,14 @@
"48:1:1"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 19,
"referencedDeclaration": 23,
"src": "48:1:1"
},
"referencedDeclaration": 19,
"referencedDeclaration": 23,
"src": "48:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_contract$_C_$19",
"typeIdentifier": "t_contract$_C_$23",
"typeString": "contract C"
}
},
@@ -108,10 +109,11 @@
"src": "40:18:1",
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_contract$_C_$19_$_t_bool_$",
"typeIdentifier": "t_mapping$_t_contract$_C_$23_$_t_bool_$",
"typeString": "mapping(contract C => bool)"
},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 7,
@@ -134,7 +136,7 @@
"name": "b",
"nameLocation": "91:1:1",
"nodeType": "VariableDeclaration",
"scope": 19,
"scope": 23,
"src": "66:26:1",
"stateVariable": true,
"storageLocation": "default",
@@ -147,6 +149,7 @@
{
"id": 12,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 10,
@@ -167,6 +170,7 @@
"typeString": "mapping(address => bool)"
},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 11,
@@ -189,7 +193,7 @@
"name": "c",
"nameLocation": "117:1:1",
"nodeType": "VariableDeclaration",
"scope": 19,
"scope": 23,
"src": "98:20:1",
"stateVariable": true,
"storageLocation": "default",
@@ -202,6 +206,7 @@
{
"id": 17,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 15,
@@ -234,6 +239,7 @@
"typeString": "mapping(enum C.E => bool)"
},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 16,
@@ -248,12 +254,69 @@
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 22,
"mutability": "mutable",
"name": "d",
"nameLocation": "169:1:1",
"nodeType": "VariableDeclaration",
"scope": 23,
"src": "124:46:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"typeName":
{
"id": 21,
"keyName": "keyAddress",
"keyNameLocation": "140:10:1",
"keyType":
{
"id": 19,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "132:7:1",
"typeDescriptions":
{
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"nodeType": "Mapping",
"src": "124:44:1",
"typeDescriptions":
{
"typeIdentifier": "t_mapping$_t_address_$_t_uint256_$",
"typeString": "mapping(address => uint256)"
},
"valueName": "value",
"valueNameLocation": "162:5:1",
"valueType":
{
"id": 20,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "154:7:1",
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
}
},
"visibility": "internal"
}
],
"scope": 20,
"src": "0:121:1",
"scope": 24,
"src": "0:173:1",
"usedErrors": []
}
],
"src": "0:122:1"
"src": "0:174:1"
}
+1
View File
@@ -3,6 +3,7 @@ contract C {
mapping(C => bool) a;
mapping(address => bool) b;
mapping(E => bool) c;
mapping(address keyAddress => uint256 value) d;
}
// ----
@@ -1,6 +1,6 @@
{
"absolutePath": "a",
"id": 20,
"id": 24,
"nodeType": "SourceUnit",
"nodes":
[
@@ -9,7 +9,7 @@
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"id": 19,
"id": 23,
"name": "C",
"nameLocation": "9:1:1",
"nodeType": "ContractDefinition",
@@ -61,6 +61,7 @@
{
"id": 8,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 6,
@@ -83,6 +84,7 @@
"src": "40:18:1",
"typeDescriptions": {},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 7,
@@ -109,6 +111,7 @@
{
"id": 12,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 10,
@@ -121,6 +124,7 @@
"src": "66:24:1",
"typeDescriptions": {},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 11,
@@ -147,6 +151,7 @@
{
"id": 17,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 15,
@@ -169,6 +174,7 @@
"src": "98:18:1",
"typeDescriptions": {},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 16,
@@ -179,11 +185,51 @@
}
},
"visibility": "internal"
},
{
"constant": false,
"id": 22,
"mutability": "mutable",
"name": "d",
"nameLocation": "169:1:1",
"nodeType": "VariableDeclaration",
"src": "124:46:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {},
"typeName":
{
"id": 21,
"keyName": "keyAddress",
"keyNameLocation": "140:10:1",
"keyType":
{
"id": 19,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "132:7:1",
"typeDescriptions": {}
},
"nodeType": "Mapping",
"src": "124:44:1",
"typeDescriptions": {},
"valueName": "value",
"valueNameLocation": "162:5:1",
"valueType":
{
"id": 20,
"name": "uint256",
"nodeType": "ElementaryTypeName",
"src": "154:7:1",
"typeDescriptions": {}
}
},
"visibility": "internal"
}
],
"src": "0:121:1",
"src": "0:173:1",
"usedErrors": []
}
],
"src": "0:122:1"
"src": "0:174:1"
}
@@ -288,6 +288,7 @@
{
"id": 25,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 22,
@@ -320,6 +321,7 @@
"typeString": "mapping(C.MyAddress => C.MyUInt)"
},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 24,
@@ -214,6 +214,7 @@
{
"id": 25,
"keyName": "",
"keyNameLocation": "-1:-1:-1",
"keyType":
{
"id": 22,
@@ -236,6 +237,7 @@
"src": "169:28:1",
"typeDescriptions": {},
"valueName": "",
"valueNameLocation": "-1:-1:-1",
"valueType":
{
"id": 24,