Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed Oct 26, 2022
1 parent e81634f commit bcde681
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/language-js/loc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import isNonEmptyArray from "../utils/is-non-empty-array.js";

/**
* @typedef {import("./types/estree.js").Node} Node
*/

function locStart(node) {
return node.range ? node.range[0] : node.start;
const start = node.range ? node.range[0] : node.start;

const decorators = node.declaration?.decorators ?? node.decorators;

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

function locEnd(node) {
Expand Down

0 comments on commit bcde681

Please sign in to comment.