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
39d7b2f0
Commit
39d7b2f0
authored
Jan 11, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add decodeInternal to RefType
parent
249dbdf6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
22 deletions
+17
-22
ArrayType.js
src/solidity/types/ArrayType.js
+0
-4
RefType.js
src/solidity/types/RefType.js
+17
-14
Struct.js
src/solidity/types/Struct.js
+0
-4
No files found.
src/solidity/types/ArrayType.js
View file @
39d7b2f0
...
@@ -67,10 +67,6 @@ class ArrayType extends RefType {
...
@@ -67,10 +67,6 @@ class ArrayType extends RefType {
this
.
underlyingType
.
location
=
this
.
location
this
.
underlyingType
.
location
=
this
.
location
for
(
var
k
=
0
;
k
<
length
;
k
++
)
{
for
(
var
k
=
0
;
k
<
length
;
k
++
)
{
var
contentOffset
=
offset
var
contentOffset
=
offset
if
(
this
.
underlyingType
.
basicType
===
'RefType'
)
{
contentOffset
=
memory
.
substr
(
2
*
contentOffset
,
64
)
contentOffset
=
parseInt
(
contentOffset
,
16
)
}
ret
.
push
(
this
.
underlyingType
.
decode
(
contentOffset
,
memory
))
ret
.
push
(
this
.
underlyingType
.
decode
(
contentOffset
,
memory
))
offset
+=
32
offset
+=
32
}
}
...
...
src/solidity/types/RefType.js
View file @
39d7b2f0
...
@@ -11,28 +11,31 @@ class RefType {
...
@@ -11,28 +11,31 @@ class RefType {
}
}
decodeFromStack
(
stackDepth
,
stack
,
memory
,
storage
)
{
decodeFromStack
(
stackDepth
,
stack
,
memory
,
storage
)
{
if
(
!
storage
)
{
storage
=
{}
// TODO this is a fallback, should manage properly locals store in storage
}
if
(
stack
.
length
-
1
<
stackDepth
)
{
if
(
stack
.
length
-
1
<
stackDepth
)
{
return
{
error
:
'<decoding failed - stack underflow '
+
stackDepth
+
'>'
}
return
{
error
:
'<decoding failed - stack underflow '
+
stackDepth
+
'>'
}
}
}
var
offset
=
stack
[
stack
.
length
-
1
-
stackDepth
]
var
offset
=
stack
[
stack
.
length
-
1
-
stackDepth
]
offset
=
parseInt
(
offset
,
16
)
offset
=
parseInt
(
offset
,
16
)
return
this
.
decode
(
offset
,
memory
,
storage
)
return
decodeInternal
(
this
,
offset
,
memory
,
storage
)
}
}
decode
(
offset
,
memory
,
storage
)
{
decode
(
offset
,
memory
,
storage
)
{
if
(
!
storage
)
{
offset
=
memory
.
substr
(
2
*
offset
,
64
)
storage
=
{}
// TODO this is a fallback, should manage properly locals store in storage
offset
=
parseInt
(
offset
,
16
)
}
return
decodeInternal
(
this
,
offset
,
memory
,
storage
)
if
(
util
.
storageStore
(
this
))
{
}
return
this
.
decodeFromStorage
({
offset
:
0
,
slot
:
offset
},
storage
)
}
}
else
if
(
util
.
memoryStore
(
this
))
{
return
this
.
decodeFromMemory
(
offset
,
memory
)
function
decodeInternal
(
self
,
offset
,
memory
,
storage
)
{
}
else
{
if
(
!
storage
)
{
return
{
error
:
'<decoding failed - no decoder for '
+
this
.
location
+
'>'
}
storage
=
{}
// TODO this is a fallback, should manage properly locals store in storage
}
}
if
(
util
.
storageStore
(
self
))
{
return
self
.
decodeFromStorage
({
offset
:
0
,
slot
:
offset
},
storage
)
}
else
if
(
util
.
memoryStore
(
self
))
{
return
self
.
decodeFromMemory
(
offset
,
memory
)
}
else
{
return
{
error
:
'<decoding failed - no decoder for '
+
self
.
location
+
'>'
}
}
}
}
}
...
...
src/solidity/types/Struct.js
View file @
39d7b2f0
...
@@ -24,10 +24,6 @@ class Struct extends RefType {
...
@@ -24,10 +24,6 @@ class Struct extends RefType {
var
ret
=
{}
var
ret
=
{}
this
.
members
.
map
((
item
,
i
)
=>
{
this
.
members
.
map
((
item
,
i
)
=>
{
var
contentOffset
=
offset
var
contentOffset
=
offset
if
(
item
.
type
.
basicType
===
'RefType'
)
{
contentOffset
=
memory
.
substr
(
2
*
contentOffset
,
64
)
contentOffset
=
parseInt
(
contentOffset
,
16
)
}
item
.
type
.
location
=
this
.
location
item
.
type
.
location
=
this
.
location
var
member
=
item
.
type
.
decode
(
contentOffset
,
memory
)
var
member
=
item
.
type
.
decode
(
contentOffset
,
memory
)
ret
[
item
.
name
]
=
member
ret
[
item
.
name
]
=
member
...
...
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