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
b457d7d1
Commit
b457d7d1
authored
Jul 22, 2020
by
Iuri Matias
Committed by
aniket-engg
Aug 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some unnecessary elses
parent
b87ae778
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
32 deletions
+24
-32
astHelper.js
libs/remix-debug/src/solidity-decoder/astHelper.js
+15
-18
Bool.js
libs/remix-debug/src/solidity-decoder/types/Bool.js
+2
-3
Enum.js
libs/remix-debug/src/solidity-decoder/types/Enum.js
+5
-7
util.js
libs/remix-debug/src/solidity-decoder/types/util.js
+2
-4
No files found.
libs/remix-debug/src/solidity-decoder/astHelper.js
View file @
b457d7d1
...
...
@@ -51,27 +51,24 @@ function extractStateDefinitions (contractName, sourcesList, contracts) {
contracts
=
extractContractDefinitions
(
sourcesList
)
}
const
node
=
contracts
.
contractsByName
[
contractName
]
if
(
node
)
{
const
stateItems
=
[]
const
stateVar
=
[]
const
baseContracts
=
getLinearizedBaseContracts
(
node
.
id
,
contracts
.
contractsById
)
baseContracts
.
reverse
()
for
(
let
k
in
baseContracts
)
{
const
ctr
=
baseContracts
[
k
]
for
(
let
i
in
ctr
.
children
)
{
const
item
=
ctr
.
children
[
i
]
stateItems
.
push
(
item
)
if
(
item
.
name
===
'VariableDeclaration'
)
{
stateVar
.
push
(
item
)
}
if
(
!
node
)
{
return
null
}
const
stateItems
=
[]
const
stateVar
=
[]
const
baseContracts
=
getLinearizedBaseContracts
(
node
.
id
,
contracts
.
contractsById
)
baseContracts
.
reverse
()
for
(
let
k
in
baseContracts
)
{
const
ctr
=
baseContracts
[
k
]
for
(
let
i
in
ctr
.
children
)
{
const
item
=
ctr
.
children
[
i
]
stateItems
.
push
(
item
)
if
(
item
.
name
===
'VariableDeclaration'
)
{
stateVar
.
push
(
item
)
}
}
return
{
stateDefinitions
:
stateItems
,
stateVariables
:
stateVar
}
}
return
null
return
{
stateDefinitions
:
stateItems
,
stateVariables
:
stateVar
}
}
/**
...
...
libs/remix-debug/src/solidity-decoder/types/Bool.js
View file @
b457d7d1
...
...
@@ -10,10 +10,9 @@ class Bool extends ValueType {
decodeValue
(
value
)
{
if
(
!
value
)
{
return
false
}
else
{
value
=
util
.
extractHexByteSlice
(
value
,
this
.
storageBytes
,
0
)
return
value
!==
'00'
}
value
=
util
.
extractHexByteSlice
(
value
,
this
.
storageBytes
,
0
)
return
value
!==
'00'
}
}
...
...
libs/remix-debug/src/solidity-decoder/types/Enum.js
View file @
b457d7d1
...
...
@@ -16,14 +16,12 @@ class Enum extends ValueType {
decodeValue
(
value
)
{
if
(
!
value
)
{
return
this
.
enumDef
.
children
[
0
].
attributes
.
name
}
else
{
value
=
parseInt
(
value
,
16
)
if
(
this
.
enumDef
.
children
.
length
>
value
)
{
return
this
.
enumDef
.
children
[
value
].
attributes
.
name
}
else
{
return
'INVALID_ENUM<'
+
value
+
'>'
}
}
value
=
parseInt
(
value
,
16
)
if
(
this
.
enumDef
.
children
.
length
>
value
)
{
return
this
.
enumDef
.
children
[
value
].
attributes
.
name
}
return
'INVALID_ENUM<'
+
value
+
'>'
}
}
...
...
libs/remix-debug/src/solidity-decoder/types/util.js
View file @
b457d7d1
...
...
@@ -100,9 +100,8 @@ function extractLocation (type) {
let
match
=
type
.
match
(
/
(
storage ref| storage pointer| memory| calldata
)?
$/
)
if
(
match
[
1
]
!==
''
)
{
return
match
[
1
].
trim
()
}
else
{
return
null
}
return
null
}
function
extractLocationFromAstVariable
(
node
)
{
...
...
@@ -110,9 +109,8 @@ function extractLocationFromAstVariable (node) {
return
node
.
attributes
.
storageLocation
}
else
if
(
node
.
attributes
.
stateVariable
)
{
return
'storage'
}
else
{
return
'default'
// local variables => storage, function parameters & return values => memory, state => storage
}
return
'default'
// local variables => storage, function parameters & return values => memory, state => storage
}
function
normalizeHex
(
hex
)
{
...
...
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