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
47200304
Commit
47200304
authored
Dec 11, 2017
by
ninabreznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include internal functions
parent
0b9f99af
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
12 deletions
+20
-12
contextualListener.js
src/app/editor/contextualListener.js
+20
-12
No files found.
src/app/editor/contextualListener.js
View file @
47200304
...
...
@@ -92,31 +92,39 @@ class ContextualListener {
}
_getGasEstimation
(
results
)
{
this
.
results
=
results
this
.
contractName
=
Object
.
keys
(
results
.
data
.
contracts
[
results
.
source
.
target
])[
0
]
this
.
target
=
results
.
data
.
contracts
[
results
.
source
.
target
]
this
.
functions
=
Object
.
keys
(
this
.
target
[
this
.
contractName
].
evm
.
gasEstimates
.
external
)
this
.
creationCost
=
this
.
target
[
this
.
contractName
].
evm
.
gasEstimates
.
creation
.
totalCost
this
.
contract
=
this
.
target
[
this
.
contractName
]
this
.
estimationObj
=
this
.
contract
.
evm
.
gasEstimates
if
(
this
.
estimationObj
.
external
)
this
.
externalFunctions
=
Object
.
keys
(
this
.
estimationObj
.
external
)
if
(
this
.
estimationObj
.
internal
)
this
.
internalFunctions
=
Object
.
keys
(
this
.
estimationObj
.
internal
)
this
.
creationCost
=
this
.
estimationObj
.
creation
.
totalCost
}
gasEstimation
(
node
)
{
if
(
node
.
name
===
'FunctionDefinition'
)
{
var
estimation
if
(
!
node
.
attributes
.
isConstructor
)
{
var
functionName
=
node
.
attributes
.
name
var
fn
for
(
var
x
in
this
.
functions
)
{
if
(
!!~
this
.
functions
[
x
].
indexOf
(
functionName
))
{
fn
=
this
.
functions
[
x
]
break
if
(
this
.
externalFunctions
)
{
return
this
.
estimationObj
.
external
[
this
.
_getFn
(
this
.
externalFunctions
,
functionName
)]
}
if
(
this
.
internalFunctions
)
{
return
this
.
estimationObj
.
internal
[
this
.
_getFn
(
this
.
internalFunctions
,
functionName
)]
}
estimation
=
this
.
target
[
this
.
contractName
].
evm
.
gasEstimates
.
external
[
fn
]
}
else
{
estimation
=
this
.
creationCost
return
this
.
creationCost
}
}
}
_getFn
(
functions
,
name
)
{
for
(
var
x
in
functions
)
{
if
(
!!~
functions
[
x
].
indexOf
(
name
))
{
var
fn
=
functions
[
x
]
break
}
}
return
estimatio
n
return
f
n
}
_highlight
(
node
,
compilationResult
)
{
...
...
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