Skip to content

Commit

Permalink
Fix: Ast Node Bindings (#199)
Browse files Browse the repository at this point in the history
Fix for 2 ast node bindings

* BinaryOperation can qualify as an `expr_node!`
* Return AST Node's `function_return_parameters` should be made optional
because when return is used inside modifiers, the AST generated by solc
doesn't include the `function_return_parameters` field

More context:
I tried using these changes on
[Aderyn](https://github.com/Cyfrin/aderyn/blob/5c483fdbf1f454ca42c1fd9b85353b0b9241c43a/aderyn_core/src/ast/ast_nodes.rs#L639C1-L645C3)
for a while and haven't come across an unrecognized node since :) So I
thought I'll share it with ya!
  • Loading branch information
TilakMaddy authored Sep 16, 2024
1 parent e906f76 commit 3a9139a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/artifacts/solc/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ pub enum AssignmentOperator {
ShlAssign,
}

ast_node!(
expr_node!(
/// A binary operation.
struct BinaryOperation {
common_type: TypeDescriptions,
Expand Down Expand Up @@ -938,7 +938,7 @@ stmt_node!(
/// A return statement.
struct Return {
expression: Option<Expression>,
function_return_parameters: usize,
function_return_parameters: Option<usize>,
}
);

Expand Down

0 comments on commit 3a9139a

Please sign in to comment.