Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
0757c48a
Commit
0757c48a
authored
Jun 03, 2021
by
yann300
Committed by
Liana Husikyan
Jun 04, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix decode orphan struct definition
parent
50e46e43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
5 deletions
+26
-5
astHelper.ts
libs/remix-debug/src/solidity-decoder/astHelper.ts
+22
-1
decodeInfo.ts
libs/remix-debug/src/solidity-decoder/decodeInfo.ts
+4
-4
No files found.
libs/remix-debug/src/solidity-decoder/astHelper.ts
View file @
0757c48a
...
...
@@ -27,6 +27,27 @@ export function extractContractDefinitions (sourcesList) {
}
/**
* return nodes from an ast @arg sourcesList that are declared outside of a ContractDefinition @astList
*
* @param {Object} sourcesList - sources list (containing root AST node)
* @return {Object} - returns a list of node
*/
export
function
extractOrphanDefinitions
(
sourcesList
)
{
const
ret
=
[]
for
(
const
k
in
sourcesList
)
{
const
ast
=
sourcesList
[
k
].
ast
if
(
ast
.
nodes
&&
ast
.
nodes
.
length
)
{
for
(
const
node
of
ast
.
nodes
)
{
if
(
node
.
nodeType
!==
'ContractDefinition'
)
{
ret
.
push
(
node
)
}
}
}
}
return
ret
}
/**
* returns the linearized base contracts of the contract @arg id
*
* @param {Int} id - contract id to resolve
...
...
@@ -54,7 +75,7 @@ export function extractStateDefinitions (contractName, sourcesList, contracts) {
if
(
!
node
)
{
return
null
}
const
stateItems
=
[]
const
stateItems
=
extractOrphanDefinitions
(
sourcesList
)
const
stateVar
=
[]
const
baseContracts
=
getLinearizedBaseContracts
(
node
.
id
,
contracts
.
contractsById
)
baseContracts
.
reverse
()
...
...
libs/remix-debug/src/solidity-decoder/decodeInfo.ts
View file @
0757c48a
...
...
@@ -233,11 +233,11 @@ function getEnum (type, stateDefinitions, contractName) {
* @return {Array} containing all members of the current struct type
*/
function
getStructMembers
(
type
,
stateDefinitions
,
contractName
,
location
)
{
const
split
=
type
.
split
(
'.'
)
if
(
!
split
.
length
)
{
if
(
type
.
indexOf
(
'.'
)
===
-
1
)
{
type
=
contractName
+
'.'
+
type
}
else
{
contractName
=
split
[
0
]
}
if
(
!
contractName
)
{
contractName
=
type
.
split
(
'.'
)[
0
]
}
const
state
=
stateDefinitions
[
contractName
]
if
(
state
)
{
...
...
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