From e38d9405548d71a7a3fea52ca29da817caef850c Mon Sep 17 00:00:00 2001 From: nchanged Date: Wed, 4 Mar 2020 10:27:26 +0100 Subject: [PATCH] fix: template literal line shift --- src/astring.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/astring.js b/src/astring.js index bd55f276..8174b542 100644 --- a/src/astring.js +++ b/src/astring.js @@ -688,6 +688,11 @@ export const baseGenerator = { this[expression.type](expression, state) state.write('}') } + const cooked = quasis[quasis.length - 1].value.raw; + const cookedLength = cooked.split('\n').length; + const shift = cookedLength - 1; + if (shift > 0) state.line = state.line + shift; + state.write(quasis[quasis.length - 1].value.raw) state.write('`') },