Comparing version 0.13.1 to 0.13.2
@@ -775,5 +775,8 @@ var assert = require("assert"); | ||
case "NumericLiteral": // Babel 6 Literal Split | ||
// keep original representation for values not in base 10 | ||
if (n.extra && typeof n.extra.raw === "string") | ||
// Keep original representation for numeric values not in base 10. | ||
if (n.extra && | ||
typeof n.extra.raw === "string" && | ||
Number(n.extra.raw) === n.value) { | ||
return fromString(n.extra.raw, options); | ||
} | ||
@@ -786,6 +789,11 @@ return fromString(n.value, options); | ||
case "Literal": | ||
// numeric values may be in bases other than 10 | ||
// Use their raw representation for esprima | ||
// Numeric values may be in bases other than 10. Use their raw | ||
// representation if equivalent. | ||
if (typeof n.value === "number" && | ||
typeof n.raw === "string" && | ||
Number(n.raw) === n.value) { | ||
return fromString(n.raw, options); | ||
} | ||
if (typeof n.value !== "string") { | ||
if (typeof n.raw === "string") return fromString(n.raw, options); | ||
return fromString(n.value, options); | ||
@@ -1035,10 +1043,19 @@ } | ||
case "CatchClause": | ||
parts.push("catch (", path.call(print, "param")); | ||
parts.push("catch "); | ||
if (n.guard) | ||
if (n.param) { | ||
parts.push("(", path.call(print, "param")); | ||
} | ||
if (n.guard) { | ||
// Note: esprima does not recognize conditional catch clauses. | ||
parts.push(" if ", path.call(print, "guard")); | ||
} | ||
parts.push(") ", path.call(print, "body")); | ||
if (n.param) { | ||
parts.push(") "); | ||
} | ||
parts.push(path.call(print, "body")); | ||
return concat(parts); | ||
@@ -1045,0 +1062,0 @@ |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"homepage": "http://github.com/benjamn/recast", | ||
@@ -42,3 +42,3 @@ "repository": { | ||
"esprima-fb": "^15001.1001.0-dev-harmony-fb", | ||
"flow-parser": "^0.65.0", | ||
"flow-parser": "^0.66.0", | ||
"mocha": "~5.0.0", | ||
@@ -45,0 +45,0 @@ "reify": "^0.14.1", |
Sorry, the diff of this file is not supported yet
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
195093
4438