From 33ff32c4f1b835b1ea66e29fa8994d62b18bf83c Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 28 Sep 2015 17:49:07 +0200 Subject: [PATCH] Report multiple errors. --- index.html | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 7128211ad7..196038ac3c 100644 --- a/index.html +++ b/index.html @@ -263,8 +263,8 @@ input[readonly] {

Version: (loading)
Change to:
- Execution environment does not connect to any node, everyhing is local and in memory only.
- tx.origin =

+ Execution environment does not connect to any node, everyhing is local and in memory only.
+ tx.origin =

@@ -384,9 +384,12 @@ input[readonly] { var compileJSON; var previousInput = ''; + var sourceAnnotations = []; var compile = function() { editor.getSession().clearAnnotations(); + sourceAnnotations = []; editor.getSession().removeMarker(errMarkerId); + $('#output').empty(); var input = editor.getValue(); var optimize = document.querySelector('#optimize').checked; try { @@ -397,6 +400,10 @@ input[readonly] { } if (data['error'] !== undefined) renderError(data['error']); + if (data['errors'] != undefined) + $.each(data['errors'], function(i, err) { + renderError(err); + }); else renderContracts(data, input); @@ -433,18 +440,18 @@ input[readonly] { var renderError = function(message) { $('#output') - .empty() .append($('
').text(message));
             var err = message.match(/^:([0-9]*):([0-9]*)/)
             if (err && err.length) {
                 var errLine = parseInt( err[1], 10 ) - 1;
                 var errCol = err[2] ? parseInt( err[2], 10 ) : 0;
-                editor.getSession().setAnnotations([{
+                sourceAnnotations[sourceAnnotations.length] ={
                     row: errLine,
                     column: errCol,
                     text: message,
                     type: "error"
-                }]);
+                };
+                editor.getSession().setAnnotations(sourceAnnotations);
             }
         };