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
a4a00480
Commit
a4a00480
authored
Jan 19, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make struct / array label more specific
parent
7f30c458
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
9 deletions
+17
-9
decodeInfo.js
src/solidity/decodeInfo.js
+1
-1
ArrayType.js
src/solidity/types/ArrayType.js
+1
-1
Struct.js
src/solidity/types/Struct.js
+2
-2
SolidityTypeFormatter.js
src/ui/SolidityTypeFormatter.js
+13
-5
No files found.
src/solidity/decodeInfo.js
View file @
a4a00480
...
@@ -181,7 +181,7 @@ function struct (type, stateDefinitions, contractName, location) {
...
@@ -181,7 +181,7 @@ function struct (type, stateDefinitions, contractName, location) {
}
}
var
memberDetails
=
getStructMembers
(
match
[
1
],
stateDefinitions
,
contractName
,
location
)
// type is used to extract the ast struct definition
var
memberDetails
=
getStructMembers
(
match
[
1
],
stateDefinitions
,
contractName
,
location
)
// type is used to extract the ast struct definition
if
(
!
memberDetails
)
return
null
if
(
!
memberDetails
)
return
null
return
new
StructType
(
memberDetails
,
location
)
return
new
StructType
(
memberDetails
,
location
,
match
[
1
]
)
}
else
{
}
else
{
return
null
return
null
}
}
...
...
src/solidity/types/ArrayType.js
View file @
a4a00480
...
@@ -17,7 +17,7 @@ class ArrayType extends RefType {
...
@@ -17,7 +17,7 @@ class ArrayType extends RefType {
storageSlots
=
arraySize
*
underlyingType
.
storageSlots
storageSlots
=
arraySize
*
underlyingType
.
storageSlots
}
}
}
}
super
(
storageSlots
,
32
,
'array
'
,
location
)
super
(
storageSlots
,
32
,
underlyingType
.
typeName
+
'['
+
arraySize
+
']
'
,
location
)
this
.
underlyingType
=
underlyingType
this
.
underlyingType
=
underlyingType
this
.
arraySize
=
arraySize
this
.
arraySize
=
arraySize
}
}
...
...
src/solidity/types/Struct.js
View file @
a4a00480
...
@@ -3,8 +3,8 @@ var util = require('./util')
...
@@ -3,8 +3,8 @@ var util = require('./util')
var
RefType
=
require
(
'./RefType'
)
var
RefType
=
require
(
'./RefType'
)
class
Struct
extends
RefType
{
class
Struct
extends
RefType
{
constructor
(
memberDetails
,
location
)
{
constructor
(
memberDetails
,
location
,
fullType
)
{
super
(
memberDetails
.
storageSlots
,
32
,
'struct
'
,
location
)
super
(
memberDetails
.
storageSlots
,
32
,
'struct
'
+
fullType
,
location
)
this
.
members
=
memberDetails
.
members
this
.
members
=
memberDetails
.
members
}
}
...
...
src/ui/SolidityTypeFormatter.js
View file @
a4a00480
...
@@ -9,7 +9,7 @@ module.exports = {
...
@@ -9,7 +9,7 @@ module.exports = {
function
formatData
(
key
,
data
)
{
function
formatData
(
key
,
data
)
{
var
style
=
fontColor
(
data
)
var
style
=
fontColor
(
data
)
var
type
=
''
var
type
=
''
if
(
data
.
type
!==
'array'
&&
data
.
type
!==
'struct'
)
{
if
(
!
isArray
(
data
.
type
)
&&
!
isStruct
(
data
.
type
)
)
{
type
=
data
.
type
type
=
data
.
type
}
}
return
yo
`<label>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
type
}
</label></label>`
return
yo
`<label>
${
key
}
: <label style=
${
style
}
>
${
data
.
self
}
</label><label style='font-style:italic'>
${
type
}
</label></label>`
...
@@ -17,10 +17,10 @@ function formatData (key, data) {
...
@@ -17,10 +17,10 @@ function formatData (key, data) {
function
extractData
(
item
,
key
)
{
function
extractData
(
item
,
key
)
{
var
ret
=
{}
var
ret
=
{}
if
(
i
tem
.
type
===
'array'
)
{
if
(
i
sArray
(
item
.
type
)
)
{
ret
.
children
=
item
.
value
||
[]
ret
.
children
=
item
.
value
||
[]
ret
.
self
=
'Array'
+
'['
+
ret
.
children
.
length
+
']'
ret
.
self
=
item
.
type
}
else
if
(
i
tem
.
type
===
'struct'
)
{
}
else
if
(
i
sStruct
(
item
.
type
)
)
{
ret
.
children
=
item
.
value
||
[]
ret
.
children
=
item
.
value
||
[]
ret
.
self
=
'Struct'
+
'{'
+
Object
.
keys
(
ret
.
children
).
length
+
'}'
ret
.
self
=
'Struct'
+
'{'
+
Object
.
keys
(
ret
.
children
).
length
+
'}'
}
else
{
}
else
{
...
@@ -33,7 +33,7 @@ function extractData (item, key) {
...
@@ -33,7 +33,7 @@ function extractData (item, key) {
function
fontColor
(
data
)
{
function
fontColor
(
data
)
{
var
color
=
'#124B46'
var
color
=
'#124B46'
if
(
data
.
type
===
'array'
||
data
.
type
===
'struct'
)
{
if
(
isArray
(
data
.
type
)
||
isStruct
(
data
.
type
)
)
{
color
=
'#847979'
color
=
'#847979'
}
else
if
(
data
.
type
.
indexOf
(
'uint'
)
===
0
||
}
else
if
(
data
.
type
.
indexOf
(
'uint'
)
===
0
||
data
.
type
.
indexOf
(
'int'
)
===
0
||
data
.
type
.
indexOf
(
'int'
)
===
0
||
...
@@ -45,3 +45,11 @@ function fontColor (data) {
...
@@ -45,3 +45,11 @@ function fontColor (data) {
}
}
return
'color:'
+
color
return
'color:'
+
color
}
}
function
isArray
(
type
)
{
return
type
.
lastIndexOf
(
']'
)
===
type
.
length
-
1
}
function
isStruct
(
type
)
{
return
type
.
indexOf
(
'struct'
)
===
0
}
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