Better verification of function validity in LVM.call()

Wed, 24 Nov 2010 02:47:47 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 24 Nov 2010 02:47:47 +0000
changeset 130
88fa4df26e9d
parent 129
6784d462999f
child 131
cd1ba419c808

Better verification of function validity in LVM.call()

lvm.js file | annotate | diff | comparison | revisions
--- a/lvm.js	Mon Nov 22 19:38:27 2010 +0000
+++ b/lvm.js	Wed Nov 24 02:47:47 2010 +0000
@@ -403,7 +403,7 @@
 		{
 			return f.apply(this, args);
 		}
-		else
+		else if(f.instructions)
 		{
 			var frame = {f:f,pc:0,entry:true};
 			if(args)
@@ -415,6 +415,8 @@
 				frame.reg[i] = this.LValue(null);
 			return this.run(frame);
 		}
+		else
+			throw "Attempt to call invalid function object: "+f.toString();
 	},
 	run: function(frame)
 	{

mercurial