}
})
}
- advancePositionWithMutation(context, code)
+ if (code) advancePositionWithMutation(context, code)
if (node && !openOnly) {
context.map.addMapping({
source: context.filename,
push(multilines ? `{` : `{ `)
multilines && indent()
for (let i = 0; i < properties.length; i++) {
- const { key, value } = properties[i]
+ const { key, value, loc } = properties[i]
+ push('', { loc } as any, true) // resets source mapping for every property.
// key
genExpressionAsPropertyKey(key, context)
push(`: `)
MERGE_PROPS,
TO_HANDLERS
} from '../runtimeConstants'
+import { getInnerRange } from '../utils'
const toValidId = (str: string): string => str.replace(/[^\w]/g, '')
const { loc, name, value } = prop
properties.push(
createObjectProperty(
- createExpression(name, true, loc),
+ createExpression(name, true, getInnerRange(loc, 0, name.length)),
createExpression(
value ? value.content : '',
true,