Closed onepointerT closed 2 months ago
This needs tests, and you need to commit the compiled output.
I'm not from yesterday, I know that and what testing is. I've tested it on the same testing script. The output is omitted, because no further output on that functionality. After using the corrected commit I've got output on a completly other topic, import statements in ES scripts, with "type": "module"
in package.json
. The problem with the asyncronous await
is patched and delivers no further output, I manually controlled the function, it is now an async function
, before the commit it was a simple function.
What's the input that causes the output error you mention?
I'm worried that this code will add async
to the outer function in this case (but I didn't test):
->
-> await undefined
export class File extends Path
constructor: (path) ->
super path
readSync: () ->
fd = await open @path 'r'
return fd.createReadStream()
writeSync: (data) ->
fd = await open @path 'rw'
return fd.createWriteStream data
Somehow an await undefined
sounds a little bit silly, since loops that iterate unless the stack is empty are implemented already. This feature request is required on every async function use inside of a function, except the already included async functionality with For and Of.
What's the input that causes the output error you mention?
I'm worried that this code will add
async
to the outer function in this case (but I didn't test):-> -> await undefined
export var File = class File extends Path {
constructor(path) {
super(path);
}
async readSync() {
var fd;
fd = (await open(this.path('r')));
return fd.createReadStream();
}
async writeSync(data) {
var fd;
fd = (await open(this.path('rw')));
return fd.createWriteStream(data);
}
};
It seems that async
is already where it needs to be. So I'm not sure what this PR is aiming to fix. It would help if you added a test that is broken with the current CoffeeScript.
Solves the error 'Unexpected reserved word "await"':