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
95f68f04
Commit
95f68f04
authored
May 18, 2020
by
aniket-engg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variable getter util
parent
ad4ba658
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
gasCosts.ts
remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts
+2
-2
staticAnalysisCommon.ts
...zer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
+10
-0
No files found.
remix-analyzer/src/solidity-analyzer/modules/gasCosts.ts
View file @
95f68f04
import
{
default
as
category
}
from
'./categories'
import
{
default
as
category
}
from
'./categories'
import
{
default
as
algorithm
}
from
'./algorithmCategories'
import
{
default
as
algorithm
}
from
'./algorithmCategories'
import
{
getFunctionDefinitionName
,
helpers
}
from
'./staticAnalysisCommon'
import
{
getFunctionDefinitionName
,
helpers
,
isVariableTurnedIntoGetter
}
from
'./staticAnalysisCommon'
import
{
ModuleAlgorithm
,
ModuleCategory
,
ReportObj
,
CompilationResult
,
CompiledContract
,
AnalyzerModule
,
import
{
ModuleAlgorithm
,
ModuleCategory
,
ReportObj
,
CompilationResult
,
CompiledContract
,
AnalyzerModule
,
FunctionDefinitionAstNode
,
VariableDeclarationAstNode
}
from
'./../../types'
FunctionDefinitionAstNode
,
VariableDeclarationAstNode
}
from
'./../../types'
...
@@ -13,7 +13,7 @@ export default class gasCosts implements AnalyzerModule {
...
@@ -13,7 +13,7 @@ export default class gasCosts implements AnalyzerModule {
warningNodes
:
any
[]
=
[]
warningNodes
:
any
[]
=
[]
visit
(
node
:
FunctionDefinitionAstNode
|
VariableDeclarationAstNode
):
void
{
visit
(
node
:
FunctionDefinitionAstNode
|
VariableDeclarationAstNode
):
void
{
if
((
node
.
nodeType
===
'FunctionDefinition'
&&
node
.
kind
!==
'constructor'
&&
node
.
implemented
)
||
if
((
node
.
nodeType
===
'FunctionDefinition'
&&
node
.
kind
!==
'constructor'
&&
node
.
implemented
)
||
(
node
.
nodeType
===
'VariableDeclaration'
&&
node
.
stateVariable
&&
node
.
visibility
===
'public'
))
(
node
.
nodeType
===
'VariableDeclaration'
&&
isVariableTurnedIntoGetter
(
node
)
))
this
.
warningNodes
.
push
(
node
)
this
.
warningNodes
.
push
(
node
)
}
}
...
...
remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
View file @
95f68f04
...
@@ -642,6 +642,15 @@ function isConstantFunction (node: FunctionDefinitionAstNode): boolean {
...
@@ -642,6 +642,15 @@ function isConstantFunction (node: FunctionDefinitionAstNode): boolean {
}
}
/**
/**
* True if variable decalaration is converted into a getter method
* @node {ASTNode} variable declaration AstNode
* @return {bool}
*/
function
isVariableTurnedIntoGetter
(
varDeclNode
:
VariableDeclarationAstNode
):
boolean
{
return
varDeclNode
.
stateVariable
&&
varDeclNode
.
visibility
===
'public'
;
}
/**
* True if is function defintion has payable modifier
* True if is function defintion has payable modifier
* @node {ASTNode} some AstNode
* @node {ASTNode} some AstNode
* @return {bool}
* @return {bool}
...
@@ -1109,6 +1118,7 @@ export {
...
@@ -1109,6 +1118,7 @@ export {
isDeleteFromDynamicArray
,
isDeleteFromDynamicArray
,
isAbiNamespaceCall
,
isAbiNamespaceCall
,
isSpecialVariableAccess
,
isSpecialVariableAccess
,
isVariableTurnedIntoGetter
,
isDynamicArrayAccess
,
isDynamicArrayAccess
,
isDynamicArrayLengthAccess
,
isDynamicArrayLengthAccess
,
isMappingIndexAccess
,
isMappingIndexAccess
,
...
...
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