-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
I tried to run the sample code on spiderlang.org (with a modification so it didn't depend on a global function that wasn't there)
fn TimeMachine(pilot) {
this.pilot = pilot;
this.go = fn (noise) {
::console.log(noise);
};
}
fn Tardis()
extends TimeMachine("The Doctor") {
this.go = () =>
super.go("vorp vorp");
}
fn DeLorean()
extends TimeMachine("Marty") {
this.go = () =>
super.go("One point twenty-one gigawatts!");
}
fn getTimeMachines(){
return [new Tardis(), new DeLorean()];
}
for timeMachine in getTimeMachines() {
timeMachine?.go();
}
But this throws an error:
/usr/local/lib/node_modules/spider-script/cli.js:92
vm.runInNewContext(compilerOutput.result, sandbox);
^
TypeError: Property '__$503654756$5$__' of object object is not a function
at evalmachine.<anonymous>:30:81
at Object.ModuleStore.getAnonymousModule (/usr/local/lib/node_modules/spider-script/node_modules/traceur/bin/traceur.js:953:30)
at evalmachine.<anonymous>:1:29
at /usr/local/lib/node_modules/spider-script/cli.js:92:12
at fs.js:272:14
at Object.oncomplete (fs.js:108:15)
Whereas this code runs fine:
getTimeMachines()[0].go();
getTimeMachines()[1].go();
So it looks like something's going on with the way for in loops are being compiled.
Is this a bug in Spider or did I get the install instructions wrong?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels