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
534bb0b7
Commit
534bb0b7
authored
Feb 12, 2020
by
aniket-engg
Committed by
Aniket
Feb 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests working fine
parent
a91d82b2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
66 additions
and
108 deletions
+66
-108
index.ts
remix-analyzer/src/solidity-analyzer/index.ts
+1
-1
checksEffectsInteraction.ts
...src/solidity-analyzer/modules/checksEffectsInteraction.ts
+2
-2
constantFunctions.ts
...alyzer/src/solidity-analyzer/modules/constantFunctions.ts
+2
-2
erc20Decimals.ts
...x-analyzer/src/solidity-analyzer/modules/erc20Decimals.ts
+1
-1
noReturn.ts
remix-analyzer/src/solidity-analyzer/modules/noReturn.ts
+1
-1
selfdestruct.ts
remix-analyzer/src/solidity-analyzer/modules/selfdestruct.ts
+1
-1
similarVariableNames.ts
...zer/src/solidity-analyzer/modules/similarVariableNames.ts
+1
-1
staticAnalysisIntegration-test-0.4.24.js
...er/test/analysis/staticAnalysisIntegration-test-0.4.24.js
+24
-64
staticAnalysisIntegration-test-0.5.0.js
...zer/test/analysis/staticAnalysisIntegration-test-0.5.0.js
+24
-25
staticAnalysisIssues-test-0.4.24.js
...nalyzer/test/analysis/staticAnalysisIssues-test-0.4.24.js
+4
-4
staticAnalysisIssues-test-0.5.0.js
...analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.js
+4
-4
astWalker.ts
remix-astwalker/src/astWalker.ts
+1
-2
No files found.
remix-analyzer/src/solidity-analyzer/index.ts
View file @
534bb0b7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
{
AstWalker
}
from
'remix-astwalker'
import
{
AstWalker
}
from
'remix-astwalker'
import
list
from
'./modules/list'
import
list
from
'./modules/list'
export
class
staticAnalysisRunner
{
export
default
class
staticAnalysisRunner
{
run
(
compilationResult
,
toRun
,
callback
)
{
run
(
compilationResult
,
toRun
,
callback
)
{
const
modules
=
toRun
.
map
((
i
)
=>
{
const
modules
=
toRun
.
map
((
i
)
=>
{
...
...
remix-analyzer/src/solidity-analyzer/modules/checksEffectsInteraction.ts
View file @
534bb0b7
...
@@ -17,10 +17,10 @@ export default class checksEffectsInteraction {
...
@@ -17,10 +17,10 @@ export default class checksEffectsInteraction {
visit
=
this
.
abstractAst
.
build_visit
((
node
)
=>
isInteraction
(
node
)
||
isEffect
(
node
)
||
isLocalCallGraphRelevantNode
(
node
))
visit
=
this
.
abstractAst
.
build_visit
((
node
)
=>
isInteraction
(
node
)
||
isEffect
(
node
)
||
isLocalCallGraphRelevantNode
(
node
))
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
.
bind
(
this
)
)
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
const
warnings
:
any
=
[]
const
warnings
:
any
[]
=
[]
const
hasModifiers
=
contracts
.
some
((
item
)
=>
item
.
modifiers
.
length
>
0
)
const
hasModifiers
=
contracts
.
some
((
item
)
=>
item
.
modifiers
.
length
>
0
)
const
callGraph
=
buildGlobalFuncCallGraph
(
contracts
)
const
callGraph
=
buildGlobalFuncCallGraph
(
contracts
)
contracts
.
forEach
((
contract
)
=>
{
contracts
.
forEach
((
contract
)
=>
{
...
...
remix-analyzer/src/solidity-analyzer/modules/constantFunctions.ts
View file @
534bb0b7
...
@@ -28,7 +28,7 @@ export default class constantFunctions {
...
@@ -28,7 +28,7 @@ export default class constantFunctions {
isDeleteUnaryOperation
(
node
)
isDeleteUnaryOperation
(
node
)
)
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
.
bind
(
this
)
)
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
const
warnings
:
any
=
[]
const
warnings
:
any
=
[]
...
@@ -89,7 +89,7 @@ export default class constantFunctions {
...
@@ -89,7 +89,7 @@ export default class constantFunctions {
}
}
private
checkIfShouldBeConstant
(
startFuncName
,
context
)
{
private
checkIfShouldBeConstant
(
startFuncName
,
context
)
{
return
!
analyseCallGraph
(
context
.
callGraph
,
startFuncName
,
context
,
this
.
isConstBreaker
)
return
!
analyseCallGraph
(
context
.
callGraph
,
startFuncName
,
context
,
this
.
isConstBreaker
.
bind
(
this
)
)
}
}
private
isConstBreaker
(
node
,
context
)
{
private
isConstBreaker
(
node
,
context
)
{
...
...
remix-analyzer/src/solidity-analyzer/modules/erc20Decimals.ts
View file @
534bb0b7
...
@@ -12,7 +12,7 @@ export default class erc20Decimals {
...
@@ -12,7 +12,7 @@ export default class erc20Decimals {
abstractAst
=
new
AbstractAst
()
abstractAst
=
new
AbstractAst
()
visit
=
this
.
abstractAst
.
build_visit
((
node
)
=>
false
)
visit
=
this
.
abstractAst
.
build_visit
((
node
)
=>
false
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
.
bind
(
this
)
)
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
const
warnings
:
any
=
[]
const
warnings
:
any
=
[]
...
...
remix-analyzer/src/solidity-analyzer/modules/noReturn.ts
View file @
534bb0b7
...
@@ -16,7 +16,7 @@ export default class noReturn {
...
@@ -16,7 +16,7 @@ export default class noReturn {
(
node
)
=>
isReturn
(
node
)
||
isAssignment
(
node
)
(
node
)
=>
isReturn
(
node
)
||
isAssignment
(
node
)
)
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
.
bind
(
this
)
)
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
const
warnings
:
any
[]
=
[]
const
warnings
:
any
[]
=
[]
...
...
remix-analyzer/src/solidity-analyzer/modules/selfdestruct.ts
View file @
534bb0b7
...
@@ -17,7 +17,7 @@ export default class selfdestruct {
...
@@ -17,7 +17,7 @@ export default class selfdestruct {
isSelfdestructCall
(
node
)
isSelfdestructCall
(
node
)
)
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
.
bind
(
this
)
)
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
const
warnings
:
any
[]
=
[]
const
warnings
:
any
[]
=
[]
...
...
remix-analyzer/src/solidity-analyzer/modules/similarVariableNames.ts
View file @
534bb0b7
...
@@ -17,7 +17,7 @@ export default class similarVariableNames {
...
@@ -17,7 +17,7 @@ export default class similarVariableNames {
(
node
)
=>
false
(
node
)
=>
false
)
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
)
report
=
this
.
abstractAst
.
build_report
(
this
.
_report
.
bind
(
this
)
)
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
private
_report
(
contracts
,
multipleContractsWithSameName
)
{
const
warnings
:
any
[]
=
[]
const
warnings
:
any
[]
=
[]
...
...
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.4.24.js
View file @
534bb0b7
This diff is collapsed.
Click to expand it.
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.js
View file @
534bb0b7
var
test
=
require
(
'tape'
)
var
test
=
require
(
'tape'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
StatRunner
=
require
(
'../../dist/src/solidity-analyzer'
)
var
StatRunner
=
require
(
'../../dist/src/solidity-analyzer'
)
.
default
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
const
niv
=
require
(
'npm-install-version'
)
const
niv
=
require
(
'npm-install-version'
)
...
@@ -51,7 +51,7 @@ testFiles.forEach((fileName) => {
...
@@ -51,7 +51,7 @@ testFiles.forEach((fileName) => {
test
(
'Integration test thisLocal.js'
,
function
(
t
)
{
test
(
'Integration test thisLocal.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/thisLocal'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/thisLocal'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -90,7 +90,7 @@ test('Integration test thisLocal.js', function (t) {
...
@@ -90,7 +90,7 @@ test('Integration test thisLocal.js', function (t) {
test
(
'Integration test checksEffectsInteraction.js'
,
function
(
t
)
{
test
(
'Integration test checksEffectsInteraction.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
1
,
'KingOfTheEtherThrone.sol'
:
1
,
...
@@ -129,7 +129,7 @@ test('Integration test checksEffectsInteraction.js', function (t) {
...
@@ -129,7 +129,7 @@ test('Integration test checksEffectsInteraction.js', function (t) {
test
(
'Integration test constantFunctions.js'
,
function
(
t
)
{
test
(
'Integration test constantFunctions.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/constantFunctions'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/constantFunctions'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -168,7 +168,7 @@ test('Integration test constantFunctions.js', function (t) {
...
@@ -168,7 +168,7 @@ test('Integration test constantFunctions.js', function (t) {
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -207,7 +207,7 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -207,7 +207,7 @@ test('Integration test inlineAssembly.js', function (t) {
test
(
'Integration test txOrigin.js'
,
function
(
t
)
{
test
(
'Integration test txOrigin.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/txOrigin'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/txOrigin'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -246,7 +246,7 @@ test('Integration test txOrigin.js', function (t) {
...
@@ -246,7 +246,7 @@ test('Integration test txOrigin.js', function (t) {
test
(
'Integration test gasCosts.js'
,
function
(
t
)
{
test
(
'Integration test gasCosts.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/gasCosts'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/gasCosts'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
2
,
'KingOfTheEtherThrone.sol'
:
2
,
...
@@ -285,7 +285,7 @@ test('Integration test gasCosts.js', function (t) {
...
@@ -285,7 +285,7 @@ test('Integration test gasCosts.js', function (t) {
test
(
'Integration test similarVariableNames.js'
,
function
(
t
)
{
test
(
'Integration test similarVariableNames.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/similarVariableNames'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/similarVariableNames'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -324,7 +324,7 @@ test('Integration test similarVariableNames.js', function (t) {
...
@@ -324,7 +324,7 @@ test('Integration test similarVariableNames.js', function (t) {
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
test
(
'Integration test inlineAssembly.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/inlineAssembly'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -363,7 +363,7 @@ test('Integration test inlineAssembly.js', function (t) {
...
@@ -363,7 +363,7 @@ test('Integration test inlineAssembly.js', function (t) {
test
(
'Integration test blockTimestamp.js'
,
function
(
t
)
{
test
(
'Integration test blockTimestamp.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockTimestamp'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockTimestamp'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
1
,
'KingOfTheEtherThrone.sol'
:
1
,
...
@@ -402,7 +402,7 @@ test('Integration test blockTimestamp.js', function (t) {
...
@@ -402,7 +402,7 @@ test('Integration test blockTimestamp.js', function (t) {
test
(
'Integration test lowLevelCalls.js'
,
function
(
t
)
{
test
(
'Integration test lowLevelCalls.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/lowLevelCalls'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/lowLevelCalls'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
1
,
'KingOfTheEtherThrone.sol'
:
1
,
...
@@ -441,7 +441,7 @@ test('Integration test lowLevelCalls.js', function (t) {
...
@@ -441,7 +441,7 @@ test('Integration test lowLevelCalls.js', function (t) {
test
(
'Integration test blockBlockhash.js'
,
function
(
t
)
{
test
(
'Integration test blockBlockhash.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockBlockhash'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/blockBlockhash'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -523,7 +523,7 @@ test('Integration test noReturn.js', function (t) {
...
@@ -523,7 +523,7 @@ test('Integration test noReturn.js', function (t) {
test
(
'Integration test selfdestruct.js'
,
function
(
t
)
{
test
(
'Integration test selfdestruct.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/selfdestruct'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/selfdestruct'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -562,7 +562,7 @@ test('Integration test selfdestruct.js', function (t) {
...
@@ -562,7 +562,7 @@ test('Integration test selfdestruct.js', function (t) {
test
(
'Integration test guardConditions.js'
,
function
(
t
)
{
test
(
'Integration test guardConditions.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/guardConditions'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/guardConditions'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -601,7 +601,7 @@ test('Integration test guardConditions.js', function (t) {
...
@@ -601,7 +601,7 @@ test('Integration test guardConditions.js', function (t) {
test
(
'Integration test deleteDynamicArrays.js'
,
function
(
t
)
{
test
(
'Integration test deleteDynamicArrays.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteDynamicArrays'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteDynamicArrays'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -640,7 +640,7 @@ test('Integration test deleteDynamicArrays.js', function (t) {
...
@@ -640,7 +640,7 @@ test('Integration test deleteDynamicArrays.js', function (t) {
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
test
(
'Integration test deleteFromDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/deleteFromDynamicArray'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -679,7 +679,7 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
...
@@ -679,7 +679,7 @@ test('Integration test deleteFromDynamicArray.js', function (t) {
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
test
(
'Integration test assignAndCompare.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/assignAndCompare'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/assignAndCompare'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -718,7 +718,7 @@ test('Integration test assignAndCompare.js', function (t) {
...
@@ -718,7 +718,7 @@ test('Integration test assignAndCompare.js', function (t) {
test
(
'Integration test intDivisionTruncate.js'
,
function
(
t
)
{
test
(
'Integration test intDivisionTruncate.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/intDivisionTruncate'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/intDivisionTruncate'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -757,7 +757,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
...
@@ -757,7 +757,7 @@ test('Integration test intDivisionTruncate.js', function (t) {
test
(
'Integration test erc20Decimal.js'
,
function
(
t
)
{
test
(
'Integration test erc20Decimal.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/erc20Decimals'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/erc20Decimals'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -796,7 +796,7 @@ test('Integration test erc20Decimal.js', function (t) {
...
@@ -796,7 +796,7 @@ test('Integration test erc20Decimal.js', function (t) {
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
test
(
'Integration test stringBytesLength.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/stringBytesLength'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/stringBytesLength'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -835,7 +835,7 @@ test('Integration test stringBytesLength.js', function (t) {
...
@@ -835,7 +835,7 @@ test('Integration test stringBytesLength.js', function (t) {
test
(
'Integration test etherTransferInLoop.js'
,
function
(
t
)
{
test
(
'Integration test etherTransferInLoop.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/etherTransferInLoop'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/etherTransferInLoop'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -874,7 +874,7 @@ test('Integration test etherTransferInLoop.js', function (t) {
...
@@ -874,7 +874,7 @@ test('Integration test etherTransferInLoop.js', function (t) {
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
test
(
'Integration test forLoopIteratesOverDynamicArray.js'
,
function
(
t
)
{
t
.
plan
(
testFiles
.
length
)
t
.
plan
(
testFiles
.
length
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/forLoopIteratesOverDynamicArray'
)
.
default
var
lengthCheck
=
{
var
lengthCheck
=
{
'KingOfTheEtherThrone.sol'
:
0
,
'KingOfTheEtherThrone.sol'
:
0
,
...
@@ -911,11 +911,10 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
...
@@ -911,11 +911,10 @@ test('Integration test forLoopIteratesOverDynamicArray.js', function (t) {
})
})
// #################### Helpers
// #################### Helpers
function
runModuleOnFiles
(
m
odule
,
t
,
cb
)
{
function
runModuleOnFiles
(
M
odule
,
t
,
cb
)
{
var
statRunner
=
new
StatRunner
()
var
statRunner
=
new
StatRunner
()
testFiles
.
forEach
((
fileName
)
=>
{
testFiles
.
forEach
((
fileName
)
=>
{
statRunner
.
runWithModuleList
(
testFileAsts
[
fileName
],
[{
name
:
module
.
name
,
mod
:
new
module
.
Module
()
}],
(
reports
)
=>
{
statRunner
.
runWithModuleList
(
testFileAsts
[
fileName
],
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
let
report
=
reports
[
0
].
report
let
report
=
reports
[
0
].
report
if
(
report
.
some
((
x
)
=>
x
[
'warning'
].
includes
(
'INTERNAL ERROR'
)))
{
if
(
report
.
some
((
x
)
=>
x
[
'warning'
].
includes
(
'INTERNAL ERROR'
)))
{
t
.
comment
(
'Error while executing Module: '
+
JSON
.
stringify
(
report
))
t
.
comment
(
'Error while executing Module: '
+
JSON
.
stringify
(
report
))
...
...
remix-analyzer/test/analysis/staticAnalysisIssues-test-0.4.24.js
View file @
534bb0b7
var
test
=
require
(
'tape'
)
var
test
=
require
(
'tape'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
StatRunner
=
require
(
'../../dist/src/solidity-analyzer'
)
var
StatRunner
=
require
(
'../../dist/src/solidity-analyzer'
)
.
default
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
const
niv
=
require
(
'npm-install-version'
)
const
niv
=
require
(
'npm-install-version'
)
...
@@ -22,16 +22,16 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
...
@@ -22,16 +22,16 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
t
.
plan
(
2
)
t
.
plan
(
2
)
var
res
=
compile
(
'functionParameters.sol'
)
var
res
=
compile
(
'functionParameters.sol'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
)
var
Module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
var
statRunner
=
new
StatRunner
()
var
statRunner
=
new
StatRunner
()
t
.
doesNotThrow
(()
=>
{
t
.
doesNotThrow
(()
=>
{
statRunner
.
runWithModuleList
(
res
,
[{
name
:
module
.
name
,
mod
:
new
module
.
Module
()
}],
(
reports
)
=>
{
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
})
})
},
true
,
'Analysis should not throw'
)
},
true
,
'Analysis should not throw'
)
statRunner
.
runWithModuleList
(
res
,
[{
name
:
module
.
name
,
mod
:
new
module
.
Module
()
}],
(
reports
)
=>
{
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
t
.
ok
(
!
reports
.
some
((
mod
)
=>
mod
.
report
.
some
((
rep
)
=>
rep
.
warning
.
includes
(
'INTERNAL ERROR'
)),
'Should not have internal errors'
))
t
.
ok
(
!
reports
.
some
((
mod
)
=>
mod
.
report
.
some
((
rep
)
=>
rep
.
warning
.
includes
(
'INTERNAL ERROR'
)),
'Should not have internal errors'
))
})
})
})
})
remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.js
View file @
534bb0b7
var
test
=
require
(
'tape'
)
var
test
=
require
(
'tape'
)
var
remixLib
=
require
(
'remix-lib'
)
var
remixLib
=
require
(
'remix-lib'
)
var
StatRunner
=
require
(
'../../dist/src/solidity-analyzer'
)
var
StatRunner
=
require
(
'../../dist/src/solidity-analyzer'
)
.
default
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
var
compilerInput
=
remixLib
.
helpers
.
compiler
.
compilerInput
const
niv
=
require
(
'npm-install-version'
)
const
niv
=
require
(
'npm-install-version'
)
...
@@ -22,16 +22,16 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
...
@@ -22,16 +22,16 @@ test('staticAnalysisIssues.functionParameterPassingError', function (t) {
t
.
plan
(
2
)
t
.
plan
(
2
)
var
res
=
compile
(
'functionParameters.sol'
)
var
res
=
compile
(
'functionParameters.sol'
)
var
module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
)
var
Module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
var
statRunner
=
new
StatRunner
()
var
statRunner
=
new
StatRunner
()
t
.
doesNotThrow
(()
=>
{
t
.
doesNotThrow
(()
=>
{
statRunner
.
runWithModuleList
(
res
,
[{
name
:
module
.
name
,
mod
:
new
module
.
Module
()
}],
(
reports
)
=>
{
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
})
})
},
true
,
'Analysis should not throw'
)
},
true
,
'Analysis should not throw'
)
statRunner
.
runWithModuleList
(
res
,
[{
name
:
module
.
name
,
mod
:
new
module
.
Module
()
}],
(
reports
)
=>
{
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
t
.
ok
(
!
reports
.
some
((
mod
)
=>
mod
.
report
.
some
((
rep
)
=>
rep
.
warning
.
includes
(
'INTERNAL ERROR'
)),
'Should not have internal errors'
))
t
.
ok
(
!
reports
.
some
((
mod
)
=>
mod
.
report
.
some
((
rep
)
=>
rep
.
warning
.
includes
(
'INTERNAL ERROR'
)),
'Should not have internal errors'
))
})
})
})
})
remix-astwalker/src/astWalker.ts
View file @
534bb0b7
...
@@ -79,8 +79,7 @@ export class AstWalker extends EventEmitter {
...
@@ -79,8 +79,7 @@ export class AstWalker extends EventEmitter {
this
.
walk
(
child
,
callback
);
this
.
walk
(
child
,
callback
);
}
}
}
}
}
}
else
if
(
<
AstNode
>
ast
)
{
if
(
<
AstNode
>
ast
)
{
if
(
if
(
this
.
manageCallback
(
<
AstNode
>
ast
,
callback
)
&&
this
.
manageCallback
(
<
AstNode
>
ast
,
callback
)
&&
(
<
AstNode
>
ast
).
nodes
&&
(
<
AstNode
>
ast
).
nodes
&&
...
...
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