Added errorSelector field for custom errors

This commit is contained in:
nishant-sachdeva
2022-02-21 19:14:33 +05:30
parent daad9a42c1
commit 195f72e844
10 changed files with 124 additions and 25 deletions
@@ -162,6 +162,7 @@
"src": "69:26:3",
"text": "Some comment on Evt."
},
"eventSelector": "a69007916fc1145953e5a7032d7c3eab4b8e2f33ec59b0f71e732904eeede3a4",
"id": 12,
"name": "Evt",
"nameLocation": "102:3:3",
@@ -30,6 +30,7 @@
[
{
"anonymous": false,
"eventSelector": "92bbf6e823a631f3c8e09b1c8df90f378fb56f7fbc9701827e1ff8aad7f6a028",
"id": 2,
"name": "E",
"nameLocation": "19:1:1",
@@ -0,0 +1,5 @@
contract C {
event E(function() internal);
}
// ----
@@ -0,0 +1,78 @@
{
"absolutePath": "a",
"id": 8,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"id": 7,
"name": "C",
"nameLocation": "9:1:1",
"nodeType": "ContractDefinition",
"nodes":
[
{
"anonymous": false,
"id": 6,
"name": "E",
"nameLocation": "23:1:1",
"nodeType": "EventDefinition",
"parameters":
{
"id": 5,
"nodeType": "ParameterList",
"parameters":
[
{
"constant": false,
"id": 4,
"indexed": false,
"mutability": "mutable",
"name": "",
"nameLocation": "-1:-1:-1",
"nodeType": "VariableDeclaration",
"src": "25:20:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {},
"typeName":
{
"id": 3,
"nodeType": "FunctionTypeName",
"parameterTypes":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "33:2:1"
},
"returnParameterTypes":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "44:0:1"
},
"src": "25:20:1",
"stateMutability": "nonpayable",
"typeDescriptions": {},
"visibility": "internal"
},
"visibility": "internal"
}
],
"src": "24:21:1"
},
"src": "17:29:1"
}
],
"src": "0:48:1",
"usedErrors": []
}
],
"src": "0:49:1"
}
+11 -9
View File
@@ -20,6 +20,7 @@
"nodes":
[
{
"errorSelector": "c1599bd9",
"id": 2,
"name": "X",
"nameLocation": "6:1:1",
@@ -127,6 +128,7 @@
"nodes":
[
{
"errorSelector": "2bc80f3a",
"id": 11,
"name": "T",
"nameLocation": "63:1:1",
@@ -145,7 +147,7 @@
{
"id": 17,
"nodeType": "Block",
"src": "97:8:1",
"src": "92:8:1",
"statements":
[
{
@@ -160,7 +162,7 @@
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 9,
"src": "99:1:1",
"src": "94:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_function_internal_nonpayable$__$returns$__$",
@@ -175,7 +177,7 @@
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "99:3:1",
"src": "94:3:1",
"tryCall": false,
"typeDescriptions":
{
@@ -185,7 +187,7 @@
},
"id": 16,
"nodeType": "ExpressionStatement",
"src": "99:3:1"
"src": "94:3:1"
}
]
},
@@ -209,17 +211,17 @@
"id": 13,
"nodeType": "ParameterList",
"parameters": [],
"src": "97:0:1"
"src": "92:0:1"
},
"scope": 19,
"src": "72:33:1",
"stateMutability": "pure",
"src": "72:28:1",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"scope": 20,
"src": "40:67:1",
"src": "40:62:1",
"usedErrors":
[
2,
@@ -227,5 +229,5 @@
]
}
],
"src": "0:108:1"
"src": "0:103:1"
}
+1 -1
View File
@@ -2,7 +2,7 @@ error X();
function f() { revert X(); }
contract C {
error T();
function h() public pure { f(); }
function h() public { f(); }
}
// ----
@@ -108,7 +108,7 @@
{
"id": 17,
"nodeType": "Block",
"src": "97:8:1",
"src": "92:8:1",
"statements":
[
{
@@ -121,19 +121,19 @@
"name": "f",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"src": "99:1:1",
"src": "94:1:1",
"typeDescriptions": {}
},
"id": 15,
"names": [],
"nodeType": "FunctionCall",
"src": "99:3:1",
"src": "94:3:1",
"tryCall": false,
"typeDescriptions": {}
},
"id": 16,
"nodeType": "ExpressionStatement",
"src": "99:3:1"
"src": "94:3:1"
}
]
},
@@ -156,17 +156,17 @@
"id": 13,
"nodeType": "ParameterList",
"parameters": [],
"src": "97:0:1"
"src": "92:0:1"
},
"src": "72:33:1",
"stateMutability": "pure",
"src": "72:28:1",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
}
],
"src": "40:67:1",
"src": "40:62:1",
"usedErrors": []
}
],
"src": "0:108:1"
"src": "0:103:1"
}