diff --git a/src/plugins/estree.js b/src/plugins/estree.js index 3502e311bf..f2275e83e2 100644 --- a/src/plugins/estree.js +++ b/src/plugins/estree.js @@ -128,6 +128,19 @@ export default function (instance) { }; }); + instance.extend("stmtToDirective", function (inner) { + return function (stmt) { + const directive = inner.call(this, stmt); + const value = stmt.expression.value; + + // Reset value to the actual value as in estree mode we want + // the stmt to have the real value and not the raw value + directive.value.value = value; + + return directive; + }; + }); + instance.extend("parseBlockBody", function (inner) { return function (node, ...args) { inner.call(this, node, ...args); diff --git a/test/fixtures/estree/directives/raw/expected.json b/test/fixtures/estree/directives/raw/expected.json index 7467c2bffc..b1d0f267c4 100644 --- a/test/fixtures/estree/directives/raw/expected.json +++ b/test/fixtures/estree/directives/raw/expected.json @@ -56,11 +56,11 @@ "column": 15 } }, - "value": "use\\x20strict", + "value": "use strict", "raw": "\"use\\x20strict\"" }, "directive": "use\\x20strict" } ] } -} \ No newline at end of file +}