Skip to content

Commit cf461ca

Browse files
committed
fix swapLocations - when !withLocation && withSource
1 parent c35e1cf commit cf461ca

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/ast.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,12 @@ AST.prototype.prepare = function(kind, docs, parser) {
360360
if (self.withSource) {
361361
src = parser.lexer._input.substring(start.offset, parser.prev[2]);
362362
}
363-
if (self.withPositions) {
364-
location = new Location(
365-
src,
366-
start,
367-
new Position(parser.prev[0], parser.prev[1], parser.prev[2])
368-
);
369-
} else {
370-
location = new Location(src, null, null);
371-
}
363+
// if with source, need location on swapLocations function
364+
location = new Location(
365+
src,
366+
start,
367+
new Position(parser.prev[0], parser.prev[1], parser.prev[2])
368+
);
372369
// last argument is allways the location
373370
args.push(location);
374371
}

0 commit comments

Comments
 (0)