Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
918ae29e
Commit
918ae29e
authored
Jun 27, 2023
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ast: cleanup
parent
ab777b4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
16 deletions
+7
-16
canonicalize.go
op-bindings/ast/canonicalize.go
+7
-16
No files found.
op-bindings/ast/canonicalize.go
View file @
918ae29e
...
@@ -61,6 +61,9 @@ func CanonicalizeASTIDs(in *solc.StorageLayout) *solc.StorageLayout {
...
@@ -61,6 +61,9 @@ func CanonicalizeASTIDs(in *solc.StorageLayout) *solc.StorageLayout {
continue
continue
}
}
// The storage types include the size when its a fixed size.
// This is subject to breaking in the future if a type with
// an ast id is added in a fixed storage type
if
strings
.
Contains
(
oldType
,
"storage"
)
{
if
strings
.
Contains
(
oldType
,
"storage"
)
{
continue
continue
}
}
...
@@ -106,8 +109,8 @@ func CanonicalizeASTIDs(in *solc.StorageLayout) *solc.StorageLayout {
...
@@ -106,8 +109,8 @@ func CanonicalizeASTIDs(in *solc.StorageLayout) *solc.StorageLayout {
}
}
func
replaceType
(
typeRemappings
map
[
string
]
string
,
in
string
)
string
{
func
replaceType
(
typeRemappings
map
[
string
]
string
,
in
string
)
string
{
if
typeRemappings
[
in
]
!=
""
{
if
remap
:=
typeRemappings
[
in
];
remap
!=
""
{
return
typeRemappings
[
in
]
return
remap
}
}
// Track the number of matches
// Track the number of matches
...
@@ -118,20 +121,8 @@ func replaceType(typeRemappings map[string]string, in string) string {
...
@@ -118,20 +121,8 @@ func replaceType(typeRemappings map[string]string, in string) string {
}
}
}
}
// Sometimes types are nested, so handle the recursive case iteratively
for
_
,
match
:=
range
matches
{
if
len
(
matches
)
>
1
{
in
=
strings
.
Replace
(
in
,
match
.
oldType
,
match
.
newType
,
1
)
for
_
,
match
:=
range
matches
{
in
=
strings
.
Replace
(
in
,
match
.
oldType
,
match
.
newType
,
1
)
}
return
in
}
// Its safe to return on the first match here as the case with multiple
// is handled above
for
oldType
,
newType
:=
range
typeRemappings
{
if
strings
.
Contains
(
in
,
oldType
)
{
return
strings
.
Replace
(
in
,
oldType
,
newType
,
1
)
}
}
}
return
in
return
in
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment