comparison lib/js/urweb.js @ 1035:f87d0fedc54c

Fix for lack of 'apply' method of IE6 native functions
author Adam Chlipala <adamc@hcoop.net>
date Sat, 21 Nov 2009 13:08:01 -0500
parents 7a4a55e05081
children e214ac93d73e
comparison
equal deleted inserted replaced
1034:a779402841f6 1035:f87d0fedc54c
889 stack = stack.next; 889 stack = stack.next;
890 break; 890 break;
891 case "f": 891 case "f":
892 fr.args[fr.pos++] = v; 892 fr.args[fr.pos++] = v;
893 if (fr.a == null) { 893 if (fr.a == null) {
894 var res;
894 stack = stack.next; 895 stack = stack.next;
895 e = {c: "c", v: fr.f.apply(null, fr.args)}; 896
897 if (fr.f.apply)
898 res = fr.f.apply(null, fr.args);
899 else if (fr.args.length == 0)
900 res = fr.f();
901 else if (fr.args.length == 1)
902 res = fr.f(fr.args[0]);
903 else if (fr.args.length == 2)
904 res = fr.f(fr.args[0], fr.args[1]);
905 else if (fr.args.length == 3)
906 res = fr.f(fr.args[0], fr.args[1], fr.args[2]);
907 else if (fr.args.length == 4)
908 res = fr.f(fr.args[0], fr.args[1], fr.args[2], fr.args[3]);
909 else if (fr.args.length == 5)
910 res = fr.f(fr.args[0], fr.args[1], fr.args[2], fr.args[3], fr.args[4]);
911 else
912 whine("Native function has " + fr.args.length + " args, but there is no special case for that count.");
913
914 e = {c: "c", v: res};
896 if (usedK) return null; 915 if (usedK) return null;
897 } else { 916 } else {
898 e = fr.a.data; 917 e = fr.a.data;
899 fr.a = fr.a.next; 918 fr.a = fr.a.next;
900 } 919 }