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
56805303
Commit
56805303
authored
Mar 17, 2020
by
aniket-engg
Committed by
Aniket
Mar 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0.5.0 contracts integration tests updated
parent
52000695
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
33 deletions
+33
-33
staticAnalysisCommon.ts
...zer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
+5
-5
staticAnalysisIntegration-test-0.5.0.ts
...zer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
+0
-0
staticAnalysisIssues-test-0.5.0.ts
...analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
+28
-28
No files found.
remix-analyzer/src/solidity-analyzer/modules/staticAnalysisCommon.ts
View file @
56805303
...
@@ -448,18 +448,18 @@ function getFullQuallyfiedFuncDefinitionIdent (contract: ContractDefinitionAstNo
...
@@ -448,18 +448,18 @@ function getFullQuallyfiedFuncDefinitionIdent (contract: ContractDefinitionAstNo
function
getUnAssignedTopLevelBinOps
(
subScope
:
BlockAstNode
|
IfStatementAstNode
|
WhileStatementAstNode
|
ForStatementAstNode
):
ExpressionStatementAstNode
[]
{
function
getUnAssignedTopLevelBinOps
(
subScope
:
BlockAstNode
|
IfStatementAstNode
|
WhileStatementAstNode
|
ForStatementAstNode
):
ExpressionStatementAstNode
[]
{
let
result
:
ExpressionStatementAstNode
[]
=
[]
let
result
:
ExpressionStatementAstNode
[]
=
[]
if
(
subScope
.
nodeType
===
'Block'
)
if
(
subScope
&&
subScope
.
nodeType
===
'Block'
)
result
=
subScope
.
statements
.
filter
(
isBinaryOpInExpression
)
result
=
subScope
.
statements
.
filter
(
isBinaryOpInExpression
)
// for 'without braces' loops
// for 'without braces' loops
else
if
(
subScope
&&
subScope
.
nodeType
&&
isSubScopeStatement
(
subScope
))
{
else
if
(
subScope
&&
subScope
.
nodeType
&&
isSubScopeStatement
(
subScope
))
{
if
(
subScope
.
nodeType
===
'IfStatement'
){
if
(
subScope
.
nodeType
===
'IfStatement'
){
if
((
subScope
.
trueBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
trueBody
)))
if
((
subScope
.
trueBody
&&
subScope
.
trueBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
trueBody
)))
result
.
push
(
subScope
.
trueBody
)
result
.
push
(
subScope
.
trueBody
)
if
(
subScope
.
falseBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
falseBody
))
if
(
subScope
.
falseBody
&&
subScope
.
falseBody
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
falseBody
))
result
.
push
(
subScope
.
falseBody
)
result
.
push
(
subScope
.
falseBody
)
}
}
else
{
else
{
if
(
subScope
.
body
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
body
))
if
(
subScope
.
body
&&
subScope
.
body
.
nodeType
===
"ExpressionStatement"
&&
isBinaryOpInExpression
(
subScope
.
body
))
result
.
push
(
subScope
.
body
)
result
.
push
(
subScope
.
body
)
}
}
}
}
...
@@ -982,7 +982,7 @@ function isStringToBytesConversion (node: FunctionCallAstNode): boolean {
...
@@ -982,7 +982,7 @@ function isStringToBytesConversion (node: FunctionCallAstNode): boolean {
function
isExplicitCast
(
node
:
FunctionCallAstNode
,
castFromType
:
string
,
castToType
:
string
):
boolean
{
function
isExplicitCast
(
node
:
FunctionCallAstNode
,
castFromType
:
string
,
castToType
:
string
):
boolean
{
return
node
.
kind
===
"typeConversion"
&&
return
node
.
kind
===
"typeConversion"
&&
nodeType
(
node
.
expression
,
exactMatch
(
nodeTypes
.
ELEMENTARYTYPENAMEEXPRESSION
))
&&
node
.
expression
.
typeName
.
name
===
castToType
&&
nodeType
(
node
.
expression
,
exactMatch
(
nodeTypes
.
ELEMENTARYTYPENAMEEXPRESSION
))
&&
node
.
expression
.
typeName
===
castToType
&&
nodeType
(
node
.
arguments
[
0
],
exactMatch
(
nodeTypes
.
IDENTIFIER
))
&&
typeDescription
(
node
.
arguments
[
0
],
castFromType
)
nodeType
(
node
.
arguments
[
0
],
exactMatch
(
nodeTypes
.
IDENTIFIER
))
&&
typeDescription
(
node
.
arguments
[
0
],
castFromType
)
}
}
...
...
remix-analyzer/test/analysis/staticAnalysisIntegration-test-0.5.0.ts
View file @
56805303
This diff is collapsed.
Click to expand it.
remix-analyzer/test/analysis/staticAnalysisIssues-test-0.5.0.ts
View file @
56805303
//
import { default as test} from "tape"
import
{
default
as
test
}
from
"tape"
//
import { helpers } from 'remix-lib'
import
{
helpers
}
from
'remix-lib'
//
import { readFileSync } from 'fs'
import
{
readFileSync
}
from
'fs'
//
import { join } from 'path'
import
{
join
}
from
'path'
//
import { default as StatRunner } from '../../dist/src/solidity-analyzer'
import
{
default
as
StatRunner
}
from
'../../dist/src/solidity-analyzer'
//
import { install, require as requireNPMmodule } from 'npm-install-version'
import
{
install
,
require
as
requireNPMmodule
}
from
'npm-install-version'
//
install('solc@0.5.0')
install
(
'solc@0.5.0'
)
//
const compiler = requireNPMmodule('solc@0.5.0')
const
compiler
=
requireNPMmodule
(
'solc@0.5.0'
)
//
const {compilerInput } = helpers.compiler
const
{
compilerInput
}
=
helpers
.
compiler
//
const folder = 'solidity-v0.5'
const
folder
=
'solidity-v0.5'
//
function compile (fileName) {
function
compile
(
fileName
)
{
//
const content = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
const
content
=
readFileSync
(
join
(
__dirname
,
'test-contracts/'
+
folder
,
fileName
),
'utf8'
)
//
return JSON.parse(compiler.compile(compilerInput(content)))
return
JSON
.
parse
(
compiler
.
compile
(
compilerInput
(
content
)))
//
}
}
//
test('staticAnalysisIssues.functionParameterPassingError', function (t) {
test
(
'staticAnalysisIssues.functionParameterPassingError'
,
function
(
t
)
{
//
// https://github.com/ethereum/remix-ide/issues/889#issuecomment-351746474
// https://github.com/ethereum/remix-ide/issues/889#issuecomment-351746474
//
t.plan(2)
t
.
plan
(
2
)
//
const res = compile('functionParameters.sol')
const
res
=
compile
(
'functionParameters.sol'
)
//
const Module = require('../../dist/src/solidity-analyzer/modules/checksEffectsInteraction').default
const
Module
=
require
(
'../../dist/src/solidity-analyzer/modules/checksEffectsInteraction'
).
default
//
const statRunner = new StatRunner()
const
statRunner
=
new
StatRunner
()
//
t.doesNotThrow(() => {
t
.
doesNotThrow
(()
=>
{
//
statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new Module() }], (reports) => {
statRunner
.
runWithModuleList
(
res
,
[{
name
:
new
Module
().
name
,
mod
:
new
Module
()
}],
(
reports
)
=>
{
//
})
})
//
}, 'Analysis should not throw')
},
'Analysis should not throw'
)
//
statRunner.runWithModuleList(res, [{ name: new Module().name, mod: new 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'
))
//
})
})
//
})
})
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