anvaka / asmalidator

Online asm.js validator
http://anvaka.github.io/asmalidator/
MIT License
7 stars 1 forks source link

+=, <<= and so on are NOT allowed in asm.js, you did not check :( #1

Open socketpair opened 8 years ago

socketpair commented 8 years ago

Please re-read .spec and implement everything written

anvaka commented 8 years ago

Not sure what you mean. If I paste this code:

function helloWorld(stdlib, foreign, heap) {
  "use asm";

  var HEAP64 = new stdlib.Float64Array(heap);
  // this is what we're validating
  function giveThemTheAnswer() {
    var x += 2;
    var y = 40;
    return (x|0 + y|0)|0;
  }
  return { answer: giveThemTheAnswer };
}

Into the editor I get correct error next to x += 2. Please provide more info.

socketpair commented 8 years ago

Please check WHICH error you see. In your example. x is undefined, and more over, var x += 2 is wrong JS code. Try this:

function helloWorld(stdlib, foreign, heap) {
  "use asm";

  var HEAP64 = new stdlib.Float64Array(heap);
  // this is what we're validating
  function giveThemTheAnswer() {
    var x = 2;
    var y = 40;
    y += 5;
    return (x|0 + y|0)|0;
  }
  return { answer: giveThemTheAnswer };
}
socketpair commented 8 years ago

However, I use VERY unfriendly http://turtlescript.github.cscott.net/asmjs.html , but it works!

anvaka commented 8 years ago

Ah, I see what you mean now. The bug comes from upstream asm.js parser. Logged it there: https://github.com/dherman/asm.js/issues/118

Thanks for letting us know!