asm-js / validator

A reference validator for asm.js.
Apache License 2.0
1.78k stars 154 forks source link

Validating switch is broken #94

Open h8liu opened 9 years ago

h8liu commented 9 years ago

Validating switch case gets TypeError: Object #<Validator> has no method 'literal'

Here is an example code that reproduces the error:

var asm = require("../lib/asm.js");

try {
    var report = asm.validate(String(
        function f(stdlib, foreign, heap) {
            "use asm";

            var t = 0;

            function f() {
                switch (t|0) {
                //case 0|0:
                case 0:
                default:
                }
            }
            return {};
        }
    ));

    console.log('validated');
} catch(e) {
    console.error(e);
}
kripken commented 9 years ago

If you replace 0|0 with 0 (and f with ff), it validates for me.

h8liu commented 9 years ago

Even after the change, it validates on Firefox, but not with this asm.js module?

Where is that literal() defined? Cannot find it anywhere. Maybe it is that my dependency is broken?