Skip to content

Commit

Permalink
Restore comment
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Oct 26, 2022
1 parent bcde681 commit 418df1b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/language-js/loc.js
Expand Up @@ -7,11 +7,13 @@ import isNonEmptyArray from "../utils/is-non-empty-array.js";
function locStart(node) {
const start = node.range ? node.range[0] : node.start;

// Handle nodes with decorators. They should start at the first decorator
const decorators = node.declaration?.decorators ?? node.decorators;
if (isNonEmptyArray(decorators)) {
return Math.min(locStart(decorators[0]), start);
}

return isNonEmptyArray(decorators)
? Math.min(locStart(decorators[0]), start)
: start;
return start;
}

function locEnd(node) {
Expand Down

0 comments on commit 418df1b

Please sign in to comment.