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
e7ef7f4f
Commit
e7ef7f4f
authored
Jan 09, 2017
by
yann300
Committed by
GitHub
Jan 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #160 from ethereum/mapping
add mapping type
parents
a3dc9679
a6ce24a1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
decodeInfo.js
src/solidity/decodeInfo.js
+16
-1
Mapping.js
src/solidity/types/Mapping.js
+13
-0
No files found.
src/solidity/decodeInfo.js
View file @
e7ef7f4f
...
@@ -10,6 +10,17 @@ var StringType = require('./types/StringType')
...
@@ -10,6 +10,17 @@ var StringType = require('./types/StringType')
var
StructType
=
require
(
'./types/Struct'
)
var
StructType
=
require
(
'./types/Struct'
)
var
IntType
=
require
(
'./types/Int'
)
var
IntType
=
require
(
'./types/Int'
)
var
UintType
=
require
(
'./types/Uint'
)
var
UintType
=
require
(
'./types/Uint'
)
var
MappingType
=
require
(
'./types/Mapping'
)
/**
* mapping decode the given @arg type
*
* @param {String} type - type given by the AST
* @return {Object} returns decoded info about the current type: { storageBytes, typeName}
*/
function
Mapping
(
type
)
{
return
new
MappingType
()
}
/**
/**
* Uint decode the given @arg type
* Uint decode the given @arg type
...
@@ -212,6 +223,9 @@ function typeClass (fullType) {
...
@@ -212,6 +223,9 @@ function typeClass (fullType) {
if
(
fullType
.
indexOf
(
']'
)
!==
-
1
)
{
if
(
fullType
.
indexOf
(
']'
)
!==
-
1
)
{
return
'array'
return
'array'
}
}
if
(
fullType
.
indexOf
(
'mapping'
)
===
0
)
{
return
'mapping'
}
if
(
fullType
.
indexOf
(
' '
)
!==
-
1
)
{
if
(
fullType
.
indexOf
(
' '
)
!==
-
1
)
{
fullType
=
fullType
.
split
(
' '
)[
0
]
fullType
=
fullType
.
split
(
' '
)[
0
]
}
}
...
@@ -238,7 +252,8 @@ function parseType (type, stateDefinitions, contractName) {
...
@@ -238,7 +252,8 @@ function parseType (type, stateDefinitions, contractName) {
'string'
:
String
,
'string'
:
String
,
'struct'
:
Struct
,
'struct'
:
Struct
,
'int'
:
Int
,
'int'
:
Int
,
'uint'
:
Uint
'uint'
:
Uint
,
'mapping'
:
Mapping
}
}
var
currentType
=
typeClass
(
type
)
var
currentType
=
typeClass
(
type
)
if
(
currentType
===
null
)
{
if
(
currentType
===
null
)
{
...
...
src/solidity/types/Mapping.js
0 → 100644
View file @
e7ef7f4f
'use strict'
function
Mapping
()
{
this
.
storageSlots
=
1
this
.
storageBytes
=
32
this
.
typeName
=
'mapping'
}
Mapping
.
prototype
.
decodeFromStorage
=
function
(
location
,
storageContent
)
{
return
'<not implemented>'
}
module
.
exports
=
Mapping
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