#1466 js: Func.arity is missing

dsav Thu 31 Mar 2011

The following code:

Func f := |->| {}
echo(f.arity)

spawns TypeError: Object |->sys::Void| has no method arity exception, when compiled into JavaScript. However, f.params.size returns 0 as intended.

andy Thu 31 Mar 2011

Promoted to ticket #1466 and assigned to andy

SlimerDude Thu 24 Sep 2015

Try this:

diff -r fd89993adbdd src/sys/js/fan/Func.js
--- a/src/sys/js/fan/Func.js	Wed Sep 23 17:17:28 2015 -0400
+++ b/src/sys/js/fan/Func.js	Fri Sep 25 01:20:35 2015 +0100
@@ -66,6 +66,7 @@
 //////////////////////////////////////////////////////////////////////////
 
 fan.sys.Func.prototype.params = function() { return this.m_params; }
+fan.sys.Func.prototype.arity = function() { return this.m_params.size(); }
 fan.sys.Func.prototype.returns = function() { return this.m_return; }
 fan.sys.Func.prototype.method = function() { return null; }
 

andy Thu 1 Oct 2015

Ticket resolved in 1.0.68

Login or Signup to reply.