Bug in if statement parsing in v3.9
JennaSys opened this issue · 1 comments
JennaSys commented
I was doing some regression testing between Transcrypt v3.7 and v3.9 on an existing application and found what looks like a possible bug.
Starting with this Python function:
def deleteBook():
if confirm(f"Are you sure you want to delete {book.Title}?"):
fetch(f"/api/book", on_update_success,
method='DELETE', data=book, onError=on_update_error)
Transcrypt 3.7 transpiles to this (which works in the browser):
var deleteBook = function deleteBook() {
if ((0, _commonJsutils.confirm)('Are you sure you want to delete {}?'.format(book.Title))) {
(0, _commonUrlutils.fetch)('/api/book'.format(), on_update_success, (0, _orgTranscrypt__runtime__.__kwargtrans__)({
method: 'DELETE',
data: book,
onError: on_update_error
}));
}
};
But Transcrypt 3.9 transpiles it to this (which results in a runtime error):
var deleteBook = function() {
if (_commonJsutilsJs.confirm('Are you sure you want to delete {}?'.format(book.Title))) _commonUrlutilsJs.fetch('/api/book'.format(), on_update_success, _orgTranscryptRuntimeJs.__kwargtrans__({
method: 'DELETE',
data: book,
onError: on_update_error
}));
};
I can give more detail about the functions being called in the example if needed, or will work on coming up with a minimum example if required.
JennaSys commented
Never mind, I think this might be an issue with the new version 2 of the Parcel bundler. I'll close and re-open later if necessary.