Use ?. where it represents the intended semantics (#11512)

This commit is contained in:
Nicolò Ribaudo
2020-05-09 23:31:50 +02:00
committed by GitHub
parent aeb51f463c
commit 31b361b736
47 changed files with 99 additions and 118 deletions

View File

@@ -44,7 +44,7 @@ export default class Buffer {
// source string since it may be arbitrarily large after all transformations
code: this._buf.join("").trimRight(),
map: null,
rawMappings: map && map.getRawMappings(),
rawMappings: map?.getRawMappings(),
};
if (map) {
@@ -315,10 +315,10 @@ export default class Buffer {
const origFilename = targetObj.filename;
targetObj.identifierName =
(prop === "start" && loc && loc.identifierName) || null;
targetObj.line = pos ? pos.line : null;
targetObj.column = pos ? pos.column : null;
targetObj.filename = (loc && loc.filename) || null;
(prop === "start" && loc?.identifierName) || null;
targetObj.line = pos?.line;
targetObj.column = pos?.column;
targetObj.filename = loc?.filename;
// We want to skip reassigning `force` if we're re-setting the same position.
if (