Skip to content

Commit 8d1d558

Browse files
committed
Fix InlineAssembly schema errors (#50)
1 parent 4951432 commit 8d1d558

File tree

7 files changed

+28
-6
lines changed

7 files changed

+28
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
### 0.4.58 (2024-08-29)
4+
5+
- Fixed `YulFunctionDefinition.parameters` and `returnVariables`: made optional, used when empty.
6+
- Fixed `InlineAssembly.externalReferences[].suffix`: added `'length'` option.
7+
38
### 0.4.57 (2024-07-16)
49

510
- Fixed `ModifierDefinition.body`: made nullable to support Solidity 0.6.7 virtual modifiers with empty body.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "solidity-ast",
3-
"version": "0.4.57",
3+
"version": "0.4.58",
44
"description": "Solidity AST schema and type definitions",
55
"author": "Francisco Giordano <frangio.1@gmail.com>",
66
"repository": "github:OpenZeppelin/solidity-ast",

scripts/build-schema.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ const schema = {
498498
isSlot: boolean,
499499
src: ref('SourceLocation'),
500500
valueSize: integer,
501-
suffix: optional(literal('slot', 'offset')),
501+
suffix: optional(literal('slot', 'offset', 'length')),
502502
})),
503503
flags: optional(array(literal('memory-safe'))),
504504
},
@@ -817,8 +817,8 @@ const schema = {
817817
YulFunctionDefinition: {
818818
body: ref('YulBlock'),
819819
name: string,
820-
parameters: array(ref('YulTypedName')),
821-
returnVariables: array(ref('YulTypedName')),
820+
parameters: optional(array(ref('YulTypedName'))),
821+
returnVariables: optional(array(ref('YulTypedName'))),
822822
},
823823

824824
YulIdentifier: {

test/sources/asm-0.6.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ contract Asm {
77
assembly {
88
let x := s_slot
99
let y := s_offset
10+
11+
function fail() {
12+
revert(0, 0)
13+
}
1014
}
1115
}
1216
}

test/sources/asm-0.7.5.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pragma solidity >=0.7.5;
2+
3+
contract Asm {
4+
function foo(bytes calldata b) external {
5+
assembly {
6+
let z := b.length
7+
}
8+
}
9+
}

test/sources/asm-0.7.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ contract Asm {
77
assembly {
88
let x := s.slot
99
let y := s.offset
10+
11+
function fail() {
12+
revert(0, 0)
13+
}
1014
}
1115
}
1216
}

0 commit comments

Comments
 (0)