Skip to content

Commit 556d9ae

Browse files
committed
関数呼び出しの引数がない場合に正しく変換ができない問題を修正
1 parent 2babcb5 commit 556d9ae

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/replacements/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export function getActualLocation(node: Ast.Node, script: string, includeEnclosi
287287
if (lastArg != null) {
288288
end = Math.max(getActualLocation(lastArg, script, true).end, loc.end);
289289
} else {
290-
end = targetLocation.end;
290+
end = loc.end;
291291
}
292292
return { start, end };
293293
}

test/literals.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,15 @@ describe('arr', () => {
154154
transpileAndValidate(script, expected);
155155
});
156156

157-
test.only('space separated with parentheses enclosing item', () => {
157+
test('space separated, with parentheses enclosing item', () => {
158158
const script = '[(-1) 1]';
159159
const expected = '[(-1), 1]';
160160
transpileAndValidate(script, expected);
161161
});
162+
163+
test('space separated, with function call item', () => {
164+
const script = '[f() 0]';
165+
const expected = '[f(), 0]';
166+
transpileAndValidate(script, expected);
167+
});
162168
});

0 commit comments

Comments
 (0)