Improving Function parser for JavaScript functions
-
Current Function List for JavaScript includes all asynchronous calls into the function list.
For example,
setTimeout(function (req, res) { });will be recognized as a function with the name function() in the list. How to alter functionList.xml to exclude functions without names in Function List?
-
Hello Edtech-Everywhere,
actually, if I paste your example into the editor, I don’t have the function listed, even
after pressing refresh multiple times.
Are you sure you do not use an modified functionList.xml?Cheers
Claudia -
Hi Claudia,
Thanks. I agree that exact example was not correct. Please try to insert a space between setTimeout and function:
setTimeOut( function(x){ });
functionList.xml is from original distribution.
-
Hello @Edtech-Everywhere,
ok, I tried to understand the mainExpr regex but must say I’m not really sure if I did, nevertheless
when inserting \K after function it seems to work, atleast it did work with my example shown below.Old:
"((^|[\s]+|[;\}\.])([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*[\s]*[=:]|^|[\s;\}]+)[\s]*function([\s]+[_A-Za-z]?[\w_]*\([^\)\(]*\)|\([^\)\(]*\))[\n\s]*\{"New:
"((^|[\s]+|[;\}\.])([_A-Za-z][\w_]*\.)*[_A-Za-z][\w_]*[\s]*[=:]|^|[\s;\}]+)[\s]*function\K([\s]+[_A-Za-z]?[\w_]*\([^\)\(]*\)|\([^\)\(]*\))[\n\s]*\{"Example:
hello(); function hello() {document.write('Hello');} setTimeOut( function(x){ }); <HTML> <HEAD> <TITLE>Estate Agent 2</TITLE> <SCRIPT> function House(name,rooms,price,garage) { this.name=name; this.rooms=rooms; this.price=price; this.garage=garage; this.view=view; } function view() { with (this) document.write(name+' has '+rooms+' rooms, '+(garage?'a':'no')+' garage, and costs £'+price+'<BR>'); } house1=new House('House 1',4,100000,false); house2=new House('Big House',5,200000,true); house1.view(); house2.view(); </SCRIPT> </HEAD> </HTML>May I ask you to test this extensively and report back if it does what it should and
no other thing has been broken?Cheers
Claudia -
Hi Claudia!
Thanks!
It seems that the issue has been solved. I will keep you updated if I found any bugs.
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login