Commit 26416340 authored by yann300's avatar yann300

integrate to app, renderer

parent 9bde45fd
...@@ -228,6 +228,10 @@ body { ...@@ -228,6 +228,10 @@ body {
display: block; display: block;
} }
#header #optionViews.staticanalysisView #staticanalysisView {
display: block;
}
#header #optionViews.txView input, #header #optionViews.txView input,
#header #optionViews.txView select { #header #optionViews.txView select {
max-width: 13em; max-width: 13em;
...@@ -283,6 +287,19 @@ body { ...@@ -283,6 +287,19 @@ body {
cursor: pointer; cursor: pointer;
} }
#staticanalysisView button {
background-color: #C6CFF7;
font-size: 12px;
padding: 0.25em;
margin-bottom: .5em;
color: black;
border:0 none;
border-radius: 3px;
width: 8em;
margin-right: 1em;
cursor: pointer;
}
#header .origin, #header .origin,
#header #executionContext { #header #executionContext {
display: block; display: block;
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
<li class="publishView" title="Publish" ><i class="fa fa-cloud-upload"></i></li> <li class="publishView" title="Publish" ><i class="fa fa-cloud-upload"></i></li>
<li class="debugView" title="Debugger"><i class="fa fa-bug"></i></li> <li class="debugView" title="Debugger"><i class="fa fa-bug"></i></li>
<li class="verificationView" title="Formal Verification"><i class="fa fa-check"></i></li> <li class="verificationView" title="Formal Verification"><i class="fa fa-check"></i></li>
<li class="staticanalysisView" title="Static Analysis"><i class="fa fa-search"></i></li>
<li id="helpButton"><a href="https://solidity.readthedocs.org" target="_blank" title="Open Documentation" class="fa fa-question"></a></li> <li id="helpButton"><a href="https://solidity.readthedocs.org" target="_blank" title="Open Documentation" class="fa fa-question"></a></li>
</ul> </ul>
<img id="solIcon" title="Solidity realtime compiler and runtime" src="assets/img/sol.svg" alt="Solidity realtime compiler and runtime"> <img id="solIcon" title="Solidity realtime compiler and runtime" src="assets/img/sol.svg" alt="Solidity realtime compiler and runtime">
...@@ -123,6 +124,8 @@ ...@@ -123,6 +124,8 @@
<div id="debugView"> <div id="debugView">
<div id="debugger" ></div> <div id="debugger" ></div>
</div> </div>
<div id="staticanalysisView">
</div>
<div id="verificationView"> <div id="verificationView">
<p>This tab provides support for <b>formal verification</b> of Solidity contracts.<br/> <p>This tab provides support for <b>formal verification</b> of Solidity contracts.<br/>
This feature is still in development and thus also not yet well documented, This feature is still in development and thus also not yet well documented,
......
...@@ -19,6 +19,7 @@ var UniversalDApp = require('./universal-dapp.js') ...@@ -19,6 +19,7 @@ var UniversalDApp = require('./universal-dapp.js')
var Debugger = require('./app/debugger') var Debugger = require('./app/debugger')
var FormalVerification = require('./app/formalVerification') var FormalVerification = require('./app/formalVerification')
var EventManager = require('./lib/eventManager') var EventManager = require('./lib/eventManager')
var StaticAnalysis = require('./app/staticanalysis/staticAnalysisView')
// The event listener needs to be registered as early as possible, because the // The event listener needs to be registered as early as possible, because the
// parent will send the message upon the "load" event. // parent will send the message upon the "load" event.
...@@ -444,6 +445,9 @@ var run = function () { ...@@ -444,6 +445,9 @@ var run = function () {
var renderer = new Renderer(editor, executionContext.web3(), updateFiles, udapp, executionContext, formalVerification.event, compiler.event) // eslint-disable-line var renderer = new Renderer(editor, executionContext.web3(), updateFiles, udapp, executionContext, formalVerification.event, compiler.event) // eslint-disable-line
var staticanalysis = new StaticAnalysis(compiler, renderer)
$('#staticanalysisView').append(staticanalysis.render())
var autoCompile = document.querySelector('#autoCompile').checked var autoCompile = document.querySelector('#autoCompile').checked
document.querySelector('#autoCompile').addEventListener('change', function () { document.querySelector('#autoCompile').addEventListener('change', function () {
......
...@@ -35,9 +35,11 @@ function Renderer (editor, web3, updateFiles, udapp, executionContext, formalVer ...@@ -35,9 +35,11 @@ function Renderer (editor, web3, updateFiles, udapp, executionContext, formalVer
}) })
} }
Renderer.prototype.error = function (message, container, noAnnotations) { Renderer.prototype.error = function (message, container, noAnnotations, type) {
var self = this var self = this
var type = utils.errortype(message) if (!type) {
type = utils.errortype(message)
}
var $pre = $('<pre />').text(message) var $pre = $('<pre />').text(message)
var $error = $('<div class="sol ' + type + '"><div class="close"><i class="fa fa-close"></i></div></div>').prepend($pre) var $error = $('<div class="sol ' + type + '"><div class="close"><i class="fa fa-close"></i></div></div>').prepend($pre)
if (container === undefined) { if (container === undefined) {
...@@ -66,12 +68,12 @@ Renderer.prototype.error = function (message, container, noAnnotations) { ...@@ -66,12 +68,12 @@ Renderer.prototype.error = function (message, container, noAnnotations) {
} }
self.editor.handleErrorClick(errLine, errCol) self.editor.handleErrorClick(errLine, errCol)
}) })
}
$error.find('.close').click(function (ev) { $error.find('.close').click(function (ev) {
ev.preventDefault() ev.preventDefault()
$error.remove() $error.remove()
return false return false
}) })
}
} }
Renderer.prototype.contracts = function (data, source) { Renderer.prototype.contracts = function (data, source) {
......
...@@ -57,7 +57,7 @@ staticAnalysisView.prototype.run = function () { ...@@ -57,7 +57,7 @@ staticAnalysisView.prototype.run = function () {
} }
var selected = this.selectedModules() var selected = this.selectedModules()
var warningContainer = $('#staticanalysisresult') var warningContainer = $('#staticanalysisresult')
warningContainer.html('') warningContainer.empty()
if (this.lastASTs) { if (this.lastASTs) {
var self = this var self = this
this.runner.run(this.lastASTs, selected, function (results) { this.runner.run(this.lastASTs, selected, function (results) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment