Sorry, the diff of this file is not supported yet
+7
| bench: | ||
| node_modules/.bin/matcha benchmark/scenarios.js | ||
| v8: | ||
| node --allow-natives-syntax --trace-opt --trace-deopt benchmark/v8.js | ||
| .PHONY: bench v8 |
Sorry, the diff of this file is not supported yet
+4
-1
| { | ||
| "name": "scopifier", | ||
| "version": "1.1.1", | ||
| "version": "1.1.2", | ||
| "description": "Scopifier CLI for Context Coloring", | ||
@@ -32,3 +32,6 @@ "main": "scopifier.js", | ||
| "esprima": "^1.2.3" | ||
| }, | ||
| "devDependencies": { | ||
| "matcha": "^0.6.0" | ||
| } | ||
| } |
+12
-3
@@ -21,2 +21,11 @@ // Copyright (C) 2014-2015 Free Software Foundation, Inc. | ||
| // V8 hates try-catch statements and won't optimize a function that uses them. | ||
| function tryCatch(fn, failureHandler) { | ||
| try { | ||
| fn(); | ||
| } catch (error) { | ||
| failureHandler(error); | ||
| } | ||
| } | ||
| // Given code, returns an array of tokens for context-coloring. | ||
@@ -49,3 +58,3 @@ function scopifier(code) { | ||
| // Gracefully handle parse errors by doing nothing. | ||
| try { | ||
| tryCatch(function () { | ||
| ast = esprima.parse(code, { | ||
@@ -55,5 +64,5 @@ range: true | ||
| analyzedScopes = escope.analyze(ast).scopes; | ||
| } catch (error) { | ||
| }, function () { | ||
| process.exit(1); | ||
| } | ||
| }); | ||
@@ -60,0 +69,0 @@ scopes = []; |
Sorry, the diff of this file is not supported yet
11217
20.02%14
27.27%159
5.3%1
Infinity%