nerd icon indicating copy to clipboard operation
nerd copied to clipboard

Prototypal inheritance broken

Open DirtyHairy opened this issue 4 years ago • 0 comments

function Bar() {}

Bar.prototype = {b: 100};

var bar = new Bar();

console.log(bar.b);

NodeJS:

$ node prototype.js
100

Nectar:

$ nectar --run prototype.js
[*] Generating source file
[*] Compiling with preset: speed
ld: warning: option -s is obsolete and being ignored

[*] Executing /Users/pestix/dumpster/nectar/prototype
TypeError: Cannot read property 'b' of undefined

DirtyHairy avatar May 13 '21 20:05 DirtyHairy