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
7ff2e3fa
Commit
7ff2e3fa
authored
Feb 14, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
group API
parent
39704974
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
76 deletions
+69
-76
app.js
src/app.js
+48
-51
debugger.js
src/app/debugger.js
+9
-11
renderer.js
src/app/renderer.js
+8
-9
staticAnalysisView.js
src/app/staticanalysis/staticAnalysisView.js
+4
-5
No files found.
src/app.js
View file @
7ff2e3fa
...
...
@@ -494,39 +494,10 @@ var run = function () {
var
executionContext
=
new
ExecutionContext
()
var
compiler
=
new
Compiler
(
handleImportCall
)
var
formalVerification
=
new
FormalVerification
(
$
(
'#verificationView'
),
compiler
.
event
)
var
offsetToLineColumnConverter
=
new
OffsetToLineColumnConverter
(
compiler
.
event
)
var
contentToolAPI
=
{
offsetToLineColumn
:
(
location
,
file
)
=>
{
return
offsetToLineColumnConverter
.
offsetToLineColumn
(
location
,
file
,
compiler
.
lastCompilationResult
)
}
}
var
transactionContextAPI
=
{
getAddress
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
},
getValue
:
(
cb
)
=>
{
try
{
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
cb
(
null
,
executionContext
.
web3
().
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
)))
}
catch
(
e
)
{
cb
(
e
)
}
},
getGasLimit
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#gasLimit'
).
val
())
}
}
var
compilerAPI
=
{
lastCompilationResult
:
()
=>
{
return
compiler
.
lastCompilationResult
}
}
var
editorAPIDebug
=
{
// ----------------- Debugger -----------------
var
debugAPI
=
{
statementMarker
:
null
,
fullLineMarker
:
null
,
currentSourceLocation
:
(
lineColumnPos
,
location
)
=>
{
...
...
@@ -554,37 +525,49 @@ var run = function () {
},
'highlightcode_fullLine'
)
}
}
},
lastCompilationResult
:
()
=>
{
return
compiler
.
lastCompilationResult
},
offsetToLineColumn
:
(
location
,
file
)
=>
{
return
offsetToLineColumnConverter
.
offsetToLineColumn
(
location
,
file
,
compiler
.
lastCompilationResult
)
}
}
var
transactionDebugger
=
new
Debugger
(
'#debugger'
,
executionContext
.
event
,
editor
.
event
,
editorAPIDebug
,
compilerAPI
,
contentToolAPI
)
var
transactionDebugger
=
new
Debugger
(
'#debugger'
,
debugAPI
,
executionContext
.
event
,
editor
.
event
)
transactionDebugger
.
addProvider
(
'vm'
,
executionContext
.
vm
())
transactionDebugger
.
addProvider
(
'injected'
,
executionContext
.
web3
())
transactionDebugger
.
addProvider
(
'web3'
,
executionContext
.
web3
())
transactionDebugger
.
switchProvider
(
executionContext
.
getProvider
())
// ----------------- UniversalDApp -----------------
var
udapp
=
new
UniversalDApp
(
executionContext
,
{
removable
:
false
,
removable_instances
:
true
}
,
transactionDebugger
)
})
var
udappAPI
=
{
reset
:
(
udappContracts
,
renderOutputModifier
)
=>
{
udapp
.
reset
(
udappContracts
,
transactionContextAPI
,
renderOutputModifier
)
udapp
.
event
.
register
(
'debugRequested'
,
this
,
function
(
txResult
)
{
startdebugging
(
txResult
.
transactionHash
)
})
// ----------------- Renderer -----------------
var
transactionContextAPI
=
{
getAddress
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#txorigin'
).
val
())
},
render
:
()
=>
{
return
udapp
.
render
()
getValue
:
(
cb
)
=>
{
try
{
var
comp
=
$
(
'#value'
).
val
().
split
(
' '
)
cb
(
null
,
executionContext
.
web3
().
toWei
(
comp
[
0
],
comp
.
slice
(
1
).
join
(
' '
)))
}
catch
(
e
)
{
cb
(
e
)
}
},
get
Accounts
:
(
callback
)
=>
{
udapp
.
getAccounts
(
callback
)
get
GasLimit
:
(
cb
)
=>
{
cb
(
null
,
$
(
'#gasLimit'
).
val
()
)
}
}
udapp
.
event
.
register
(
'debugRequested'
,
this
,
function
(
txResult
)
{
startdebugging
(
txResult
.
transactionHash
)
})
var
editorAPIRenderer
=
{
var
rendererAPI
=
{
error
:
(
file
,
error
)
=>
{
if
(
file
===
editor
.
getCacheFile
())
{
editor
.
addAnnotation
(
error
)
...
...
@@ -601,18 +584,32 @@ var run = function () {
return
compiler
.
lastCompilationResult
.
source
.
sources
[
compiler
.
lastCompilationResult
.
source
.
target
]
}
return
''
},
resetDapp
:
(
udappContracts
,
renderOutputModifier
)
=>
{
udapp
.
reset
(
udappContracts
,
transactionContextAPI
,
renderOutputModifier
)
},
renderDapp
:
()
=>
{
return
udapp
.
render
()
},
getAccounts
:
(
callback
)
=>
{
udapp
.
getAccounts
(
callback
)
}
}
var
renderer
=
new
Renderer
(
editorAPIRenderer
,
udappAPI
,
formalVerification
.
event
,
compiler
.
event
)
// eslint-disable-line
var
rendererAPI
=
{
renderItem
:
(
label
,
warningContainer
,
type
)
=>
{
var
renderer
=
new
Renderer
(
rendererAPI
,
formalVerification
.
event
,
compiler
.
event
)
// ----------------- StaticAnalysis -----------------
var
staticAnalysisAPI
=
{
renderWarning
:
(
label
,
warningContainer
,
type
)
=>
{
return
renderer
.
error
(
label
,
warningContainer
,
type
)
},
offsetToLineColumn
:
(
location
,
file
)
=>
{
return
offsetToLineColumnConverter
.
offsetToLineColumn
(
location
,
file
,
compiler
.
lastCompilationResult
)
}
}
var
staticanalysis
=
new
StaticAnalysis
(
compiler
.
event
,
rendererAPI
,
contentToolAPI
)
var
staticanalysis
=
new
StaticAnalysis
(
staticAnalysisAPI
,
compiler
.
event
)
$
(
'#staticanalysisView'
).
append
(
staticanalysis
.
render
())
// ----------------- autoCompile -----------------
var
autoCompile
=
document
.
querySelector
(
'#autoCompile'
).
checked
if
(
config
.
exists
(
'autoCompile'
))
{
autoCompile
=
config
.
get
(
'autoCompile'
)
...
...
src/app/debugger.js
View file @
7ff2e3fa
...
...
@@ -5,14 +5,12 @@ var remix = require('ethereum-remix')
/**
* Manage remix and source highlighting
*/
function
Debugger
(
id
,
executionContextEvent
,
editorEvent
,
editorAPI
,
compilerAPI
,
contentToolAPI
)
{
function
Debugger
(
id
,
appAPI
,
executionContextEvent
,
editorEvent
)
{
this
.
el
=
document
.
querySelector
(
id
)
this
.
contentToolAPI
=
contentToolAPI
this
.
debugger
=
new
remix
.
ui
.
Debugger
()
this
.
sourceMappingDecoder
=
new
remix
.
util
.
SourceMappingDecoder
()
this
.
el
.
appendChild
(
this
.
debugger
.
render
())
this
.
compilerAPI
=
compilerAPI
this
.
editorAPI
=
editorAPI
this
.
appAPI
=
appAPI
var
self
=
this
executionContextEvent
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
...
...
@@ -20,7 +18,7 @@ function Debugger (id, executionContextEvent, editorEvent, editorAPI, compilerAP
})
this
.
debugger
.
event
.
register
(
'traceUnloaded'
,
this
,
function
()
{
self
.
editor
API
.
currentSourceLocation
(
null
)
self
.
app
API
.
currentSourceLocation
(
null
)
})
// unload if a file has changed (but not if tabs were switched)
...
...
@@ -30,13 +28,13 @@ function Debugger (id, executionContextEvent, editorEvent, editorAPI, compilerAP
// register selected code item, highlight the corresponding source location
this
.
debugger
.
codeManager
.
event
.
register
(
'changed'
,
this
,
function
(
code
,
address
,
index
)
{
if
(
self
.
compiler
API
.
lastCompilationResult
())
{
this
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromInstructionIndex
(
address
,
index
,
self
.
compiler
API
.
lastCompilationResult
().
data
.
contracts
,
function
(
error
,
rawLocation
)
{
if
(
self
.
app
API
.
lastCompilationResult
())
{
this
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromInstructionIndex
(
address
,
index
,
self
.
app
API
.
lastCompilationResult
().
data
.
contracts
,
function
(
error
,
rawLocation
)
{
if
(
!
error
)
{
var
lineColumnPos
=
self
.
contentTool
API
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
)
self
.
editor
API
.
currentSourceLocation
(
lineColumnPos
,
rawLocation
)
var
lineColumnPos
=
self
.
app
API
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
)
self
.
app
API
.
currentSourceLocation
(
lineColumnPos
,
rawLocation
)
}
else
{
self
.
editor
API
.
currentSourceLocation
(
null
)
self
.
app
API
.
currentSourceLocation
(
null
)
}
})
}
...
...
@@ -52,7 +50,7 @@ Debugger.prototype.debug = function (txHash) {
var
self
=
this
this
.
debugger
.
web3
().
eth
.
getTransaction
(
txHash
,
function
(
error
,
tx
)
{
if
(
!
error
)
{
self
.
debugger
.
setCompilationResult
(
self
.
compiler
API
.
lastCompilationResult
().
data
)
self
.
debugger
.
setCompilationResult
(
self
.
app
API
.
lastCompilationResult
().
data
)
self
.
debugger
.
debug
(
tx
)
}
})
...
...
src/app/renderer.js
View file @
7ff2e3fa
...
...
@@ -4,9 +4,8 @@ var $ = require('jquery')
var
utils
=
require
(
'./utils'
)
function
Renderer
(
editorAPI
,
udappAPI
,
formalVerificationEvent
,
compilerEvent
)
{
this
.
editorAPI
=
editorAPI
this
.
udappAPI
=
udappAPI
function
Renderer
(
appAPI
,
formalVerificationEvent
,
compilerEvent
)
{
this
.
appAPI
=
appAPI
var
self
=
this
formalVerificationEvent
.
register
(
'compilationFinished'
,
this
,
function
(
success
,
message
,
container
,
options
)
{
if
(
!
success
)
{
...
...
@@ -54,7 +53,7 @@ Renderer.prototype.error = function (message, container, options) {
var
errLine
=
parseInt
(
err
[
2
],
10
)
-
1
var
errCol
=
err
[
4
]
?
parseInt
(
err
[
4
],
10
)
:
0
if
(
!
opt
.
noAnnotations
)
{
self
.
editor
API
.
error
(
errFile
,
{
self
.
app
API
.
error
(
errFile
,
{
row
:
errLine
,
column
:
errCol
,
text
:
message
,
...
...
@@ -62,7 +61,7 @@ Renderer.prototype.error = function (message, container, options) {
})
}
$error
.
click
(
function
(
ev
)
{
self
.
editor
API
.
errorClick
(
errFile
,
errLine
,
errCol
)
self
.
app
API
.
errorClick
(
errFile
,
errLine
,
errCol
)
})
}
$error
.
find
(
'.close'
).
click
(
function
(
ev
)
{
...
...
@@ -275,20 +274,20 @@ Renderer.prototype.contracts = function (data, source) {
}
}
var
ctrSource
=
self
.
editor
API
.
currentCompiledSourceCode
()
var
ctrSource
=
self
.
app
API
.
currentCompiledSourceCode
()
if
(
ctrSource
)
{
$contractOutput
.
append
(
getDetails
(
contract
,
ctrSource
,
contractName
))
}
return
$contractOutput
}
this
.
udappAPI
.
reset
(
udappContracts
,
renderOutputModifier
)
this
.
appAPI
.
resetDapp
(
udappContracts
,
renderOutputModifier
)
var
$contractOutput
=
this
.
udappAPI
.
render
()
var
$contractOutput
=
this
.
appAPI
.
renderDapp
()
var
$txOrigin
=
$
(
'#txorigin'
)
this
.
ud
appAPI
.
getAccounts
(
function
(
err
,
accounts
)
{
this
.
appAPI
.
getAccounts
(
function
(
err
,
accounts
)
{
if
(
err
)
{
self
.
error
(
err
.
message
)
}
...
...
src/app/staticanalysis/staticAnalysisView.js
View file @
7ff2e3fa
...
...
@@ -3,13 +3,12 @@ var StaticAnalysisRunner = require('./staticAnalysisRunner.js')
var
yo
=
require
(
'yo-yo'
)
var
$
=
require
(
'jquery'
)
function
staticAnalysisView
(
compilerEvent
,
rendererAPI
,
contentToolAPI
)
{
function
staticAnalysisView
(
appAPI
,
compilerEvent
)
{
this
.
view
=
null
this
.
rendererAPI
=
renderer
API
this
.
appAPI
=
app
API
this
.
runner
=
new
StaticAnalysisRunner
()
this
.
modulesView
=
renderModules
(
this
.
runner
.
modules
())
this
.
lastCompilationResult
=
null
this
.
contentToolAPI
=
contentToolAPI
var
self
=
this
compilerEvent
.
register
(
'compilationFinished'
,
function
(
success
,
data
,
source
)
{
self
.
lastCompilationResult
=
null
...
...
@@ -74,10 +73,10 @@ staticAnalysisView.prototype.run = function () {
start
:
parseInt
(
split
[
0
]),
length
:
parseInt
(
split
[
1
])
}
location
=
self
.
contentTool
API
.
offsetToLineColumn
(
location
,
file
)
location
=
self
.
app
API
.
offsetToLineColumn
(
location
,
file
)
location
=
self
.
lastCompilationResult
.
sourceList
[
file
]
+
':'
+
(
location
.
start
.
line
+
1
)
+
':'
+
(
location
.
start
.
column
+
1
)
+
':'
}
self
.
rendererAPI
.
renderItem
(
location
+
' '
+
item
.
warning
,
warningContainer
,
{
type
:
'warning'
,
useSpan
:
true
,
isHTML
:
true
})
self
.
appAPI
.
renderWarning
(
location
+
' '
+
item
.
warning
,
warningContainer
,
{
type
:
'warning'
,
useSpan
:
true
,
isHTML
:
true
})
})
})
if
(
warningContainer
.
html
()
===
''
)
{
...
...
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