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
d2ec3546
Commit
d2ec3546
authored
Jan 03, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
small refactor
parent
f1654fcd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
contextualListener.js
src/app/editor/contextualListener.js
+8
-12
No files found.
src/app/editor/contextualListener.js
View file @
d2ec3546
...
@@ -130,16 +130,8 @@ class ContextualListener {
...
@@ -130,16 +130,8 @@ class ContextualListener {
this
.
_activeHighlights
=
[]
this
.
_activeHighlights
=
[]
}
}
// GET GAS ESTIMATION
_getGasEstimation
(
contract
)
{
this
.
contract
=
this
.
results
.
data
.
contracts
[
this
.
results
.
source
.
target
][
contract
.
attributes
.
name
]
this
.
estimationObj
=
this
.
contract
.
evm
.
gasEstimates
this
.
creationCost
=
this
.
estimationObj
.
creation
.
totalCost
this
.
codeDepositCost
=
this
.
estimationObj
.
creation
.
codeDepositCost
}
gasEstimation
(
node
)
{
gasEstimation
(
node
)
{
this
.
_
getContract
(
node
)
this
.
_
loadContractInfos
(
node
)
var
executionCost
var
executionCost
var
codeDepositCost
var
codeDepositCost
if
(
node
.
name
===
'FunctionDefinition'
)
{
if
(
node
.
name
===
'FunctionDefinition'
)
{
...
@@ -162,10 +154,14 @@ class ContextualListener {
...
@@ -162,10 +154,14 @@ class ContextualListener {
return
{
executionCost
,
codeDepositCost
}
return
{
executionCost
,
codeDepositCost
}
}
}
_
getContract
(
node
)
{
_
loadContractInfos
(
node
)
{
for
(
var
i
in
this
.
nodes
)
{
for
(
var
i
in
this
.
nodes
)
{
if
(
this
.
nodes
[
i
].
id
===
node
.
attributes
.
scope
)
{
if
(
this
.
nodes
[
i
].
id
===
node
.
attributes
.
scope
)
{
return
this
.
_getGasEstimation
(
this
.
nodes
[
i
])
var
contract
=
this
.
nodes
[
i
]
this
.
contract
=
this
.
results
.
data
.
contracts
[
this
.
results
.
source
.
target
][
contract
.
attributes
.
name
]
this
.
estimationObj
=
this
.
contract
.
evm
.
gasEstimates
this
.
creationCost
=
this
.
estimationObj
.
creation
.
totalCost
this
.
codeDepositCost
=
this
.
estimationObj
.
creation
.
codeDepositCost
}
}
}
}
}
}
...
@@ -182,7 +178,7 @@ class ContextualListener {
...
@@ -182,7 +178,7 @@ class ContextualListener {
var
children
=
target
.
children
var
children
=
target
.
children
for
(
var
j
in
children
)
{
for
(
var
j
in
children
)
{
if
(
children
[
j
].
name
===
'VariableDeclaration'
)
{
if
(
children
[
j
].
name
===
'VariableDeclaration'
)
{
params
.
push
(
children
[
j
].
attributes
.
type
.
split
(
' '
)[
0
]
)
params
.
push
(
children
[
j
].
attributes
.
type
)
}
}
}
}
}
}
...
...
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