Comparing version 0.6.0 to 0.6.1
@@ -594,6 +594,14 @@ "use strict"; | ||
var ast = (gotAST ? src : options.parse(src, { | ||
loc: true, | ||
range: true, | ||
})); | ||
var parsed; | ||
try { | ||
parsed = options.parse(src, { | ||
loc: true, | ||
range: true, | ||
}); | ||
} catch (e) { | ||
return { | ||
errors: [fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}", e.lineNumber, e.column, src.split("\n")[e.lineNumber - 1], fmt.repeat(" ", e.column - 1) + "^")], | ||
}; | ||
} | ||
var ast = (gotAST ? src : parsed); | ||
@@ -600,0 +608,0 @@ // TODO detect unused variables (never read) |
@@ -0,1 +1,4 @@ | ||
## v0.6.1 2013-12-09 | ||
* Graceful error handling on malformed source input (issue #18) | ||
## v0.6.0 2013-12-01 | ||
@@ -2,0 +5,0 @@ * Accept a custom parse function |
@@ -594,6 +594,14 @@ "use strict"; | ||
const ast = (gotAST ? src : options.parse(src, { | ||
loc: true, | ||
range: true, | ||
})); | ||
let parsed; | ||
try { | ||
parsed = options.parse(src, { | ||
loc: true, | ||
range: true, | ||
}); | ||
} catch (e) { | ||
return { | ||
errors: [fmt("line {0} column {1}: Error during input file parsing\n{2}\n{3}", e.lineNumber, e.column, src.split("\n")[e.lineNumber - 1], fmt.repeat(" ", e.column - 1) + "^")], | ||
}; | ||
} | ||
const ast = (gotAST ? src : parsed); | ||
@@ -600,0 +608,0 @@ // TODO detect unused variables (never read) |
@@ -47,3 +47,3 @@ # Loop closures | ||
Not all loop closures can be transpiled into IIFE's. If the loop body (which contains the | ||
loop closure) also contains a `return`, `break`, `continue`, `arguments` or `var`, then | ||
loop closure) also contains a `return`, `yield`, `break`, `continue`, `arguments` or `var`, then | ||
defs will detect that and give you an error (because an IIFE would likely change | ||
@@ -50,0 +50,0 @@ the loop body semantics). If so either rewrite the loop body so it doesn't use any of these or |
{ | ||
"name": "defs", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Static scope analysis and transpilation of ES6 block scoped const and let variables, to ES3.", | ||
@@ -5,0 +5,0 @@ "main": "build/es5/defs-main.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119916
3109