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
d54c3960
Commit
d54c3960
authored
Apr 17, 2018
by
Leonardo Alt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 'potentially should be const' for constructors in static analysis
parent
fa411bb4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
constantFunctions.js
remix-solidity/src/analysis/modules/constantFunctions.js
+1
-1
staticAnalysisCommon.js
remix-solidity/src/analysis/modules/staticAnalysisCommon.js
+12
-0
No files found.
remix-solidity/src/analysis/modules/constantFunctions.js
View file @
d54c3960
...
@@ -34,7 +34,7 @@ function report (contracts, multipleContractsWithSameName) {
...
@@ -34,7 +34,7 @@ function report (contracts, multipleContractsWithSameName) {
contracts
.
forEach
((
contract
)
=>
{
contracts
.
forEach
((
contract
)
=>
{
contract
.
functions
.
forEach
((
func
)
=>
{
contract
.
functions
.
forEach
((
func
)
=>
{
if
(
common
.
isPayableFunction
(
func
.
node
))
{
if
(
common
.
isPayableFunction
(
func
.
node
)
||
common
.
isConstructor
(
func
.
node
)
)
{
func
.
potentiallyshouldBeConst
=
false
func
.
potentiallyshouldBeConst
=
false
}
else
{
}
else
{
func
.
potentiallyshouldBeConst
=
checkIfShouldBeConstant
(
common
.
getFullQuallyfiedFuncDefinitionIdent
(
contract
.
node
,
func
.
node
,
func
.
parameters
),
func
.
potentiallyshouldBeConst
=
checkIfShouldBeConstant
(
common
.
getFullQuallyfiedFuncDefinitionIdent
(
contract
.
node
,
func
.
node
,
func
.
parameters
),
...
...
remix-solidity/src/analysis/modules/staticAnalysisCommon.js
View file @
d54c3960
...
@@ -521,6 +521,17 @@ function isPayableFunction (node) {
...
@@ -521,6 +521,17 @@ function isPayableFunction (node) {
}
}
/**
/**
* True if is constructor
* @node {ASTNode} some AstNode
* @return {bool}
*/
function
isConstructor
(
node
)
{
return
isFunctionDefinition
(
node
)
&&
(
node
.
attributes
.
isConstructor
===
true
)
}
/**
* True if unary increment operation
* True if unary increment operation
* @node {ASTNode} some AstNode
* @node {ASTNode} some AstNode
* @return {bool}
* @return {bool}
...
@@ -857,6 +868,7 @@ module.exports = {
...
@@ -857,6 +868,7 @@ module.exports = {
isContractDefinition
:
isContractDefinition
,
isContractDefinition
:
isContractDefinition
,
isConstantFunction
:
isConstantFunction
,
isConstantFunction
:
isConstantFunction
,
isPayableFunction
:
isPayableFunction
,
isPayableFunction
:
isPayableFunction
,
isConstructor
:
isConstructor
,
isInlineAssembly
:
isInlineAssembly
,
isInlineAssembly
:
isInlineAssembly
,
isNewExpression
:
isNewExpression
,
isNewExpression
:
isNewExpression
,
isReturn
:
isReturn
,
isReturn
:
isReturn
,
...
...
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