metajs icon indicating copy to clipboard operation
metajs copied to clipboard

The following Code gets stuck

Open pmohanta opened this issue 11 years ago • 2 comments

Code sample: function Human() { this.H1 = 87;} var Obj = { Name:"Palash" } Human.apply( Obj ); //------------------------------------------ Error: Function name: CPSFunction.prototype.apply in (bundle.js) errCont is undefined. //------------------------------------------

pmohanta avatar Nov 11 '13 19:11 pmohanta

The error is here: https://github.com/int3/metajs/blob/a13f69c4679a3b0ee9206698fdd32de1f5304154/lib/interpreter.coffee#L110

The Function.prototype.apply implementation assumes a non-null second argument.

michaelficarra avatar Nov 11 '13 20:11 michaelficarra

Even with a non null argument it fails. Code sample: function Human(age) { this.H1 = age;} var Obj = { Name:"Palash" } Human.apply( Obj,[12] ); Human.call(Obj,12) //<----------------- this fails too. //-------------------------------------------- Also, Function.prototype.call is not implemented yet. Is that a correct assumption? //--------------------------------------------

pmohanta avatar Nov 12 '13 17:11 pmohanta