Skip to content

Commit 301288b

Browse files
author
Andy Hanson
committed
Always allow end=-1
1 parent 9d88097 commit 301288b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/compiler/transformers/es2015.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,7 @@ namespace ts {
18741874
// for the statement list we synthesize when we down-level an arrow function with
18751875
// an expression function body. This prevents both comments and source maps from
18761876
// being emitted for the end position only.
1877-
statementsLocation = moveRangeEnd(body, -1, /*noAssert*/ true);
1877+
statementsLocation = moveRangeEnd(body, -1);
18781878

18791879
const equalsGreaterThanToken = (<ArrowFunction>node).equalsGreaterThanToken;
18801880
if (!nodeIsSynthesized(equalsGreaterThanToken) && !nodeIsSynthesized(body)) {
@@ -2328,7 +2328,7 @@ namespace ts {
23282328
node.initializer
23292329
)
23302330
),
2331-
moveRangeEnd(node.initializer, -1, /*noAssert*/ true)
2331+
moveRangeEnd(node.initializer, -1)
23322332
)
23332333
);
23342334
}
@@ -2343,7 +2343,7 @@ namespace ts {
23432343
}
23442344
else {
23452345
assignment.end = node.initializer.end;
2346-
statements.push(setTextRange(createStatement(visitNode(assignment, visitor, isExpression)), moveRangeEnd(node.initializer, -1, /*noAssert*/ true)));
2346+
statements.push(setTextRange(createStatement(visitNode(assignment, visitor, isExpression)), moveRangeEnd(node.initializer, -1)));
23472347
}
23482348
}
23492349

src/compiler/utilities.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3686,8 +3686,8 @@ namespace ts {
36863686
* @param pos The start position.
36873687
* @param end The end position.
36883688
*/
3689-
export function createRange(pos: number, end: number = pos, noAssert = false): TextRange {
3690-
Debug.assert(noAssert || end >= pos);
3689+
export function createRange(pos: number, end: number = pos): TextRange {
3690+
Debug.assert(end >= pos || end === -1);
36913691
return { pos, end };
36923692
}
36933693

@@ -3697,8 +3697,8 @@ namespace ts {
36973697
* @param range A TextRange.
36983698
* @param end The new end position.
36993699
*/
3700-
export function moveRangeEnd(range: TextRange, end: number, noAssert = false): TextRange {
3701-
return createRange(range.pos, end, noAssert);
3700+
export function moveRangeEnd(range: TextRange, end: number): TextRange {
3701+
return createRange(range.pos, end);
37023702
}
37033703

37043704
/**

0 commit comments

Comments
 (0)