puma icon indicating copy to clipboard operation
puma copied to clipboard

instanceof operator expressions are mishandled

Open Undre4m opened this issue 9 years ago • 0 comments

Performing binary expressions using the instanceof operator throws an exception. E.g.:

function C(){}
var a = new C();
a instanceof C;

or

function Car(make, model, year) {
  this.make = make;
  this.model = model;
  this.year = year;
}

var mycar = new Car("Honda", "Accord", 1998);
mycar instanceof Car;

Both throw

TypeError: invalid 'instanceof' operand rightResult.value

FirstPass.prototype.visitBinaryExpression() runtime.js:468 FirstPass.prototype.accept() runtime.js:88 FirstPass.prototype.accept() runtime.js:85 FirstPass.prototype.acceptArray() runtime.js:63 FirstPass.prototype.visitProgram() runtime.js:200 FirstPass.prototype.accept() runtime.js:82 FirstPass.prototype.run() runtime.js:70 evalPumaAst() runtime.js:933 evalPuma() runtime.js:928

Undre4m avatar Sep 27 '16 20:09 Undre4m