Skip to content

Commit

Permalink
Fix InlineAssembly schema errors (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
frangio authored Aug 29, 2024
1 parent 829170c commit cd0e4c7
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

### 0.4.58 (2024-08-29)

- Fixed `YulFunctionDefinition.parameters` and `returnVariables`: made optional, used when empty.
- Fixed `InlineAssembly.externalReferences[].suffix`: added `'length'` option.

### 0.4.57 (2024-07-16)

- Fixed `ModifierDefinition.body`: made nullable to support Solidity 0.6.7 virtual modifiers with empty body.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solidity-ast",
"version": "0.4.57",
"version": "0.4.58",
"description": "Solidity AST schema and type definitions",
"author": "Francisco Giordano <[email protected]>",
"repository": "github:OpenZeppelin/solidity-ast",
Expand Down
6 changes: 3 additions & 3 deletions scripts/build-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ const schema = {
isSlot: boolean,
src: ref('SourceLocation'),
valueSize: integer,
suffix: optional(literal('slot', 'offset')),
suffix: optional(literal('slot', 'offset', 'length')),
})),
flags: optional(array(literal('memory-safe'))),
},
Expand Down Expand Up @@ -817,8 +817,8 @@ const schema = {
YulFunctionDefinition: {
body: ref('YulBlock'),
name: string,
parameters: array(ref('YulTypedName')),
returnVariables: array(ref('YulTypedName')),
parameters: optional(array(ref('YulTypedName'))),
returnVariables: optional(array(ref('YulTypedName'))),
},

YulIdentifier: {
Expand Down
4 changes: 4 additions & 0 deletions test/sources/asm-0.6.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ contract Asm {
assembly {
let x := s_slot
let y := s_offset

function fail() {
revert(0, 0)
}
}
}
}
9 changes: 9 additions & 0 deletions test/sources/asm-0.7.5.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pragma solidity >=0.7.5;

contract Asm {
function foo(bytes calldata b) external {
assembly {
let z := b.length
}
}
}
4 changes: 4 additions & 0 deletions test/sources/asm-0.7.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ contract Asm {
assembly {
let x := s.slot
let y := s.offset

function fail() {
revert(0, 0)
}
}
}
}

0 comments on commit cd0e4c7

Please sign in to comment.