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
0e392522
Commit
0e392522
authored
Oct 31, 2016
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove name attribute from decoderinfo
parent
51ed62b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
30 deletions
+19
-30
decodeInfo.js
src/solidity/decodeInfo.js
+10
-20
decodeInfo.js
test/decodeInfo.js
+9
-10
No files found.
src/solidity/decodeInfo.js
View file @
0e392522
...
@@ -13,8 +13,7 @@ function Uint (type) {
...
@@ -13,8 +13,7 @@ function Uint (type) {
return
{
return
{
needsFreeStorageSlot
:
false
,
needsFreeStorageSlot
:
false
,
storageBytes
:
parseInt
(
type
.
replace
(
'uint'
,
''
))
/
8
,
storageBytes
:
parseInt
(
type
.
replace
(
'uint'
,
''
))
/
8
,
typeName
:
type
,
typeName
:
type
name
:
'uint'
}
}
}
}
...
@@ -28,8 +27,7 @@ function Address (type) {
...
@@ -28,8 +27,7 @@ function Address (type) {
return
{
return
{
needsFreeStorageSlot
:
false
,
needsFreeStorageSlot
:
false
,
storageBytes
:
20
,
storageBytes
:
20
,
typeName
:
'address'
,
typeName
:
'address'
name
:
'address'
}
}
}
}
...
@@ -43,8 +41,7 @@ function Bool (type) {
...
@@ -43,8 +41,7 @@ function Bool (type) {
return
{
return
{
needsFreeStorageSlot
:
false
,
needsFreeStorageSlot
:
false
,
storageBytes
:
1
,
storageBytes
:
1
,
typeName
:
'bool'
,
typeName
:
'bool'
name
:
'bool'
}
}
}
}
...
@@ -58,8 +55,7 @@ function DynamicByteArray (type) {
...
@@ -58,8 +55,7 @@ function DynamicByteArray (type) {
return
{
return
{
needsFreeStorageSlot
:
true
,
needsFreeStorageSlot
:
true
,
storageBytes
:
32
,
storageBytes
:
32
,
typeName
:
'bytes'
,
typeName
:
'bytes'
name
:
'dynamicByteArray'
}
}
}
}
...
@@ -76,8 +72,7 @@ function FixedByteArray (type) {
...
@@ -76,8 +72,7 @@ function FixedByteArray (type) {
return
{
return
{
needsFreeStorageSlot
:
false
,
needsFreeStorageSlot
:
false
,
storageBytes
:
parseInt
(
type
.
replace
(
'bytes'
,
''
)),
storageBytes
:
parseInt
(
type
.
replace
(
'bytes'
,
''
)),
typeName
:
type
.
split
(
' '
)[
0
],
typeName
:
type
.
split
(
' '
)[
0
]
name
:
'fixedByteArray'
}
}
}
}
...
@@ -94,8 +89,7 @@ function Int (type) {
...
@@ -94,8 +89,7 @@ function Int (type) {
return
{
return
{
needsFreeStorageSlot
:
false
,
needsFreeStorageSlot
:
false
,
storageBytes
:
parseInt
(
type
.
replace
(
'int'
,
''
))
/
8
,
storageBytes
:
parseInt
(
type
.
replace
(
'int'
,
''
))
/
8
,
typeName
:
type
,
typeName
:
type
name
:
'int'
}
}
}
}
...
@@ -109,8 +103,7 @@ function StringType (type) {
...
@@ -109,8 +103,7 @@ function StringType (type) {
return
{
return
{
needsFreeStorageSlot
:
true
,
needsFreeStorageSlot
:
true
,
storageBytes
:
32
,
storageBytes
:
32
,
typeName
:
'string'
,
typeName
:
'string'
name
:
'stringType'
}
}
}
}
...
@@ -153,8 +146,7 @@ function ArrayType (type, stateDefinitions) {
...
@@ -153,8 +146,7 @@ function ArrayType (type, stateDefinitions) {
storageBytes
:
storageBytes
,
storageBytes
:
storageBytes
,
typeName
:
type
,
typeName
:
type
,
arraySize
:
arraySize
,
arraySize
:
arraySize
,
subArray
:
subArray
,
subArray
:
subArray
name
:
'arrayType'
}
}
}
}
...
@@ -170,8 +162,7 @@ function Enum (type, stateDefinitions) {
...
@@ -170,8 +162,7 @@ function Enum (type, stateDefinitions) {
needsFreeStorageSlot
:
false
,
needsFreeStorageSlot
:
false
,
storageBytes
:
1
,
storageBytes
:
1
,
typeName
:
extracted
[
0
]
+
' '
+
extracted
[
1
],
typeName
:
extracted
[
0
]
+
' '
+
extracted
[
1
],
enum
:
getEnum
(
type
,
stateDefinitions
),
enum
:
getEnum
(
type
,
stateDefinitions
)
name
:
'enum'
}
}
}
}
...
@@ -189,8 +180,7 @@ function Struct (type, stateDefinitions) {
...
@@ -189,8 +180,7 @@ function Struct (type, stateDefinitions) {
needsFreeStorageSlot
:
true
,
needsFreeStorageSlot
:
true
,
storageBytes
:
membersDetails
.
storageBytes
,
storageBytes
:
membersDetails
.
storageBytes
,
typeName
:
type
,
typeName
:
type
,
members
:
membersDetails
.
members
,
members
:
membersDetails
.
members
name
:
'struct'
}
}
}
}
...
...
test/decodeInfo.js
View file @
0e392522
...
@@ -9,27 +9,27 @@ tape('solidity', function (t) {
...
@@ -9,27 +9,27 @@ tape('solidity', function (t) {
var
stateDec
=
index
.
solidity
.
astHelper
.
extractStateVariables
(
'contractUint'
,
output
.
sources
)
var
stateDec
=
index
.
solidity
.
astHelper
.
extractStateVariables
(
'contractUint'
,
output
.
sources
)
var
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
0
].
attributes
.
type
,
stateDec
)
var
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
0
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
false
,
1
,
'uint8'
,
'uint'
)
checkDecodeInfo
(
st
,
decodeInfo
,
false
,
1
,
'uint8'
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
2
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
2
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
false
,
32
,
'uint256'
,
'uint'
)
checkDecodeInfo
(
st
,
decodeInfo
,
false
,
32
,
'uint256'
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
3
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
3
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
false
,
32
,
'uint256'
,
'uint'
)
checkDecodeInfo
(
st
,
decodeInfo
,
false
,
32
,
'uint256'
)
stateDec
=
index
.
solidity
.
astHelper
.
extractStateVariables
(
'contractStructAndArray'
,
output
.
sources
)
stateDec
=
index
.
solidity
.
astHelper
.
extractStateVariables
(
'contractStructAndArray'
,
output
.
sources
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
1
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
1
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
64
,
'struct structDef'
,
'struct'
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
64
,
'struct structDef'
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
2
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
2
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
192
,
'struct structDef[3]'
,
'arrayType'
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
192
,
'struct structDef[3]'
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
3
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
3
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
48
,
'bytes12[4]'
,
'arrayType'
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
48
,
'bytes12[4]'
)
stateDec
=
index
.
solidity
.
astHelper
.
extractStateVariables
(
'contractArray'
,
output
.
sources
)
stateDec
=
index
.
solidity
.
astHelper
.
extractStateVariables
(
'contractArray'
,
output
.
sources
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
0
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
0
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
4
*
5
,
'uint32[5]'
,
'arrayType'
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
4
*
5
,
'uint32[5]'
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
1
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
1
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
32
,
'int8[]'
,
'arrayType'
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
32
,
'int8[]'
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
2
].
attributes
.
type
,
stateDec
)
decodeInfo
=
index
.
solidity
.
decodeInfo
.
decode
(
stateDec
[
2
].
attributes
.
type
,
stateDec
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
4
*
32
,
'int16[][3][][4]'
,
'arrayType'
)
checkDecodeInfo
(
st
,
decodeInfo
,
true
,
4
*
32
,
'int16[][3][][4]'
)
st
.
end
()
st
.
end
()
})
})
})
})
...
@@ -38,7 +38,6 @@ function checkDecodeInfo (st, decodeInfo, freeSlot, storageBytes, typeName, name
...
@@ -38,7 +38,6 @@ function checkDecodeInfo (st, decodeInfo, freeSlot, storageBytes, typeName, name
st
.
equal
(
decodeInfo
.
needsFreeStorageSlot
,
freeSlot
)
st
.
equal
(
decodeInfo
.
needsFreeStorageSlot
,
freeSlot
)
st
.
equal
(
decodeInfo
.
storageBytes
,
storageBytes
)
st
.
equal
(
decodeInfo
.
storageBytes
,
storageBytes
)
st
.
equal
(
decodeInfo
.
typeName
,
typeName
)
st
.
equal
(
decodeInfo
.
typeName
,
typeName
)
st
.
equal
(
decodeInfo
.
name
,
name
)
}
}
var
contracts
=
`
var
contracts
=
`
...
...
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