Inline assembly to AST json export

This commit is contained in:
djudjuu
2019-11-13 12:13:22 +01:00
committed by chriseth
parent 684ccea6f0
commit e437443645
30 changed files with 2777 additions and 12 deletions
+168
View File
@@ -0,0 +1,168 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
},
"id": 7,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
6
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 4,
"nodeType": "Block",
"src": "37:59:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "56:34:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "67:1:1",
"type": "",
"value": "0"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "70:1:1",
"type": "",
"value": "1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "73:1:1",
"type": "",
"value": "2"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "76:1:1",
"type": "",
"value": "3"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "79:1:1",
"type": "",
"value": "4"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "82:1:1",
"type": "",
"value": "5"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "85:1:1",
"type": "",
"value": "6"
}
],
"functionName":
{
"name": "call",
"nodeType": "YulIdentifier",
"src": "62:4:1"
},
"nodeType": "YulFunctionCall",
"src": "62:25:1"
}
],
"functionName":
{
"name": "pop",
"nodeType": "YulIdentifier",
"src": "58:3:1"
},
"nodeType": "YulFunctionCall",
"src": "58:30:1"
},
"nodeType": "YulExpressionStatement",
"src": "58:30:1"
}
]
},
"externalReferences": [],
"id": 3,
"nodeType": "InlineAssembly",
"src": "47:43:1"
}
]
},
"documentation": null,
"id": 5,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "j",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "37:0:1"
},
"scope": 6,
"src": "17:79:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 7,
"src": "0:98:1"
}
],
"src": "0:99:1"
}
@@ -0,0 +1,7 @@
contract C {
function j() public {
assembly { pop(call(0, 1, 2, 3, 4, 5, 6)) }
}
}
// ----
@@ -0,0 +1,121 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
],
"name": "C",
"scope": 7
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "j",
"overrides": null,
"scope": 6,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "37:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
null
],
"operations": "{\n pop(call(0, 1, 2, 3, 4, 5, 6))\n}"
},
"children": [],
"id": 3,
"name": "InlineAssembly",
"src": "47:43:1"
}
],
"id": 4,
"name": "Block",
"src": "37:59:1"
}
],
"id": 5,
"name": "FunctionDefinition",
"src": "17:79:1"
}
],
"id": 6,
"name": "ContractDefinition",
"src": "0:98:1"
}
],
"id": 7,
"name": "SourceUnit",
"src": "0:99:1"
}
@@ -0,0 +1,155 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
},
"id": 7,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
6
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 4,
"nodeType": "Block",
"src": "42:68:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "61:43:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "76:22:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "92:2:1",
"type": "",
"value": "20"
}
],
"functionName":
{
"name": "blockhash",
"nodeType": "YulIdentifier",
"src": "82:9:1"
},
"nodeType": "YulFunctionCall",
"src": "82:13:1"
}
],
"functionName":
{
"name": "pop",
"nodeType": "YulIdentifier",
"src": "78:3:1"
},
"nodeType": "YulFunctionCall",
"src": "78:18:1"
},
"nodeType": "YulExpressionStatement",
"src": "78:18:1"
}
]
},
"name": "g",
"nodeType": "YulFunctionDefinition",
"src": "63:35:1"
},
{
"expression":
{
"arguments": [],
"functionName":
{
"name": "g",
"nodeType": "YulIdentifier",
"src": "99:1:1"
},
"nodeType": "YulFunctionCall",
"src": "99:3:1"
},
"nodeType": "YulExpressionStatement",
"src": "99:3:1"
}
]
},
"externalReferences": [],
"id": 3,
"nodeType": "InlineAssembly",
"src": "52:52:1"
}
]
},
"documentation": null,
"id": 5,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "h",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "42:0:1"
},
"scope": 6,
"src": "17:93:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 7,
"src": "0:112:1"
}
],
"src": "0:113:1"
}
@@ -0,0 +1,7 @@
contract C {
function h() view public {
assembly { function g() { pop(blockhash(20)) } g() }
}
}
// ----
@@ -0,0 +1,121 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
],
"name": "C",
"scope": 7
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "h",
"overrides": null,
"scope": 6,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "42:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
null
],
"operations": "{\n function g()\n { pop(blockhash(20)) }\n g()\n}"
},
"children": [],
"id": 3,
"name": "InlineAssembly",
"src": "52:52:1"
}
],
"id": 4,
"name": "Block",
"src": "42:68:1"
}
],
"id": 5,
"name": "FunctionDefinition",
"src": "17:93:1"
}
],
"id": 6,
"name": "ContractDefinition",
"src": "0:112:1"
}
],
"id": 7,
"name": "SourceUnit",
"src": "0:113:1"
}
@@ -0,0 +1,105 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
},
"id": 7,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
6
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 4,
"nodeType": "Block",
"src": "37:51:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "56:26:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "71:9:1",
"statements":
[
{
"nodeType": "YulLeave",
"src": "73:5:1"
}
]
},
"name": "f",
"nodeType": "YulFunctionDefinition",
"src": "58:22:1"
}
]
},
"externalReferences": [],
"id": 3,
"nodeType": "InlineAssembly",
"src": "47:35:1"
}
]
},
"documentation": null,
"id": 5,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "l",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "37:0:1"
},
"scope": 6,
"src": "17:71:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 7,
"src": "0:90:1"
}
],
"src": "0:91:1"
}
@@ -0,0 +1,7 @@
contract C {
function l() public {
assembly { function f() { leave } }
}
}
// ----
@@ -0,0 +1,121 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
],
"name": "C",
"scope": 7
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "l",
"overrides": null,
"scope": 6,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "37:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
null
],
"operations": "{\n function f()\n { leave }\n}"
},
"children": [],
"id": 3,
"name": "InlineAssembly",
"src": "47:35:1"
}
],
"id": 4,
"name": "Block",
"src": "37:51:1"
}
],
"id": 5,
"name": "FunctionDefinition",
"src": "17:71:1"
}
],
"id": 6,
"name": "ContractDefinition",
"src": "0:90:1"
}
],
"id": 7,
"name": "SourceUnit",
"src": "0:91:1"
}
+168
View File
@@ -0,0 +1,168 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
},
"id": 7,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
6
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 4,
"nodeType": "Block",
"src": "42:74:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "61:49:1",
"statements":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "90:18:1",
"statements":
[
{
"nodeType": "YulBreak",
"src": "92:5:1"
},
{
"nodeType": "YulContinue",
"src": "98:8:1"
}
]
},
"condition":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "70:1:1",
"type": "",
"value": "1"
},
"nodeType": "YulForLoop",
"post":
{
"nodeType": "YulBlock",
"src": "72:17:1",
"statements":
[
{
"expression":
{
"arguments":
[
{
"arguments":
[
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "84:1:1",
"type": "",
"value": "0"
}
],
"functionName":
{
"name": "sload",
"nodeType": "YulIdentifier",
"src": "78:5:1"
},
"nodeType": "YulFunctionCall",
"src": "78:8:1"
}
],
"functionName":
{
"name": "pop",
"nodeType": "YulIdentifier",
"src": "74:3:1"
},
"nodeType": "YulFunctionCall",
"src": "74:13:1"
},
"nodeType": "YulExpressionStatement",
"src": "74:13:1"
}
]
},
"pre":
{
"nodeType": "YulBlock",
"src": "67:2:1",
"statements": []
},
"src": "63:45:1"
}
]
},
"externalReferences": [],
"id": 3,
"nodeType": "InlineAssembly",
"src": "52:58:1"
}
]
},
"documentation": null,
"id": 5,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "g",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "42:0:1"
},
"scope": 6,
"src": "17:99:1",
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
}
],
"scope": 7,
"src": "0:118:1"
}
],
"src": "0:119:1"
}
@@ -0,0 +1,7 @@
contract C {
function g() view public {
assembly { for {} 1 { pop(sload(0)) } { break continue } }
}
}
// ----
@@ -0,0 +1,121 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
],
"name": "C",
"scope": 7
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "g",
"overrides": null,
"scope": 6,
"stateMutability": "view",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "42:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
null
],
"operations": "{\n for { } 1 { pop(sload(0)) }\n {\n break\n continue\n }\n}"
},
"children": [],
"id": 3,
"name": "InlineAssembly",
"src": "52:58:1"
}
],
"id": 4,
"name": "Block",
"src": "42:74:1"
}
],
"id": 5,
"name": "FunctionDefinition",
"src": "17:99:1"
}
],
"id": 6,
"name": "ContractDefinition",
"src": "0:118:1"
}
],
"id": 7,
"name": "SourceUnit",
"src": "0:119:1"
}
@@ -0,0 +1,236 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
11
]
},
"id": 12,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 11,
"linearizedBaseContracts":
[
11
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"canonicalName": "C.S",
"id": 3,
"members":
[
{
"constant": false,
"id": 2,
"name": "x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 3,
"src": "28:6:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName":
{
"id": 1,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "28:4:1",
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "S",
"nodeType": "StructDefinition",
"scope": 11,
"src": "17:20:1",
"visibility": "public"
},
{
"constant": false,
"id": 5,
"name": "s",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 11,
"src": "42:3:1",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions":
{
"typeIdentifier": "t_struct$_S_$3_storage",
"typeString": "struct C.S"
},
"typeName":
{
"contractScope": null,
"id": 4,
"name": "S",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 3,
"src": "42:1:1",
"typeDescriptions":
{
"typeIdentifier": "t_struct$_S_$3_storage_ptr",
"typeString": "struct C.S"
}
},
"value": null,
"visibility": "internal"
},
{
"body":
{
"id": 9,
"nodeType": "Block",
"src": "76:70:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "95:45:1",
"statements":
[
{
"nodeType": "YulVariableDeclaration",
"src": "97:17:1",
"value":
{
"name": "s_offset",
"nodeType": "YulIdentifier",
"src": "106:8:1"
},
"variables":
[
{
"name": "x",
"nodeType": "YulTypedName",
"src": "101:1:1",
"type": ""
}
]
},
{
"nodeType": "YulVariableDeclaration",
"src": "115:23:1",
"value":
{
"arguments":
[
{
"name": "s_slot",
"nodeType": "YulIdentifier",
"src": "128:6:1"
},
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "136:1:1",
"type": "",
"value": "2"
}
],
"functionName":
{
"name": "mul",
"nodeType": "YulIdentifier",
"src": "124:3:1"
},
"nodeType": "YulFunctionCall",
"src": "124:14:1"
},
"variables":
[
{
"name": "y",
"nodeType": "YulTypedName",
"src": "119:1:1",
"type": ""
}
]
}
]
},
"externalReferences":
[
{
"declaration": 5,
"isOffset": true,
"isSlot": false,
"src": "106:8:1",
"valueSize": 1
},
{
"declaration": 5,
"isOffset": false,
"isSlot": true,
"src": "128:6:1",
"valueSize": 1
}
],
"id": 8,
"nodeType": "InlineAssembly",
"src": "86:54:1"
}
]
},
"documentation": null,
"id": 10,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "e",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 6,
"nodeType": "ParameterList",
"parameters": [],
"src": "61:2:1"
},
"returnParameters":
{
"id": 7,
"nodeType": "ParameterList",
"parameters": [],
"src": "76:0:1"
},
"scope": 11,
"src": "51:95:1",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 12,
"src": "0:148:1"
}
],
"src": "0:149:1"
}
@@ -0,0 +1,9 @@
contract C {
struct S { uint x; }
S s;
function e() pure public {
assembly { let x := s_offset let y := mul(s_slot, 2) }
}
}
// ----
@@ -0,0 +1,211 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
11
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
11
],
"name": "C",
"scope": 12
},
"children":
[
{
"attributes":
{
"canonicalName": "C.S",
"name": "S",
"scope": 11,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"constant": false,
"name": "x",
"overrides": null,
"scope": 3,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children":
[
{
"attributes":
{
"name": "uint",
"type": "uint256"
},
"id": 1,
"name": "ElementaryTypeName",
"src": "28:4:1"
}
],
"id": 2,
"name": "VariableDeclaration",
"src": "28:6:1"
}
],
"id": 3,
"name": "StructDefinition",
"src": "17:20:1"
},
{
"attributes":
{
"constant": false,
"name": "s",
"overrides": null,
"scope": 11,
"stateVariable": true,
"storageLocation": "default",
"type": "struct C.S",
"value": null,
"visibility": "internal"
},
"children":
[
{
"attributes":
{
"contractScope": null,
"name": "S",
"referencedDeclaration": 3,
"type": "struct C.S"
},
"id": 4,
"name": "UserDefinedTypeName",
"src": "42:1:1"
}
],
"id": 5,
"name": "VariableDeclaration",
"src": "42:3:1"
},
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "e",
"overrides": null,
"scope": 11,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 6,
"name": "ParameterList",
"src": "61:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 7,
"name": "ParameterList",
"src": "76:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
{
"declaration": 5,
"isOffset": true,
"isSlot": false,
"src": "106:8:1",
"valueSize": 1
},
{
"declaration": 5,
"isOffset": false,
"isSlot": true,
"src": "128:6:1",
"valueSize": 1
}
],
"operations": "{\n let x := s_offset\n let y := mul(s_slot, 2)\n}"
},
"children": [],
"id": 8,
"name": "InlineAssembly",
"src": "86:54:1"
}
],
"id": 9,
"name": "Block",
"src": "76:70:1"
}
],
"id": 10,
"name": "FunctionDefinition",
"src": "51:95:1"
}
],
"id": 11,
"name": "ContractDefinition",
"src": "0:148:1"
}
],
"id": 12,
"name": "SourceUnit",
"src": "0:149:1"
}
@@ -0,0 +1,109 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
},
"id": 7,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
6
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 4,
"nodeType": "Block",
"src": "37:43:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "56:18:1",
"statements":
[
{
"nodeType": "YulVariableDeclaration",
"src": "58:14:1",
"value":
{
"kind": "string",
"nodeType": "YulLiteral",
"src": "67:5:1",
"type": "",
"value": "abc"
},
"variables":
[
{
"name": "x",
"nodeType": "YulTypedName",
"src": "62:1:1",
"type": ""
}
]
}
]
},
"externalReferences": [],
"id": 3,
"nodeType": "InlineAssembly",
"src": "47:27:1"
}
]
},
"documentation": null,
"id": 5,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "m",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "37:0:1"
},
"scope": 6,
"src": "17:63:1",
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
}
],
"scope": 7,
"src": "0:82:1"
}
],
"src": "0:83:1"
}
@@ -0,0 +1,7 @@
contract C {
function m() public {
assembly { let x := "abc" }
}
}
// ----
@@ -0,0 +1,121 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
],
"name": "C",
"scope": 7
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "m",
"overrides": null,
"scope": 6,
"stateMutability": "nonpayable",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "37:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
null
],
"operations": "{ let x := \"abc\" }"
},
"children": [],
"id": 3,
"name": "InlineAssembly",
"src": "47:27:1"
}
],
"id": 4,
"name": "Block",
"src": "37:43:1"
}
],
"id": 5,
"name": "FunctionDefinition",
"src": "17:63:1"
}
],
"id": 6,
"name": "ContractDefinition",
"src": "0:82:1"
}
],
"id": 7,
"name": "SourceUnit",
"src": "0:83:1"
}
@@ -0,0 +1,201 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
},
"id": 7,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 6,
"linearizedBaseContracts":
[
6
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 4,
"nodeType": "Block",
"src": "42:154:1",
"statements":
[
{
"AST":
{
"nodeType": "YulBlock",
"src": "61:129:1",
"statements":
[
{
"nodeType": "YulVariableDeclaration",
"src": "75:10:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "84:1:1",
"type": "",
"value": "0"
},
"variables":
[
{
"name": "f",
"nodeType": "YulTypedName",
"src": "79:1:1",
"type": ""
}
]
},
{
"cases":
[
{
"body":
{
"nodeType": "YulBlock",
"src": "139:10:1",
"statements":
[
{
"nodeType": "YulAssignment",
"src": "141:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "146:1:1",
"type": "",
"value": "1"
},
"variableNames":
[
{
"name": "f",
"nodeType": "YulIdentifier",
"src": "141:1:1"
}
]
}
]
},
"nodeType": "YulCase",
"src": "132:17:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "137:1:1",
"type": "",
"value": "0"
}
},
{
"body":
{
"nodeType": "YulBlock",
"src": "170:10:1",
"statements":
[
{
"nodeType": "YulAssignment",
"src": "172:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "177:1:1",
"type": "",
"value": "2"
},
"variableNames":
[
{
"name": "f",
"nodeType": "YulIdentifier",
"src": "172:1:1"
}
]
}
]
},
"nodeType": "YulCase",
"src": "162:18:1",
"value": "default"
}
],
"expression":
{
"arguments": [],
"functionName":
{
"name": "calldatasize",
"nodeType": "YulIdentifier",
"src": "105:12:1"
},
"nodeType": "YulFunctionCall",
"src": "105:14:1"
},
"nodeType": "YulSwitch",
"src": "98:82:1"
}
]
},
"externalReferences": [],
"id": 3,
"nodeType": "InlineAssembly",
"src": "52:138:1"
}
]
},
"documentation": null,
"id": 5,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "f",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "42:0:1"
},
"scope": 6,
"src": "17:179:1",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 7,
"src": "0:198:1"
}
],
"src": "0:199:1"
}
@@ -0,0 +1,12 @@
contract C {
function f() pure public {
assembly {
let f := 0
switch calldatasize()
case 0 { f := 1 }
default { f := 2 }
}
}
}
// ----
@@ -0,0 +1,121 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
6
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
6
],
"name": "C",
"scope": 7
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "f",
"overrides": null,
"scope": 6,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "42:0:1"
},
{
"children":
[
{
"attributes":
{
"externalReferences":
[
null
],
"operations": "{\n let f := 0\n switch calldatasize()\n case 0 { f := 1 }\n default { f := 2 }\n}"
},
"children": [],
"id": 3,
"name": "InlineAssembly",
"src": "52:138:1"
}
],
"id": 4,
"name": "Block",
"src": "42:154:1"
}
],
"id": 5,
"name": "FunctionDefinition",
"src": "17:179:1"
}
],
"id": 6,
"name": "ContractDefinition",
"src": "0:198:1"
}
],
"id": 7,
"name": "SourceUnit",
"src": "0:199:1"
}
@@ -0,0 +1,160 @@
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
9
]
},
"id": 10,
"nodeType": "SourceUnit",
"nodes":
[
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 9,
"linearizedBaseContracts":
[
9
],
"name": "C",
"nodeType": "ContractDefinition",
"nodes":
[
{
"body":
{
"id": 7,
"nodeType": "Block",
"src": "42:51:1",
"statements":
[
{
"assignments":
[
4
],
"declarations":
[
{
"constant": false,
"id": 4,
"name": "x",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 7,
"src": "52:6:1",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
},
"typeName":
{
"id": 3,
"name": "uint",
"nodeType": "ElementaryTypeName",
"src": "52:4:1",
"typeDescriptions":
{
"typeIdentifier": "t_uint256",
"typeString": "uint256"
}
},
"value": null,
"visibility": "internal"
}
],
"id": 5,
"initialValue": null,
"nodeType": "VariableDeclarationStatement",
"src": "52:6:1"
},
{
"AST":
{
"nodeType": "YulBlock",
"src": "77:10:1",
"statements":
[
{
"nodeType": "YulAssignment",
"src": "79:6:1",
"value":
{
"kind": "number",
"nodeType": "YulLiteral",
"src": "84:1:1",
"type": "",
"value": "7"
},
"variableNames":
[
{
"name": "x",
"nodeType": "YulIdentifier",
"src": "79:1:1"
}
]
}
]
},
"externalReferences":
[
{
"declaration": 4,
"isOffset": false,
"isSlot": false,
"src": "79:1:1",
"valueSize": 1
}
],
"id": 6,
"nodeType": "InlineAssembly",
"src": "68:19:1"
}
]
},
"documentation": null,
"id": 8,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "f",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters":
{
"id": 1,
"nodeType": "ParameterList",
"parameters": [],
"src": "27:2:1"
},
"returnParameters":
{
"id": 2,
"nodeType": "ParameterList",
"parameters": [],
"src": "42:0:1"
},
"scope": 9,
"src": "17:76:1",
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
}
],
"scope": 10,
"src": "0:95:1"
}
],
"src": "0:96:1"
}
@@ -0,0 +1,8 @@
contract C {
function f() pure public {
uint x;
assembly { x := 7 }
}
}
// ----
@@ -0,0 +1,173 @@
{
"attributes":
{
"absolutePath": "a",
"exportedSymbols":
{
"C":
[
9
]
}
},
"children":
[
{
"attributes":
{
"abstract": false,
"baseContracts":
[
null
],
"contractDependencies":
[
null
],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"linearizedBaseContracts":
[
9
],
"name": "C",
"scope": 10
},
"children":
[
{
"attributes":
{
"documentation": null,
"implemented": true,
"isConstructor": false,
"kind": "function",
"modifiers":
[
null
],
"name": "f",
"overrides": null,
"scope": 9,
"stateMutability": "pure",
"superFunction": null,
"visibility": "public"
},
"children":
[
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 1,
"name": "ParameterList",
"src": "27:2:1"
},
{
"attributes":
{
"parameters":
[
null
]
},
"children": [],
"id": 2,
"name": "ParameterList",
"src": "42:0:1"
},
{
"children":
[
{
"attributes":
{
"assignments":
[
4
],
"initialValue": null
},
"children":
[
{
"attributes":
{
"constant": false,
"name": "x",
"overrides": null,
"scope": 7,
"stateVariable": false,
"storageLocation": "default",
"type": "uint256",
"value": null,
"visibility": "internal"
},
"children":
[
{
"attributes":
{
"name": "uint",
"type": "uint256"
},
"id": 3,
"name": "ElementaryTypeName",
"src": "52:4:1"
}
],
"id": 4,
"name": "VariableDeclaration",
"src": "52:6:1"
}
],
"id": 5,
"name": "VariableDeclarationStatement",
"src": "52:6:1"
},
{
"attributes":
{
"externalReferences":
[
{
"declaration": 4,
"isOffset": false,
"isSlot": false,
"src": "79:1:1",
"valueSize": 1
}
],
"operations": "{ x := 7 }"
},
"children": [],
"id": 6,
"name": "InlineAssembly",
"src": "68:19:1"
}
],
"id": 7,
"name": "Block",
"src": "42:51:1"
}
],
"id": 8,
"name": "FunctionDefinition",
"src": "17:76:1"
}
],
"id": 9,
"name": "ContractDefinition",
"src": "0:95:1"
}
],
"id": 10,
"name": "SourceUnit",
"src": "0:96:1"
}