@@ -24,14 +24,16 @@ scanjsModule.controller('ExperimentCtrl', ['$scope', 'ScanSvc', function Experim
24
24
25
25
$scope . runScan = function ( ) {
26
26
$scope . results = [ ] ;
27
+ $scope . error = null ;
27
28
ScanJS . loadRules ( ScanSvc . rules ) ;
28
29
var code = $scope . codeMirror . getValue ( ) ;
29
30
try {
30
31
var ast = acorn . parse ( code , { locations : true } ) ;
32
+ $scope . results = ScanJS . scan ( ast ) ;
31
33
} catch ( e ) {
34
+ $scope . error = e ;
32
35
console . error ( e ) ;
33
36
}
34
- $scope . results = ScanJS . scan ( ast ) ;
35
37
$scope . lastScan = $scope . runScan ;
36
38
} ;
37
39
@@ -40,23 +42,21 @@ scanjsModule.controller('ExperimentCtrl', ['$scope', 'ScanSvc', function Experim
40
42
ScanJS . loadRules ( [ ruleData ] ) ;
41
43
42
44
$scope . results = [ ] ;
45
+ $scope . error = null ;
43
46
var code = $scope . codeMirror . getValue ( ) ;
44
47
try {
45
48
var ast = acorn . parse ( code , { locations : true } ) ;
49
+ $scope . results = ScanJS . scan ( ast ) ;
50
+ //put ast on global variable for debugging purposes.
51
+ window . ast = ast ;
46
52
} catch ( e ) {
53
+ $scope . error = e ;
47
54
console . error ( e ) ;
48
55
}
49
-
50
- //put ast on global variable for debugging purposes.
51
- window . ast = ast ;
52
-
53
- //ScanJS.setResultCallback(found);
54
- $scope . results = ScanJS . scan ( ast ) ;
55
56
$scope . lastScan = $scope . runManualScan ;
56
57
} ;
57
58
58
59
$scope . showResult = function ( filename , line , col ) {
59
- document . querySelector ( "#code-mirror-wrapper" ) . classList . toggle ( "hidden" , false ) ;
60
60
$scope . codeMirror . setCursor ( line - 1 , col || 0 ) ;
61
61
$scope . codeMirror . focus ( ) ;
62
62
} ;
0 commit comments