unpackdev / solgo

Solidity parser in Go, designed to transform Solidity code into a structured format for enhanced analysis, particularly beneficial for developers using Go to analyze Solidity smart contracts.
https://unpack.dev
Apache License 2.0
1 stars 0 forks source link

Bug in ast/index_access.go #190

Closed xianlinc closed 5 months ago

xianlinc commented 5 months ago

Context

Found a bug while trying to print an index access node in the AST.
source code: myArray[idx] Expected: myArray[idx] Actual: idx[myArray]

Problem

I think that the (i *IndexAccess) Parse method has a bug where the index and base expressions are swapped.

Currently:

Should be:

xianlinc commented 5 months ago

On a side note, I can't seem to label the issue due to lack of permissions 🫡

0x19 commented 5 months ago

Wow missed this one out. Thank you! Going to fix it tomorrow

0x19 commented 5 months ago

Alright @xianlinc it's resolved! Merging in soon the fix into the main. Thanks again for finding this out!