rzel / joose-js

Automatically exported from code.google.com/p/joose-js
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Multi-signatures issue #19

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. (new (Class('CTest', {
    methods: {
            log: [
                {
                    signature: ["info", TYPE.Str],
                    method:    function(type, str) {
                        console.log(str);
                    }
                }
                , {
                    signature: ["debug", TYPE.Str],
                    method:    function(type, str) {
                        console.log(str);
                    }
                }
                , {
                    signature: [TYPE.Str, Object],
                    method:    function(type, obj) {
                        console.log(type, "Object: foo Encountered");
                    }
                }
            ]
    }
}))).log("info", {});

What is the expected output? What do you see instead?
 Expected:
 info Object: foo Encountered

 Error:
 TypeError: invalid 'instanceof' operand sig[i]

What version of the product are you using? On what operating system?
 2.1/Windows 7/Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.1.3)
Gecko/20090824 Firefox/3.5.3

Please provide any additional information below.
 possible path:

 replace:
 args[i] instanceof sig[i]) {

 to:
 (function(arg,sig){try{return arg instanceof sig;}catch(e){return arg
instanceof sig.constructor;}})(args[i], sig[i])) {

Original issue reported on code.google.com by denis.gu...@gmail.com on 13 Oct 2009 at 1:05